feat: add Markdown polymode

This commit is contained in:
Kiana Sheibani 2025-10-22 13:33:18 -04:00
parent 17a9aed526
commit 102b0fb19c
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -4260,6 +4260,41 @@ Some more convenient leader key bindings would be nice to prevent having to traw
"c L" #'lsp-avy-lens)
#+end_src
** Markdown
#+call: confpkg("Mode: Markdown")
*** Polymode
Markdown allows for inserting code from other languages into itself. To make this integration more seamless, we can use the =poly-markdown= package to add syntax highlighting and major mode features of the corresponding language to the buffer.
#+begin_src emacs-lisp :tangle packages.el
(package! poly-markdown)
#+end_src
#+begin_src emacs-lisp
(add-hook! markdown-mode #'poly-markdown-mode)
#+end_src
**** Agda Polymode
The Agda integration with Markdown specifically requires some changes to the polymode, as its syntax highlighting scheme is different from the usual =font-lock= system that it expects.
#+begin_src emacs-lisp
(after! poly-markdown
(object-add-to-list
poly-markdown-fenced-code-innermode :init-functions
(defun ~/polymode-agda2-init-function (_)
(when (eq major-mode 'agda2-mode)
(font-lock-mode 0)
(setq indent-line-function #'indent-relative)))))
(after! agda2-mode
;; This highlighting interferes with Markdown's styling
(setq agda2-highlight-faces
(assq-delete-all 'background agda2-highlight-faces)))
#+end_src
** Slint
#+call: confpkg("Mode: Slint")