fix(cli): keep MDX comments in rawMarkdown for the visual editor - #17642
fix(cli): keep MDX comments in rawMarkdown for the visual editor#17642devin-ai-integration[bot] wants to merge 3 commits into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
AI Review Summary
Small, focused fix: rawMarkdown is now stored verbatim while rendered markdown remains comment-stripped. Change looks correct and the test fixture covers the three comment placements. Only minor concerns: possible now-unused stripMdxComments import in previewDocs.ts (if it's no longer referenced elsewhere) and a brittle whitespace assertion in the test.
- 🔵 2 suggestion(s)
To request another review, comment /ai-review on this pull request.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Docs Generation Benchmark ResultsComparing PR branch against median of 5 nightly run(s) on
Docs generation runs |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Description
Linear ticket: N/A (reported in Slack #sales-eng-devin-runs)
The visual editor loads a page's source from
rawMarkdownin the published docs definition (getNormalizedMarkdownin fern-platform prefersrawMarkdownovermarkdown). Since b57c131 (fix(cli): strip MDX comments from markdown output) the CLI appliedstripMdxCommentsto bothmarkdownandrawMarkdown, so{/* ... */}comments never reached the editor's code view, and the first editor commit wrote the stripped file back to the customer's repo (see fern-support/willktrial-437063#11).This keeps the rendered
markdowncomment-free (public site / LLM output unchanged) and storesrawMarkdownverbatim:Same change in
docs-preview/previewDocs.tsforfern docs dev, and in the translated-page paths (buildTranslatedDocsDefinition.ts,publishDocs.ts,runPreviewServer.ts,runAppPreviewServer.ts), which previously setrawMarkdown: processedMarkdownand now use the original locale source.Companion editor-side fix (inline comment round-trip + visible comment chip): fern-api/fern-platform#14450. Customers need to re-publish with a CLI containing this fix for existing pages to regain comments in the editor.
Changes Made
DocsDefinitionResolver.ts: stop stripping comments fromrawMarkdownFiles(pages, changelogs, tag descriptions);markdownstill strippedpreviewDocs.ts: same for local previewbuildTranslatedDocsDefinition.ts,publishDocs.ts,runPreviewServer.ts,runAppPreviewServer.ts):rawMarkdown= original locale source instead of processed markdowndocs-resolvertestmdx-comments.test.ts+ minimalfixtures/mdx-comments(top-level, nested-in-Callout, and inline comments); assertsmarkdownhas no{/*andrawMarkdownequals the source file byte-for-byteremote-workspace-runnertestbuildTranslatedDocsDefinition.test.tswith the same assertions for translated pageskeep-mdx-comments-in-raw-markdown.yml(type: fix)Testing
docs-resolver17 files / 119 tests pass,docs-markdown-utils293 tests pass, new translated-page test passes; both new tests verified to fail with the fix stashedpnpm turbo run compilefordocs-resolver,docs-preview,remote-workspace-runner(49/49 tasks), biome check cleanLink to Devin session: https://app.devin.ai/sessions/ce3af3fd00c147ef8f83eed951b6592f
Open in Devin Desktop: https://app.devin.ai/desktop/session/ce3af3fd00c147ef8f83eed951b6592f?variant=devin