Skip to content

Commit

Permalink
Use nested markdown grammar for highlighting docstrings
Browse files Browse the repository at this point in the history
This uses the "inline" version of the markdown grammar.

https://github.com/MDeiml/tree-sitter-markdown

see issue #18
  • Loading branch information
dannyfreeman committed Sep 9, 2023
1 parent 881756c commit 9af0a6b
Show file tree
Hide file tree
Showing 4 changed files with 260 additions and 195 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,9 @@
- (See treesit-font-lock-level documentation for more information.)
- Highlight docstrings in interface, protocol, and variable definitions
- Add support for semantic indentation (now the default)
- Highlight "\`quoted-symbols\` in docs strings like this."
- This feature uses a nested markdown parser.
If the parser is not available this feature should be silently disabled.

## 0.1.5

Expand Down
13 changes: 9 additions & 4 deletions README.md
Expand Up @@ -106,11 +106,14 @@ git clone https://github.com/clojure-emacs/clojure-ts-mode.git

Once installed, evaluate clojure-ts-mode.el and you should be ready to go.

### Install libtree-sitter-clojure shared library
### Install tree-sitter grammars

The compile tree-sitter clojure shared library must be available to Emacs.
Additionally, the tree-sitter [markdown_inline](https://github.com/MDeiml/tree-sitter-markdown) shared library will also be used for docstrings if available.

The tree-sitter clojure shared library must be available to Emacs.
If you have `git` and a C compiler (`cc`) available on your system's `PATH`, **then these steps should not be necessary**.
clojure-ts-mode will install the grammar when you first open a Clojure file.
clojure-ts-mode will install the grammars when you first open a Clojure file and
`clojure-ts-ensure-grammars` is set to `t` (the default).

If clojure-ts-mode fails to automatically install the grammar, you have the option to install it manually.

Expand All @@ -120,7 +123,9 @@ Some distributions may package the tree-sitter-clojure grammar in their package
If yours does you may be able to install tree-sitter-clojure with your system package manager.

If the version packaged by your OS is out of date, you may see errors in the `*Messages*` buffer or your clojure buffers will not have any syntax highlighting.
If this happens you should install the grammar manually with `M-x treesit-install-language-grammar <RET> clojure`.

If this happens you should install the grammar manually with `M-x treesit-install-language-grammar <RET> clojure` and follow the prompts.
Recommended values for these prompts can be seen in `clojure-ts-grammar-recipes`.

#### Compile From Source

Expand Down

0 comments on commit 9af0a6b

Please sign in to comment.