fix(transform): modifying transform to match linting rules#1959
Conversation
Split [!Warning] and [!Note] blocks so the note type is on its own line, matching the formatting fix applied to doc/en/components/layouts/tile-manager.md in PR #1959. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the Markdown transformation/export pipeline to produce DocFX/markdownlint-compliant Markdown output, and fixes a few existing docs to match the required admonition formatting.
Changes:
- Strip platform HTML comment markers while retaining content when the target platform matches.
- Configure
remark-stringifyoutput to use DocFX-friendly formatting (HR as---, emphasis as_, and fenced code blocks). - Normalize DocFX note/admonition blocks in a few docs to the multi-line
> [!Note]/> ...format.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/ext/MarkdownTransformer.ts | Adjusts platform-section omission behavior and remark stringification settings to better match DocFX/markdownlint rules. |
| doc/jp/components/general-changelog-dv-react.md | Reformats a DocFX note block to the expected multi-line blockquote form. |
| doc/en/components/layouts/tile-manager.md | Reformats multiple DocFX admonitions to the expected multi-line blockquote form. |
| doc/en/components/general-changelog-dv-react.md | Reformats a DocFX note block (also fixes missing spacing after the admonition marker). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| fileContent = fileContent.split("* ").join("- ").split("* ").join("- "); // unordered lists: "* " -> "- " | ||
| fileContent = fileContent.split(" - ").join(" - ").split(" - ").join(" - "); // no extra indent | ||
| fileContent = fileContent.split(". ").join(". "); // no extra space after item of ordered list | ||
| fileContent = fileContent.split("\\[!").join("[!"); // note blocks: remark-stringify escapes "[" in "[!NOTE]" as "\[!NOTE]" |
There was a problem hiding this comment.
The post-stringify cleanup that replaces all occurrences of "* " / "* " with "- " is not scoped to actual list markers and can mutate legitimate content that includes an asterisk followed by spaces (e.g., table text like display* | in doc/en/components/grids/_shared/column-types.md:389). Consider removing these global string replaces and instead configuring remark-stringify to emit - bullets (e.g., via a bullet option) or, if post-processing is still needed, restrict it to line-start list markers only.
| .use(transformNotes, options) | ||
| .use(finishRemoveNotes, options) | ||
| .use(stringify) | ||
| .use(stringify, { rule: '-', ruleRepetition: 3, ruleSpaces: false, emphasis: '_', fences: true }) | ||
| .process(fileContent, function(err: any, vfile: any) { |
There was a problem hiding this comment.
New stringify settings and the updated platform-section omission logic change the rendered Markdown output (HR marker, emphasis marker, fenced-code formatting, and stripping platform comment markers). There are existing Mocha-based transformation tests, but none assert these formatting requirements; adding an integration test that transforms a small Markdown fixture and verifies the expected DocFX-compliant output would help prevent regressions.
Ensures:
---instead of***all required for exports to docfx