Skip to content

✨ NEW: Add verbatim syntax highlighter output - #488

Open
Aschenbath wants to merge 1 commit into
executablebooks:masterfrom
Aschenbath:fix/oss40-20261124-928f-markdown-highlight-verbatim
Open

Aschenbath wants to merge 1 commit into
executablebooks:masterfrom
Aschenbath:fix/oss40-20261124-928f-markdown-highlight-verbatim

Conversation

@Aschenbath

Copy link
Copy Markdown
Contributor

Highlighters such as Pygments return a complete HTML block beginning with <div>, which the current renderer nests inside another <pre><code> wrapper. Add the optional Python-only highlight_verbatim setting: a nonempty callback result is returned exactly as supplied. Empty results and absent callbacks retain the escaped-code fallback; existing behavior remains the default. Document the option, escaping responsibility and a Pygments example. Fixes #256.

Validation: the regression fails against master with extra wrappers/newlines. Tests cover three presets, preserved trailing newlines, the escaped fallback, default wrapping and option toggling. All 1,193 tests passed through tox on Python 3.12; all pre-commit hooks, including Ruff and strict mypy, passed. The strict Sphinx build passed through tox with API generation enabled and the Windows-incompatible post-build echo omitted.

Related earlier proposal: #419 (closed). Prepared with Codex assistance.

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.

Option to skip adding <pre><code> to highlighted code

1 participant