mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
feat(markdown): add treesit support
This commit is contained in:
@ -33,11 +33,16 @@ for Markdown's syntax is the format of plain text email. -- John Gruber
|
|||||||
- +grip ::
|
- +grip ::
|
||||||
Enable [[https://github.com/seagle0128/grip-mode][grip support]] (on [[kbd:][<localleader> p]]), to provide live github-style
|
Enable [[https://github.com/seagle0128/grip-mode][grip support]] (on [[kbd:][<localleader> p]]), to provide live github-style
|
||||||
previews of your markdown (or org) files.
|
previews of your markdown (or org) files.
|
||||||
|
- +tree-sitter ::
|
||||||
|
Enable tree-sitter support for Markdown files. Note that tree-sitter support
|
||||||
|
on Emacs 31 is superior to 30 and under. Requires the [[doom-module::tools
|
||||||
|
tree-sitter]] module.
|
||||||
|
|
||||||
** Packages
|
** Packages
|
||||||
- [[doom-package:edit-indirect]]
|
- [[doom-package:edit-indirect]]
|
||||||
- [[doom-package:evil-markdown]] if [[doom-module::editor evil +everywhere]]
|
- [[doom-package:evil-markdown]] if [[doom-module::editor evil +everywhere]]
|
||||||
- [[doom-package:grip-mode]] if [[doom-module:+grip]]
|
- [[doom-package:grip-mode]] if [[doom-module:+grip]]
|
||||||
|
- [[doom-package:markdown-ts-mode]] if [[doom-module:+tree-sitter]]
|
||||||
- [[doom-package:markdown-mode]]
|
- [[doom-package:markdown-mode]]
|
||||||
- [[doom-package:markdown-toc]]
|
- [[doom-package:markdown-toc]]
|
||||||
|
|
||||||
|
@ -126,6 +126,23 @@ capture, the end position, and the output buffer.")
|
|||||||
:desc "GFM checkbox" "x" #'markdown-toggle-gfm-checkbox)))
|
:desc "GFM checkbox" "x" #'markdown-toggle-gfm-checkbox)))
|
||||||
|
|
||||||
|
|
||||||
|
(use-package! markdown-ts-mode
|
||||||
|
:when (modulep! +tree-sitter)
|
||||||
|
:when (fboundp 'markdown-ts-mode)
|
||||||
|
:defer t
|
||||||
|
:init
|
||||||
|
(set-tree-sitter! 'markdown-mode 'markdown-ts-mode
|
||||||
|
'((markdown :url "https://github.com/tree-sitter-grammars/tree-sitter-markdown"
|
||||||
|
:rev "v0.4.1"
|
||||||
|
:source-dir "tree-sitter-markdown-inline/src")
|
||||||
|
(markdown-inline :url "https://github.com/tree-sitter-grammars/tree-sitter-markdown"
|
||||||
|
:rev "v0.4.1"
|
||||||
|
:source-dir "tree-sitter-markdown-inline/src")))
|
||||||
|
|
||||||
|
:config
|
||||||
|
(cl-callf2 delete '("\\.md\\'" . markdown-ts-mode) auto-mode-alist))
|
||||||
|
|
||||||
|
|
||||||
(use-package! evil-markdown
|
(use-package! evil-markdown
|
||||||
:when (modulep! :editor evil +everywhere)
|
:when (modulep! :editor evil +everywhere)
|
||||||
:hook (markdown-mode . evil-markdown-mode)
|
:hook (markdown-mode . evil-markdown-mode)
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
;; -*- lexical-binding: t; no-byte-compile: t; -*-
|
;; -*- lexical-binding: t; no-byte-compile: t; -*-
|
||||||
;;; lang/markdown/doctor.el
|
;;; lang/markdown/doctor.el
|
||||||
|
|
||||||
|
(assert! (or (not (modulep! +tree-sitter))
|
||||||
|
(modulep! :tools tree-sitter))
|
||||||
|
"This module requires (:tools tree-sitter)")
|
||||||
|
|
||||||
(when (require 'markdown-mode nil t)
|
(when (require 'markdown-mode nil t)
|
||||||
(cond ((eq markdown-command #'+markdown-compile)
|
(cond ((eq markdown-command #'+markdown-compile)
|
||||||
(unless (cl-loop for (exe . cmd) in (list (cons "marked" '+markdown-compile-marked)
|
(unless (cl-loop for (exe . cmd) in (list (cons "marked" '+markdown-compile-marked)
|
||||||
|
@ -8,6 +8,11 @@
|
|||||||
;; present when you call `markdown-edit-code-block'.
|
;; present when you call `markdown-edit-code-block'.
|
||||||
(package! edit-indirect :pin "82a28d8a85277cfe453af464603ea330eae41c05")
|
(package! edit-indirect :pin "82a28d8a85277cfe453af464603ea330eae41c05")
|
||||||
|
|
||||||
|
(when (modulep! +tree-sitter)
|
||||||
|
(package! markdown-ts-mode
|
||||||
|
:built-in 'prefer ; Emacs 31+ has a superior markdown-ts-mode
|
||||||
|
:pin "2f1ee8b94cdf53cebc31ae08ecfbba846193d5e1"))
|
||||||
|
|
||||||
(when (modulep! +grip)
|
(when (modulep! +grip)
|
||||||
(package! grip-mode :pin "96a927dce69d7607b981d7754cf8b415ebf9d6a8"))
|
(package! grip-mode :pin "96a927dce69d7607b981d7754cf8b415ebf9d6a8"))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user