Skip to content

Preserve inline code delimiters and significant whitespace - #152

Merged
ralyodio merged 2 commits into
profullstack:masterfrom
RowletCC:fix/code-span-padding
Sep 21, 2026
Merged

ralyodio merged 2 commits into
profullstack:masterfrom
RowletCC:fix/code-span-padding

Conversation

@RowletCC

@RowletCC RowletCC commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Inline code currently applies trim() to the entire code-span body and allows its backtick regex to split a delimiter run. As a result, whitespace examples lose their contents, two unmatched backticks become an empty code element, and a longer run inside a code example can prematurely close it. This changes literal snippets in job descriptions and resumes.

Match whole backtick runs of equal length, retaining unmatched runs as ordinary text. Precompute the next run of each length so unmatched openers do not repeatedly scan the remaining text. Normalize code-span whitespace using CommonMark's rule: convert line endings to spaces, then remove one leading and one trailing ASCII space only when both exist and the content is not entirely spaces. Preserve tabs, non-breaking spaces, one-sided padding, and additional spaces.

Validation: reproduced lost padding and all-space contents before the initial fix. Added 11 delimiter tests; 7 fail on the earlier whitespace-only patch and all 11 pass with the delimiter correction. Both existing code-span tests also pass, including ASCII padding, all-space contents, one-sided padding, tabs, NBSP, literal markup, and CRLF/CR/LF normalization. TypeScript build, no-emit typecheck and formatting checks pass. The surrounding block parser is unchanged; full repository tests were not run, and this does not claim full CommonMark conformance.

Reference: CommonMark 0.31.2 code spans.

Submitted under the published $0.25 USD-equivalent reward per valid bug-fix PR, using the existing application and settlement conversation. Requested settlement remains native SOL on Solana mainnet; acceptance and the exact net token amount still require the payer's confirmation.

@RowletCC RowletCC changed the title Preserve whitespace in Markdown code spans Preserve inline code delimiters and significant whitespace Sep 20, 2026
@ralyodio
ralyodio merged commit 16da16a into profullstack:master Sep 21, 2026
4 checks 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