mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-23 11:30:23 +10:00
Updating Doom Emacs.
This commit is contained in:
@@ -119,15 +119,14 @@ installed through your OS's package manager:
|
||||
|
||||
* Features
|
||||
** Markdown preview
|
||||
~markdown-preview~ is bound to =SPC m p= (for Evil users) and =C-c l p= (for
|
||||
non-evil users). This will open a preview of your compiled markdown document in
|
||||
your browser.
|
||||
~markdown-preview~ is bound to =<localleader> p=. This will open a preview of
|
||||
your compiled markdown document in your browser.
|
||||
|
||||
Alternatively, you can use ~grip-mode~ through =+grip=.
|
||||
|
||||
* Configuration
|
||||
** Changing how markdown is compiled
|
||||
When ~markdown-preview~ is invoked (=SPC m b= or =C-c l b=), it consults
|
||||
When ~markdown-preview~ is invoked (=<localleader> p=) it consults
|
||||
~markdown-command~. Its default value (~#'+markdown-compile~) will consult
|
||||
~+markdown-compile-functions~: a list of functions that take three arguments: the
|
||||
start and end point in the current buffer to use as input, and an output buffer
|
||||
@@ -138,7 +137,8 @@ By default, the value of ~+markdown-compile-functions~ is:
|
||||
#+BEGIN_SRC lisp
|
||||
'(+markdown-compile-marked
|
||||
+markdown-compile-pandoc
|
||||
+markdown-compile-markdown)
|
||||
+markdown-compile-markdown
|
||||
+markdown-compile-multimarkdown)
|
||||
#+END_SRC
|
||||
|
||||
These functions will attempt to use the marked, pandoc and markdown executables,
|
||||
|
||||
@@ -32,7 +32,7 @@ Runs `+markdown-compile-functions' until the first function to return non-nil,
|
||||
otherwise throws an error."
|
||||
(or (run-hook-with-args-until-success '+markdown-compile-functions
|
||||
beg end output-buffer)
|
||||
(user-error "No markdown program could be found. Install marked, pandoc or markdown.")))
|
||||
(user-error "No markdown program could be found. Install marked, pandoc, markdown or multimarkdown.")))
|
||||
|
||||
;;;###autoload
|
||||
(defun +markdown-compile-marked (beg end output-buffer)
|
||||
|
||||
@@ -27,11 +27,17 @@ capture, the end position, and the output buffer.")
|
||||
markdown-gfm-additional-languages '("sh")
|
||||
markdown-make-gfm-checkboxes-buttons t
|
||||
|
||||
;; Preview/compilation defaults
|
||||
;; `+markdown-compile' offers support for many transpilers (see
|
||||
;; `+markdown-compile-functions'), which it tries until one succeeds.
|
||||
markdown-command #'+markdown-compile
|
||||
;; This is set to `nil' by default, which causes a wrong-type-arg error
|
||||
;; when you use `markdown-open'. These are more sensible defaults.
|
||||
markdown-open-command
|
||||
(cond (IS-MAC "open")
|
||||
(IS-LINUX "xdg-open"))
|
||||
|
||||
;; A sensible and simple default preamble for markdown exports that
|
||||
;; takes after the github asthetic (plus highlightjs syntax coloring).
|
||||
markdown-content-type "application/xhtml+xml"
|
||||
markdown-css-paths
|
||||
'("https://cdn.jsdelivr.net/npm/github-markdown-css/github-markdown.min.css"
|
||||
@@ -40,13 +46,27 @@ capture, the end position, and the output buffer.")
|
||||
(concat "<meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=no'>"
|
||||
"<style> body { box-sizing: border-box; max-width: 740px; width: 100%; margin: 40px auto; padding: 0 10px; } </style>"
|
||||
"<script src='https://cdn.jsdelivr.net/gh/highlightjs/cdn-release/build/highlight.min.js'></script>"
|
||||
"<script>document.addEventListener('DOMContentLoaded', () => { document.body.classList.add('markdown-body'); document.querySelectorAll('pre[lang] > code').forEach((code) => { code.classList.add(code.parentElement.lang); hljs.highlightBlock(code); }); }); </script>"))
|
||||
"<script>document.addEventListener('DOMContentLoaded', () => { document.body.classList.add('markdown-body'); document.querySelectorAll('pre[lang] > code').forEach((code) => { code.classList.add(code.parentElement.lang); }); document.querySelectorAll('pre > code').forEach((code) => { hljs.highlightBlock(code); }); });</script>"))
|
||||
|
||||
;; A shorter alias for org src blocks than "markdown"
|
||||
(after! org-src
|
||||
(add-to-list 'org-src-lang-modes '("md" . markdown)))
|
||||
|
||||
:config
|
||||
(set-flyspell-predicate! '(markdown-mode gfm-mode)
|
||||
#'+markdown-flyspell-word-p)
|
||||
(set-lookup-handlers! '(markdown-mode gfm-mode)
|
||||
:file #'markdown-follow-thing-at-point)
|
||||
;; `markdown-follow-thing-at-point' may open an external program or a
|
||||
;; buffer. No good way to tell, so pretend it's async.
|
||||
:file '(markdown-follow-thing-at-point :async t))
|
||||
|
||||
(sp-local-pair '(markdown-mode gfm-mode) "`" "`"
|
||||
:unless '(:add sp-point-before-word-p sp-point-before-same-p))
|
||||
|
||||
;; Don't trigger autofill in code blocks (see `auto-fill-mode')
|
||||
(setq-hook! 'markdown-mode-hook
|
||||
fill-nobreak-predicate (cons #'markdown-code-block-at-point-p
|
||||
fill-nobreak-predicate))
|
||||
|
||||
;; HACK Prevent mis-fontification of YAML metadata blocks in `markdown-mode'
|
||||
;; which occurs when the first line contains a colon in it. See
|
||||
@@ -57,6 +77,7 @@ capture, the end position, and the output buffer.")
|
||||
|
||||
(map! :map markdown-mode-map
|
||||
:localleader
|
||||
"'" #'markdown-edit-code-block
|
||||
"o" #'markdown-open
|
||||
"p" #'markdown-preview
|
||||
"e" #'markdown-export
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; lang/markdown/packages.el
|
||||
|
||||
(package! markdown-mode)
|
||||
(package! markdown-toc)
|
||||
(package! edit-indirect)
|
||||
(package! markdown-mode :pin "770e3aa7cdfc9d731119b9425e8a7c8ac6dd5f93")
|
||||
(package! markdown-toc :pin "9565eeaa1d26bc0ab83eb65bd30470888f724044")
|
||||
(package! edit-indirect :pin "935ded353b9ed3da67bc61abf245c21b58d88864")
|
||||
|
||||
(when (featurep! +grip)
|
||||
(package! grip-mode))
|
||||
(package! grip-mode :pin "9615c4774727a719d38313a679d70f2a2c6aca68"))
|
||||
|
||||
(when (featurep! :editor evil +everywhere)
|
||||
(package! evil-markdown
|
||||
:recipe (:host github :repo "Somelauw/evil-markdown")))
|
||||
:recipe (:host github :repo "Somelauw/evil-markdown")
|
||||
:pin "064fe9b4767470472356d20bdd08e2f30ebbc9ac"))
|
||||
|
||||
Reference in New Issue
Block a user