Repository navigation
fix: strip stray code fences and separate bare URLs from non-ASCII text - #76
Open
hoanle0126 wants to merge 1 commit into
Open
hoanle0126 wants to merge 1 commit into
hoanle0126 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #33
Addresses the two Markdown translation issues reported in #33 that caused Docusaurus MDX compilation and link parsing to fail for
fa,ja, and other locales:Stray code fences (
```) and section labels (Body:/بخش body:) in translated Markdown:```markdown/```yamlblock, stripping only the preamble before the opening---delimiter left either:```fence (and optional translatedBody:label) immediately after the frontmatter---(as seen infa/docusaurus-plugin-content-docs/current/Capabilities.md), or```fence on the final line of the file (present in 12 translated.mdfiles acrossar,de,fa,fr,ja,ru, andta).sanitizeMarkdownandvalidateFrontmatterinsrc/translate.ts(plusTRANSLATION_INSTRUCTIONSinsrc/constants.ts) to strip and reject stray post-frontmatter fences/labels and unbalanced trailing code fences, and cleaned up the 12 affected Markdown files.Bare URLs glued directly to non-ASCII text / fullwidth punctuation in CJK translations:
ja,zh,ko), barehttp://orhttps://URLs followed immediately by non-ASCII characters or fullwidth punctuation ((,)) without a space caused GFM autolink (remark-gfm) to swallow the trailing text (and any subsequent[from a Markdown link), either failing MDX compilation (Can't parse URL ... with base unspecified://as inja/.../BoilerplateProjects.md) or producing corrupted URLs.sanitizeMarkdownandvalidateFrontmatterto ensure bare URLs outside code blocks, inline code, and[text](url)/<url>links are separated by a space before trailing non-ASCII characters, and fixed the 6 affected files acrossja,ko, andzh.Verification
test/frontmatter.test.tscovering post-frontmatter fences/labels, outer trailing fences, bare URLs followed by non-ASCII text, and repository-wide validation across all 18 locales (npm test).