Skip to content

parser/pageparser: Preserve non-ASCII whitespace after e.g. summary divider#15047

Open
bep wants to merge 1 commit into
gohugoio:masterfrom
bep:fix/ideographicspace
Open

parser/pageparser: Preserve non-ASCII whitespace after e.g. summary divider#15047
bep wants to merge 1 commit into
gohugoio:masterfrom
bep:fix/ideographicspace

Conversation

@bep

@bep bep commented Jun 16, 2026

Copy link
Copy Markdown
Member

Make it insted consume just ASCII whitespace, which preserves e.g. ideographic space (U+3000) after the summary divider, which is important for e.g. Chinese and Japanese content, and possibly other Unicode whitespace characters with meaning.

Doing this is possibly breaking, but nit likely, and obviously the correct thing to do.

@gemini-code-assist

Copy link
Copy Markdown
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@bep bep force-pushed the fix/ideographicspace branch from d0caf8b to fc88af9 Compare June 16, 2026 14:35
@bep bep requested a review from Copilot June 16, 2026 18:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the page parser’s whitespace consumption logic to treat only ASCII whitespace as skippable in key lexer paths, preserving meaningful non-ASCII whitespace (e.g. U+3000 ideographic space) after the summary divider and similar constructs.

Changes:

  • Replace unicode.IsSpace-based skipping with an isASCIISpace helper for consumeSpace, consumeToSpace, and indexNonWhiteSpace.
  • Update shortcode and intro lexers to use the new ASCII-space predicate.
  • Add a regression test ensuring ideographic space after <!--more--> is preserved in the resulting text item.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
parser/pageparser/pageparser_test.go Adds a regression test for preserving U+3000 after the summary divider.
parser/pageparser/pagelexer.go Switches whitespace skipping/indexing helpers from Unicode space to ASCII space, and introduces isASCIISpace.
parser/pageparser/pagelexer_shortcode.go Updates shortcode lexing to use isASCIISpace for whitespace handling.
parser/pageparser/pagelexer_intro.go Updates intro lexing to use isASCIISpace when skipping leading whitespace.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread parser/pageparser/pageparser_test.go Outdated
Comment on lines +147 to +150
c.Assert(err, qt.IsNil)

textItem := items[2]
c.Assert(textItem.ValStr(input), qt.Equals, "\u3000bbb")
Comment on lines 309 to 311
return l.errorf("unclosed shortcode action")
case isSpace(r), isEndOfLine(r):
case isASCIISpace(r), isEndOfLine(r):
l.ignore()
Comment on lines +35 to 36
case !isASCIISpace(r) && !isEndOfLine(r):
break LOOP
…ivider

Make it insted consume just ASCII whitespace, which preserves e.g. ideographic space (U+3000) after the summary divider, which is important for e.g. Chinese and Japanese content, and possibly other Unicode whitespace characters with meaning.

Doing this is possibly breaking, but not likely, and obviously the correct thing to do.
@bep bep force-pushed the fix/ideographicspace branch from fc88af9 to 322e599 Compare June 17, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants