Skip to content

Commit 5794188

Browse files
rrudakovbbatsov
authored andcommitted
Add customization option to disable markdown syntax highlighting
1 parent ee8baed commit 5794188

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
- Fix semantic indentation of quoted functions
1313
- Add custom `fill-paragraph-function` which respects docstrings similar to
1414
`clojure-mode`.
15+
- Add customization option to disable markdown syntax highlighting in the
16+
docstrings.
1517

1618
## 0.2.2 (2024-02-16)
1719

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ To highlight entire rich `comment` expression with the comment font face, set
4444
By default this is `nil`, so that anything within a `comment` expression is
4545
highlighted like regular clojure code.
4646

47+
### Highlight markdown syntax in docstrings
48+
49+
By default markdown syntax is highlighted in the docstrings using
50+
`markdown_inline` grammar. To disable this feature set
51+
52+
``` emacs-lisp
53+
(setopt clojure-ts-use-markdown-inline nil)
54+
```
55+
4756
### Navigation and Evaluation
4857

4958
To make forms inside of `(comment ...)` forms appear as top-level forms for evaluation and navigation, set

clojure-ts-mode.el

+10-3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ double quotes on the third column."
112112
:safe #'integerp
113113
:package-version '(clojure-ts-mode . "0.2.3"))
114114

115+
(defcustom clojure-ts-use-markdown-inline t
116+
"When non-nil, use Markdown inline grammar for docstrings."
117+
:type 'boolean
118+
:safe #'booleanp
119+
:package-version '(clojure-ts-mode . "0.2.3"))
120+
115121
(defvar clojure-ts--debug nil
116122
"Enables debugging messages, shows current node in mode-line.
117123
Only intended for use at development time.")
@@ -1010,13 +1016,14 @@ See `clojure-ts--font-lock-settings' for usage of MARKDOWN-AVAILABLE."
10101016
\\{clojure-ts-mode-map}"
10111017
:syntax-table clojure-ts-mode-syntax-table
10121018
(clojure-ts--ensure-grammars)
1013-
(let ((markdown-available (treesit-ready-p 'markdown_inline t)))
1014-
(when markdown-available
1019+
(let ((use-markdown-inline (and clojure-ts-use-markdown-inline
1020+
(treesit-ready-p 'markdown_inline t))))
1021+
(when use-markdown-inline
10151022
(treesit-parser-create 'markdown_inline)
10161023
(setq-local treesit-range-settings clojure-ts--treesit-range-settings))
10171024
(when (treesit-ready-p 'clojure)
10181025
(treesit-parser-create 'clojure)
1019-
(clojure-ts-mode-variables markdown-available)
1026+
(clojure-ts-mode-variables use-markdown-inline)
10201027
(when clojure-ts--debug
10211028
(setq-local treesit--indent-verbose t)
10221029
(when (eq clojure-ts--debug 'font-lock)

0 commit comments

Comments
 (0)