Skip to content

Improve markdown highlighting in the docstrings #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- [#76](https://github.com/clojure-emacs/clojure-ts-mode/pull/76): Improve performance of semantic indentation by caching rules.
- [#74](https://github.com/clojure-emacs/clojure-ts-mode/issues/74): Add imenu support for keywords definitions.
- [#77](https://github.com/clojure-emacs/clojure-ts-mode/issues/77): Update grammars to the latest versions.
- [#79](https://github.com/clojure-emacs/clojure-ts-mode/pull/79): Improve markdown highlighting in the docstrings.

## 0.2.3 (2025-03-04)

Expand Down
2 changes: 1 addition & 1 deletion Eldev
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
(setq checkdoc-permit-comma-termination-flag t)
(setq checkdoc--interactive-docstring-flag nil)

(setf eldev-lint-default '(elisp))
(setq eldev-lint-default-excluded '(package))

(with-eval-after-load 'elisp-lint
;; We will byte-compile with Eldev.
Expand Down
9 changes: 8 additions & 1 deletion clojure-ts-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,14 @@ with the markdown-inline grammar."
:feature 'doc
:language 'markdown-inline
:override t
`((code_span) @font-lock-constant-face)))
`([((image_description) @link)
((link_destination) @font-lock-constant-face)
((code_span) @font-lock-constant-face)
((emphasis) @underline)
((strong_emphasis) @bold)
(inline_link (link_text) @link)
(inline_link (link_destination) @font-lock-constant-face)
(shortcut_link (link_text) @link)])))

(treesit-font-lock-rules
:feature 'quote
Expand Down
11 changes: 10 additions & 1 deletion test/samples/docstrings.clj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@ Don't format code this way."
"fizz"))

(defmacro fix-bug
"Fixes most known bugs."
"Fixes most known bugs.

Check markdown:
- [[some-function]]
- _emphasize_
- [link](https://github.com)
- __strong__
- *emphasize*

Looks good."
[& body]
`(try
~@body
Expand Down