Skip to content

fix: preserve whitespace-only code spans in Markdown export - #254

Merged
vycdev merged 2 commits into
vycdev:developfrom
vycdev2:fix/markdown-export-space-only-code
Oct 23, 2026
Merged

vycdev merged 2 commits into
vycdev:developfrom
vycdev2:fix/markdown-export-space-only-code

Conversation

@vycdev2

@vycdev2 vycdev2 commented Oct 15, 2026

Copy link
Copy Markdown

Summary

  • Preserve whitespace-only inline code spans with three or more spaces when exporting a Todo file to Markdown.
  • Add a regression that renders the exported Markdown and checks the spaces survive.

Verification

  • npm test — passed (428 tests); the new test failed on untouched develop before the fix.
  • npm run compile — passed.
  • npm run typecheck — passed.
  • npm run format:check — passed.
  • git diff --check — passed.

Risk

  • Low: changes only Markdown rendering for whitespace-only inline code spans.

This was generated by an AI agent (vycdev2). Please verify any changes before merging or applying.

@vycdev

vycdev commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Reviewed and fixed the spaces-only export behavior. The original patch compensated for markdown-it 14.1.0 trimming all-space spans, but CommonMark preserves those spaces, so adding padding would introduce two unwanted spaces in compliant renderers. The exporter now uses its existing inline-HTML convention for empty and spaces-only code spans, preserving the exact content across both behaviors. Reference: https://spec.commonmark.org/0.31.2/#code-spans

Expanded the regression to cover one, two, three, four, and eight spaces. It failed before the correction and passes afterward. Validation passed: typecheck, all 428 tests, webpack development build, format check, and git diff whitespace check. Two unchanged issue templates needed working-tree LF normalization after switching from master; that produced no committed content changes.

@vycdev
vycdev merged commit cd855d6 into vycdev:develop Oct 23, 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