mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 04:21:24 +00:00
Fix strikethrough in 'markdown-ts-mode' (bug#80991)
* lisp/textmodes/markdown-ts-mode.el (markdown-ts--treesit-settings): Add a new font-lock block for 'paragraph-inline' that handles strikethrough nodes more carefully.
This commit is contained in:
parent
0be998d4bc
commit
b39c123490
1 changed files with 32 additions and 1 deletions
|
|
@ -154,6 +154,17 @@
|
||||||
;; content. Lowercase `<!doctype html>' works as a workaround.
|
;; content. Lowercase `<!doctype html>' works as a workaround.
|
||||||
;; See <https://github.com/tree-sitter-grammars/tree-sitter-markdown/issues/233>.
|
;; See <https://github.com/tree-sitter-grammars/tree-sitter-markdown/issues/233>.
|
||||||
;;
|
;;
|
||||||
|
;; - The grammar parses solo tildes, incorrectly applying strikethrough.
|
||||||
|
;; For example, writing:
|
||||||
|
;;
|
||||||
|
;; I see ~approximately four lights.
|
||||||
|
;; I do not see ~approximately five lights.
|
||||||
|
;;
|
||||||
|
;; Results in strikethrough incorrectly starting at the first
|
||||||
|
;; ~approximately and extending till the tilde at the second
|
||||||
|
;; ~approximately.
|
||||||
|
;; See <https://github.com/tree-sitter-grammars/tree-sitter-markdown/issues/236>.
|
||||||
|
;;
|
||||||
;; - Superscript (`^text^') and subscript (`~text~') syntax is not
|
;; - Superscript (`^text^') and subscript (`~text~') syntax is not
|
||||||
;; supported by the grammar. No EXTENSION_ build flag exists for
|
;; supported by the grammar. No EXTENSION_ build flag exists for
|
||||||
;; this. This is Pandoc / PHP Markdown Extra syntax, not CommonMark
|
;; this. This is Pandoc / PHP Markdown Extra syntax, not CommonMark
|
||||||
|
|
@ -1703,13 +1714,33 @@ Skip matches already inside tree-sitter link or autolink nodes."
|
||||||
'(((code_span) @markdown-ts-code-span)
|
'(((code_span) @markdown-ts-code-span)
|
||||||
((code_span_delimiter) @markdown-ts--fontify-delimiter))
|
((code_span_delimiter) @markdown-ts--fontify-delimiter))
|
||||||
|
|
||||||
|
:language 'markdown-inline
|
||||||
|
:override 'append
|
||||||
|
:feature 'paragraph-inline
|
||||||
|
;; Order matters: most specific to least specific.
|
||||||
|
'(;; ~ x ~ (strikethrough (emphasis_delimiter) ) : ( (emphasis_delimiter))
|
||||||
|
;; ^^^
|
||||||
|
;; inline text needs to be ignored
|
||||||
|
((strikethrough ((emphasis_delimiter)
|
||||||
|
:anchor
|
||||||
|
_ @foo
|
||||||
|
(emphasis_delimiter))
|
||||||
|
(:match "\\`[~[:print:]]\\'" @foo)
|
||||||
|
)
|
||||||
|
@default)
|
||||||
|
;; ~~x~~ (strikethrough (emphasis_delimiter) (strikethrough (emphasis_delimiter) (emphasis_delimiter)) (emphasis_delimiter))
|
||||||
|
((strikethrough (emphasis_delimiter) (strikethrough (emphasis_delimiter) (emphasis_delimiter)) (emphasis_delimiter))
|
||||||
|
@markdown-ts-strikethrough)
|
||||||
|
;; ~x~ (strikethrough (emphasis_delimiter) (emphasis_delimiter))
|
||||||
|
((strikethrough (emphasis_delimiter) (emphasis_delimiter))
|
||||||
|
@markdown-ts-strikethrough))
|
||||||
|
|
||||||
:language 'markdown-inline
|
:language 'markdown-inline
|
||||||
:override 'append
|
:override 'append
|
||||||
:feature 'paragraph-inline
|
:feature 'paragraph-inline
|
||||||
'(((link_destination) @markdown-ts--fontify-link-destination)
|
'(((link_destination) @markdown-ts--fontify-link-destination)
|
||||||
((emphasis) @markdown-ts-emphasis)
|
((emphasis) @markdown-ts-emphasis)
|
||||||
((strong_emphasis) @markdown-ts-bold)
|
((strong_emphasis) @markdown-ts-bold)
|
||||||
((strikethrough) @markdown-ts-strikethrough)
|
|
||||||
(inline_link (link_text) @markdown-ts--fontify-link-node)
|
(inline_link (link_text) @markdown-ts--fontify-link-node)
|
||||||
(full_reference_link (link_text) @markdown-ts--fontify-link-node)
|
(full_reference_link (link_text) @markdown-ts--fontify-link-node)
|
||||||
(full_reference_link (link_label) @markdown-ts--fontify-link-node)
|
(full_reference_link (link_label) @markdown-ts--fontify-link-node)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue