Skip to content

Commit 3139463

Browse files
committed
[#60] Fix issue with fontification when markdown-inline is enabled
Many thanks to Juri Linkov <[email protected]> for his assistance.
1 parent 63a9ea4 commit 3139463

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- [#74](https://github.com/clojure-emacs/clojure-ts-mode/issues/74): Add imenu support for keywords definitions.
2323
- [#77](https://github.com/clojure-emacs/clojure-ts-mode/issues/77): Update grammars to the latest versions.
2424
- [#79](https://github.com/clojure-emacs/clojure-ts-mode/pull/79): Improve markdown highlighting in the docstrings.
25+
- [#60](https://github.com/clojure-emacs/clojure-ts-mode/issues/60): Fix issue with incorrect fontification, when `markdown-inline` is enabled.
2526

2627
## 0.2.3 (2025-03-04)
2728

clojure-ts-mode.el

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ if a third argument (the value) is provided.
345345
(treesit-range-rules
346346
:embed 'markdown-inline
347347
:host 'clojure
348+
:local t
348349
(clojure-ts--docstring-query '@capture)))
349350

350351
(defun clojure-ts--font-lock-settings (markdown-available)
@@ -1260,11 +1261,19 @@ If JUSTIFY is non-nil, justify as well as fill the paragraph."
12601261
"map_lit" "ns_map_lit" "vec_lit" "set_lit")
12611262
"A regular expression that matches nodes that can be treated as lists.")
12621263

1264+
(defconst clojure-ts--markdown-inline-sexp-nodes
1265+
'("inline_link" "full_reference_link" "collapsed_reference_link"
1266+
"uri_autolink" "email_autolink" "shortcut_link" "image"
1267+
"code_span"))
1268+
12631269
(defconst clojure-ts--thing-settings
12641270
`((clojure
12651271
(sexp ,(regexp-opt clojure-ts--sexp-nodes))
12661272
(list ,(regexp-opt clojure-ts--list-nodes))
1267-
(text ,(regexp-opt '("comment"))))))
1273+
(text ,(regexp-opt '("comment"))))
1274+
(when clojure-ts-use-markdown-inline
1275+
(markdown-inline
1276+
(sexp ,(regexp-opt clojure-ts--markdown-inline-sexp-nodes))))))
12681277

12691278
(defvar clojure-ts-mode-map
12701279
(let ((map (make-sparse-keymap)))
@@ -1380,7 +1389,6 @@ See `clojure-ts--font-lock-settings' for usage of MARKDOWN-AVAILABLE."
13801389
(let ((use-markdown-inline (and clojure-ts-use-markdown-inline
13811390
(treesit-ready-p 'markdown-inline t))))
13821391
(when use-markdown-inline
1383-
(treesit-parser-create 'markdown-inline)
13841392
(setq-local treesit-range-settings clojure-ts--treesit-range-settings))
13851393

13861394
(when (treesit-ready-p 'clojure)

0 commit comments

Comments
 (0)