Skip to content

Fix generating skeleton#20224

Merged
seanbudd merged 4 commits into
betafrom
fixXliff2
May 29, 2026
Merged

Fix generating skeleton#20224
seanbudd merged 4 commits into
betafrom
fixXliff2

Conversation

@seanbudd

@seanbudd seanbudd commented May 27, 2026

Copy link
Copy Markdown
Member

Link to issue number:

Fixes #20105

Summary of the issue:

markdownTranslate.py previously removed inline markdownlint comments during preprocessing, so those comments were not preserved in generated XLIFF skeleton content. This could break round-tripping and comment fidelity for markdown files that embed inline lint directives.

Description of user facing changes:

No direct end-user NVDA feature change. This affects markdown/XLIFF tooling behavior used in docs workflows: inline markdownlint comments are now retained in skeleton output.

Description of developer facing changes:

  • Removed preprocessMarkdownLines usage across markdown/XLIFF processing paths.
  • Updated inline markdownlint regex handling to capture and preserve inline markdownlint comments in skeletonizeLine.
  • Added getSkeletonContentFromXliffText to avoid over-aggressive .strip() on skeleton text.
  • Added a new fixture file:
    • markdownlint_inlineComments.md
  • Added unit coverage:
    • test_generateXliff_preservesInlineMarkdownLintCommentsInSkeleton
    • Uses module loading + patching of getRawGithubURLForPath to support file URI in test context.

Description of development approach:

This PR was heavily assisted through CoPilot.
The change removes line preprocessing that was stripping semantic inline comments and instead handles markdownlint comments at skeletonization time so comments remain in output. Skeleton text extraction was adjusted to preserve meaningful whitespace/newline boundaries. Test strategy was expanded with a dedicated fixture and targeted assertion of skeleton content.

Testing strategy:

Manual testing with: python source/markdownTranslate.py updateXliff -x user_docs/en/userGuide.xliff -m user_docs/en/userGuide.md -o $tempXliff

  • New targeted unit test validates that:
    • XLIFF generation succeeds for markdown containing inline markdownlint comments.
    • Skeleton contains translation placeholders and the expected inline markdownlint comments.
  • Existing markdownTranslate unit test suite remains in place for round-trip/update/translate behavior.

Known issues with pull request:

None

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@seanbudd seanbudd requested a review from michaelDCurran May 27, 2026 05:06
@seanbudd seanbudd requested a review from a team as a code owner May 27, 2026 05:06
Copilot AI review requested due to automatic review settings May 27, 2026 05:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts NVDA’s markdownTranslate.py Markdown↔XLIFF tooling so that inline markdownlint directives are preserved in generated XLIFF skeleton content (improving round-tripping fidelity for documentation workflows).

Changes:

  • Moves markdownlint handling into skeletonizeLine (and removes the prior preprocessing step that stripped markdownlint directives).
  • Adds getSkeletonContentFromXliffText to avoid over-aggressive .strip() when reading skeleton text from XLIFF.
  • Adds a new fixture and unit test intended to validate preservation of inline markdownlint comments in skeleton output.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
source/markdownTranslate.py Updates skeleton/XLIFF generation and extraction to preserve inline markdownlint directives and avoid stripping significant whitespace.
tests/unit/test_markdownTranslate.py Adds a targeted unit test asserting markdownlint directives appear in the generated skeleton.
tests/markdownTranslate/markdownlint_inlineComments.md Adds a Markdown fixture containing inline and directive-only markdownlint comments.

Comment thread source/markdownTranslate.py
Comment thread tests/unit/test_markdownTranslate.py
Comment thread source/markdownTranslate.py
@seanbudd

Copy link
Copy Markdown
Member Author

pre-commit.ci run

@seanbudd seanbudd merged commit de238b2 into beta May 29, 2026
39 checks passed
@seanbudd seanbudd deleted the fixXliff2 branch May 29, 2026 05:38
@github-actions github-actions Bot added this to the 2026.3 milestone May 29, 2026
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.

3 participants