-
Notifications
You must be signed in to change notification settings - Fork 4
fix(transform): modifying transform to match linting rules #1959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1263,6 +1263,17 @@ function omitPlatformSpecificSections(options: any) { | |
| options.toDelete.add(parent.children[index]); | ||
| } | ||
| break; | ||
| } else if (platformsEqual(currPlats, segment.platforms) && segment.platforms.indexOf(options.platform) != -1) { | ||
| // platform matches: keep content but remove the comment markers | ||
| parent.children[checkIndex].value = parent.children[checkIndex].value.substring(0, startSeg.startIndex); | ||
| if (parent.children[checkIndex].value.length == 0) { | ||
| options.toDelete.add(parent.children[checkIndex]); | ||
| } | ||
| parent.children[index].value = parent.children[index].value.substring(segment.endIndex); | ||
| if (parent.children[index].value.length == 0) { | ||
| options.toDelete.add(parent.children[index]); | ||
| } | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -1809,7 +1820,7 @@ export class MarkdownTransformer { | |
| .use(finishRemoveBlocks, options) | ||
| .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) { | ||
| if (err) { | ||
| callback(err, null); | ||
|
|
@@ -1821,6 +1832,7 @@ export class MarkdownTransformer { | |
| 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]" | ||
|
Comment on lines
1832
to
+1835
|
||
|
|
||
| output.push({ content: fileContent, componentOutput: componentOutput }); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot apply changes based on this feedback