Repository navigation
fix(html): read code language from Sphinx highlighting wrappers - #5701
XuanTuWang wants to merge 1 commit into
Conversation
|
✅ DCO Check Passed Thanks @XuanTuWang, all your commits are properly signed off. 🎉 |
Signed-off-by: XuanTuWang <147527217+XuanTuWang@users.noreply.github.com>
e9149eb to
2eecbfb
Compare
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
AI triage (advisory)Checked commit The HTML backend now reads the code language from Sphinx Topic labels added: CI safety: no concern found. A maintainer must still approve CI. 1 related pull request(s) in the same code
The |
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the full diff at 2eecbfbf7c. It read the code and did not run it.
No merge-deciding defect found. The new Sphinx wrapper lookup in _code_language_hint runs only after the explicit pre and code hints fail. It also runs only when the structure is div.highlight-<lexer> > div.highlight > pre, so other inputs keep their old result.
A maintainer makes the merge decision. This review never approves the pull request.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Sphinx puts the lexer for a code block on an outer
div, for examplediv.highlight-python3 > div.highlight > pre. Read that hint when the block itself has no recognized language. Keep explicit hints onpreandcodefirst. Leave unsupported lexers such asshell-sessionas unknown.Issue resolved by this Pull Request:
Resolves #5700
Checklist:
Review evidence:
unknownand failed. The other three passed. After the fix, all four passed. They check the code text and language, including an explicit inner Bash hint, an unsupported lexer, and an unrelated wrapper.code_language: Python. The Markdown export used apythonfence and the HTML export usedlanguage-python.unknowntoPython. The two shell transcripts stayedunknown.python -m pytest -q tests/test_code_language_detection.py tests/test_backend_html.py -k 'sphinx_code_language or preformatted or code_language'passed all 78 selected cases. Also ran both test files in full with the lockeddocling-coreversion (2.108.0): 237 passed and one optional Playwright test was skipped because Playwright was not installed.make validateandgit diff --checkpassed. No reference files changed. The full repository test suite was not run locally.Prepared and tested with OpenAI Codex assistance.