tweak(markdown): fontify code blocks natively

Enable `markdown-fontify-code-blocks-natively`, which was disabled in
f5570db due to performance issues, which I try to fix by suppressing
mode hooks on `markdown-fontify-code-block-natively`.

Amend: f5570db4c2
Close: #7930
Co-authored-by: real-or-random <real-or-random@users.noreply.github.com>
This commit is contained in:
Henrik Lissner 2024-07-10 01:43:47 -04:00
parent 68771150ba
commit df5f6696ec
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -23,6 +23,7 @@ capture, the end position, and the output buffer.")
markdown-gfm-additional-languages '("sh") markdown-gfm-additional-languages '("sh")
markdown-make-gfm-checkboxes-buttons t markdown-make-gfm-checkboxes-buttons t
markdown-fontify-whole-heading-line t markdown-fontify-whole-heading-line t
markdown-fontify-code-blocks-natively t
;; `+markdown-compile' offers support for many transpilers (see ;; `+markdown-compile' offers support for many transpilers (see
;; `+markdown-compile-functions'), which it tries until one succeeds. ;; `+markdown-compile-functions'), which it tries until one succeeds.
@ -73,6 +74,13 @@ capture, the end position, and the output buffer.")
:override #'markdown-match-generic-metadata :override #'markdown-match-generic-metadata
(ignore (goto-char (point-max)))) (ignore (goto-char (point-max))))
;; HACK: markdown-mode calls a major mode without inhibiting its hooks, which
;; could contain expensive functionality. I suppress it to speed up their
;; fontification.
(defadvice! +markdown-optimize-src-buffer-modes-a (fn &rest args)
:around #'markdown-fontify-code-block-natively
(delay-mode-hooks (apply fn args)))
(map! :map markdown-mode-map (map! :map markdown-mode-map
:localleader :localleader
"'" #'markdown-edit-code-block "'" #'markdown-edit-code-block