fix: export links cleanly on formatted lines + don't escape _ in code blocks (#156, part)#182
Merged
JohnMcLear merged 1 commit intomasterfrom Apr 17, 2026
Conversation
…code blocks (#156, part) Two export-to-Markdown bugs from #156: 1. A link on a line that is also bold/italic came out as \`**bold prefix**[link text](**https://linkurl**)\`. The URL handler was stepping past the \`[\` without closing the open format tags, so every URL character produced another \`**\` inside the link token. Close any currently-open inline tags before emitting the URL, write the URL text verbatim, and reopen the tags after the closing \`)\`. 2. Underscores inside a \`heading: 'code'\` line were globally escaped to \`\\_\` by the final \`assem.replace(/_/g, '\\\\_')\`. Identifiers in code blocks should stay literal, so the renderer doesn't turn \`snake_case\` into \`snake\\\\_case\`. Skip the underscore escape on code-styled lines. Doesn't address the other two items in #156 (stray indentation turning into a code block, and bold-list markers landing outside the \`-\`) — those need follow-ups. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses two of the four items in #156:
**/*markers inside the Markdown link token ([text](**https://...**)). Close open tags before the URL, emit URL text verbatim, reopen tags afterwards./_/g → \\_replace ran unconditionally, sosnake_caseinside aheading: 'code'line turned intosnake\\_casein the rendered MD. Skip the escape on code-styled lines.Leaves the other two items (stray 4-space indent rendering as code; bold markers landing outside the list dash) for follow-ups — they need cleaner changes than a drive-by patch.