Skip to content

fix: recognise ??? notes separator with trailing whitespace#16

Merged
dpecos merged 1 commit into
masterfrom
fix/issue-1-notes-separator-trailing-whitespace
Apr 16, 2026
Merged

fix: recognise ??? notes separator with trailing whitespace#16
dpecos merged 1 commit into
masterfrom
fix/issue-1-notes-separator-trailing-whitespace

Conversation

@dpecos
Copy link
Copy Markdown
Contributor

@dpecos dpecos commented Apr 16, 2026

Summary

  • One-character regex fix in lexer.ts: adds [ \t]* before the end anchor of the NOTES_SEPARATOR pattern
  • Adds 2 lexer tests (trailing spaces, trailing tab)
  • Adds 2 parser-level tests confirming notes are correctly split from content in both cases

Root cause

// before
NOTES_SEPARATOR: /(?:^|\n)(\?{3})(?:\n|$)/,

// after
NOTES_SEPARATOR: /(?:^|\n)(\?{3})[ \t]*(?:\n|$)/,

Any trailing space or tab on the ??? line prevented the regex from matching, so the separator was not recognised and all notes were rendered as regular slide content.

Closes #1

The notes separator regex required a newline or end-of-string
immediately after ???, so any trailing spaces or tabs on the same line
caused the separator to be silently ignored and the notes to be rendered
as slide content instead.

Added optional [ \t]* before the end anchor in the NOTES_SEPARATOR
regex, consistent with remark's behaviour.

Closes #1
@dpecos dpecos merged commit b985999 into master Apr 16, 2026
4 checks passed
@dpecos dpecos deleted the fix/issue-1-notes-separator-trailing-whitespace branch April 16, 2026 11:35
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.

Bug: notes separator ??? doesn't work with trailing spaces

1 participant