Skip to content

[io] Escape the named character references of the text in the Markdown export - #2241

Open
RavSinghChandan wants to merge 1 commit into
mindee:mainfrom
RavSinghChandan:markdown-export-entity
Open

RavSinghChandan wants to merge 1 commit into
mindee:mainfrom
RavSinghChandan:markdown-export-entity

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

…n exportMarkdown reads a named character reference as the character it names, so the OCR text © 2024 of a page was exported as "© 2024", and & as "&", and <div> as "

". The Markdown export escapes the characters that Markdown reads, but not the ampersand of such a reference. It shows in the OCR of a page of HTML or XML documentation.

The ampersand of a named reference is now escaped (\©), which renders as the text of the page. Only a name that exists in the HTML5 list is escaped, so R&D, AT&T, Q&A; and a lone & are kept as they are. I exported about 3,000 generated lines of words with special characters and rendered them with markdown-it: the lines whose text came back changed fell from 582 to 77, and none of the 77 is a reference (they are lines made only of spaces, and a line starting with ~~~, which is a separate case). 9 test cases, 4 fail without the change (the others are the cases that must not change).

@codecov

codecov Bot commented Nov 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.29%. Comparing base (656ea4e) to head (10c383f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2241   +/-   ##
=======================================
  Coverage   98.28%   98.29%           
=======================================
  Files         182      182           
  Lines       13165    13168    +3     
=======================================
+ Hits        12939    12943    +4     
+ Misses        226      225    -1     
Flag Coverage Δ
unittests 98.29% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

1 participant