From 102b0fb19c3e74b5027784745b8538c9ceaa88d8 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Wed, 22 Oct 2025 13:33:18 -0400 Subject: [PATCH] feat: add Markdown polymode --- config.org | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/config.org b/config.org index 8f8000c..e1ed941 100644 --- a/config.org +++ b/config.org @@ -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")