From 90ea597376db6e2700d0478670d40ecf0a6df26a Mon Sep 17 00:00:00 2001 From: yeasy Date: Fri, 24 Jul 2026 21:08:44 -0700 Subject: [PATCH] fix(check-emphasis): recognise code fences opened inside a blockquote FENCE_RE was `^\s*(`{3,}|~{3,})`, which matches leading whitespace but not a blockquote marker. A fence written as `> ```python` was therefore never recognised, so the quoted code was scanned as prose and CJK-adjacent `**` inside it was reported as non-rendering emphasis. Since the emphasis check became a blocking CI gate, that false positive could red-line a legitimate push over a code sample in a callout. This file documents itself as mirroring check 6 of the workspace-level format_checker.py, whose FENCE_RE already handles up to three spaces of indent plus any number of `>` prefixes. Adopting that pattern restores the stated invariant. Demonstrated before/after on a file holding the same line both inside and outside a blockquoted fence: previously only the quoted copy was flagged (exit 1); now neither is (exit 0), while a genuine prose defect is still reported (exit 1), so the gate is not weakened. All 14 repos re-checked: check_emphasis and check_project_rules pass on all 1,615 markdown files, and the 14 copies remain byte-identical. A mutation-tested regression guard now lives in the workspace repo at tests/test_blockquote_fence_emphasis.py. --- check_emphasis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_emphasis.py b/check_emphasis.py index 6173e87..f2b1ca3 100644 --- a/check_emphasis.py +++ b/check_emphasis.py @@ -39,7 +39,7 @@ SKIP_DIRS = { "output", } -FENCE_RE = re.compile(r"^\s*(`{3,}|~{3,})(.*)$") +FENCE_RE = re.compile(r"^[ \t]{0,3}(?:>[ \t]?)*(`{3,}|~{3,})(.*)$") PUNCT_CATEGORIES = {"Pc", "Pd", "Pe", "Pf", "Pi", "Po", "Ps"} ASCII_PUNCT = set("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~") CJK_RE = re.compile(r"[㐀-鿿豈-﫿]")