From 0be998d4bc03b4ea12e506363d41b7e9ceeefc04 Mon Sep 17 00:00:00 2001 From: Rahul Martim Juliato Date: Thu, 7 May 2026 11:24:30 -0300 Subject: [PATCH] Fix code-span in headings in 'markdown-ts-mode' (bug#80979) * lisp/textmodes/markdown-ts-mode.el (markdown-ts--treesit-settings): Move the 'code_span' and 'code_span_delimiter' font-lock rules into a separate block with ':override prepend' instead of 'append'. The heading feature (level 1) applies its face via 'font-lock-append-text-property', so a code span that later appends 'markdown-ts-code-span' ends up with '(markdown-ts-heading-N markdown-ts-code-span)', where the heading face takes priority and the code-span face is suppressed. Prepending ensures 'markdown-ts-code-span' appears first in the face list and wins visually. --- lisp/textmodes/markdown-ts-mode.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/textmodes/markdown-ts-mode.el b/lisp/textmodes/markdown-ts-mode.el index 56fd98d86b8..8e28be036b7 100644 --- a/lisp/textmodes/markdown-ts-mode.el +++ b/lisp/textmodes/markdown-ts-mode.el @@ -1697,12 +1697,16 @@ Skip matches already inside tree-sitter link or autolink nodes." :override 'append '((fenced_code_block (code_fence_content) @markdown-ts--fontify-code-block)) + :language 'markdown-inline + :override 'prepend + :feature 'paragraph-inline + '(((code_span) @markdown-ts-code-span) + ((code_span_delimiter) @markdown-ts--fontify-delimiter)) + :language 'markdown-inline :override 'append :feature 'paragraph-inline '(((link_destination) @markdown-ts--fontify-link-destination) - ((code_span) @markdown-ts-code-span) - ((code_span_delimiter) @markdown-ts--fontify-delimiter) ((emphasis) @markdown-ts-emphasis) ((strong_emphasis) @markdown-ts-bold) ((strikethrough) @markdown-ts-strikethrough)