Skip to content

Fix escaped Markdown characters being silently dropped - #8

Merged
jamsinclair merged 1 commit into
jamsinclair:mainfrom
merphx:fix/escape-token-handling
Mar 24, 2026
Merged

Fix escaped Markdown characters being silently dropped#8
jamsinclair merged 1 commit into
jamsinclair:mainfrom
merphx:fix/escape-token-handling

Conversation

@merphx

@merphx merphx commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Escaped Markdown syntax characters (\*, \_, \`, \#) were silently dropped from the output instead of being rendered as their literal character equivalents.

Changes

  • Add handler for marked's escape token type in inlineToAdf, emitting the escaped character as a plain text node
  • Update the special-chars test fixture to reflect the correct expected output

Reviewer notes

\**not bold\** and \__not bold\__ correctly retain em marks on the inner content — this matches marked's parse, where the first \*/\_ escapes to a literal, leaving a valid *...\**/_...\__ em span. The fixture accurately reflects this.

Escaped characters are emitted as separate adjacent text nodes rather than being merged with surrounding text. This produces correct output — we've manually verified that Confluence renders adjacent plain text nodes without any visible gaps or breaks.

- Add case "escape" handler in inlineToAdf to emit escaped chars as plain text nodes instead of dropping them
- Fix special-chars fixture to reflect correct output: literal \*, \_, `, \# now preserved as text nodes

Co-Authored-By: opencode <noreply@opencode.ai>

@jamsinclair jamsinclair left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you! Good catch.

@jamsinclair
jamsinclair merged commit 0746b9e into jamsinclair:main Mar 24, 2026
1 check passed
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