mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-07-11 18:20:30 +00:00
a30348b2c4
Re-staged from the contributor's rebased head (0cee92c9) which independently converged on
the same 5-test-file class-tolerance fixups I'd made — shipping the contributor's exact
version, not my private variant. Tags md/markdown/mdx fenced blocks with md-source-block
class in both renderers; CSS wraps them while code/diff/csv keep horizontal-scroll. 90
renderer-family tests pass.
Co-authored-by: nesquena-hermes <agent@nesquena-hermes>
Co-authored-by: TomBanksAU <TomBanksAU@users.noreply.github.com>
28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
"""Regression tests for fenced code block syntax highlighting."""
|
|
from pathlib import Path
|
|
|
|
UI_JS = Path(__file__).resolve().parent.parent / "static" / "ui.js"
|
|
|
|
|
|
def _read_ui_js() -> str:
|
|
return UI_JS.read_text()
|
|
|
|
|
|
def test_fenced_code_blocks_add_prism_language_class():
|
|
js = _read_ui_js()
|
|
assert 'class="language-${esc(lang)}"' in js, (
|
|
"Fenced code blocks should add Prism language-* classes so syntax highlighting works"
|
|
)
|
|
|
|
def test_fenced_code_blocks_keep_existing_pre_header_layout():
|
|
js = _read_ui_js()
|
|
# The fenced code rendering was moved into the stash callback (#1154 fix).
|
|
# The template string now uses `lang` instead of `normalizedLang`, and
|
|
# markdown-source fences may add a dedicated md-source-block class.
|
|
assert '${h}<pre${preClass}><code${langAttr}>${esc(code.replace(/\\n$/,' in js, (
|
|
"The syntax-highlight fix should preserve the shared fenced code block layout"
|
|
)
|
|
assert '<div class="code-block">' not in js, (
|
|
"This fix should not introduce a new wrapper around fenced code blocks"
|
|
)
|