summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/markdown-config.el7
-rw-r--r--tests/test-markdown-config.el27
2 files changed, 34 insertions, 0 deletions
diff --git a/modules/markdown-config.el b/modules/markdown-config.el
index 438aea7e..2536904a 100644
--- a/modules/markdown-config.el
+++ b/modules/markdown-config.el
@@ -15,6 +15,13 @@
("<f2>" . markdown-preview)) ;; use same key as compile for consistency
:init (setq markdown-command "multimarkdown"))
+;; Register markdown as a known org-src-block language so `org-lint'
+;; stops warning on `#+begin_src markdown ... #+end_src' and `C-c ''
+;; inside such a block opens it in `markdown-mode' instead of falling
+;; back to fundamental-mode.
+(with-eval-after-load 'org
+ (add-to-list 'org-src-lang-modes '("markdown" . markdown)))
+
;;;; ------------------------- Impatient-Mode ------------------------
;; allows for live previews of your html
diff --git a/tests/test-markdown-config.el b/tests/test-markdown-config.el
new file mode 100644
index 00000000..62d199a8
--- /dev/null
+++ b/tests/test-markdown-config.el
@@ -0,0 +1,27 @@
+;;; test-markdown-config.el --- Tests for markdown-config -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;; Covers the org-side wiring in markdown-config.el. The use-package
+;; block for markdown-mode itself is upstream config; the assertion
+;; here is on the local glue that points org at markdown-mode for
+;; `#+begin_src markdown' blocks.
+
+;;; Code:
+
+(require 'ert)
+
+(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory))
+
+;; Require org BEFORE markdown-config so the `with-eval-after-load
+;; 'org' body fires synchronously instead of being deferred.
+(require 'org)
+(require 'markdown-config)
+
+(ert-deftest test-markdown-config-registers-markdown-org-src-lang ()
+ "Normal: `markdown' shows up in `org-src-lang-modes' mapped to
+`markdown' so org-lint stops warning on `#+begin_src markdown' and
+`C-c '' opens those blocks in `markdown-mode'."
+ (should (equal (cdr (assoc "markdown" org-src-lang-modes)) 'markdown)))
+
+(provide 'test-markdown-config)
+;;; test-markdown-config.el ends here