2017-06-08 11:47:56 +02:00
|
|
|
;;; lang/markdown/config.el -*- lexical-binding: t; -*-
|
2015-06-15 09:06:10 +02:00
|
|
|
|
2017-02-23 00:06:12 -05:00
|
|
|
(def-package! markdown-mode
|
2018-05-25 00:46:11 +02:00
|
|
|
:mode ("/README\\(?:\\.\\(?:markdown\\|md\\)\\)?\\'" . gfm-mode)
|
2016-05-20 09:24:05 -04:00
|
|
|
:init
|
2018-06-22 13:47:28 +02:00
|
|
|
(when (featurep! +pandoc)
|
|
|
|
(setq markdown-command "pandoc --from=markdown --to=html --standalone --mathjax --highlight-style=pygments"))
|
|
|
|
|
2016-05-20 09:24:05 -04:00
|
|
|
(setq markdown-enable-wiki-links t
|
2016-08-27 19:26:34 +02:00
|
|
|
markdown-italic-underscore t
|
2017-06-20 16:31:52 +02:00
|
|
|
markdown-asymmetric-header t
|
2016-05-20 09:24:05 -04:00
|
|
|
markdown-make-gfm-checkboxes-buttons t
|
2017-06-16 02:07:02 +02:00
|
|
|
markdown-gfm-additional-languages '("sh")
|
|
|
|
markdown-fontify-code-blocks-natively t
|
|
|
|
markdown-hide-urls nil) ; trigger with `markdown-toggle-url-hiding'
|
2016-05-21 23:12:50 -04:00
|
|
|
|
2015-06-15 09:06:10 +02:00
|
|
|
:config
|
2018-05-18 01:21:09 +02:00
|
|
|
(defun +markdown|set-fill-column-and-line-spacing ()
|
|
|
|
(setq-local line-spacing 2)
|
|
|
|
(setq-local fill-column 80))
|
|
|
|
(add-hook 'markdown-mode-hook #'+markdown|set-fill-column-and-line-spacing)
|
2018-05-07 22:37:19 +02:00
|
|
|
(add-hook 'markdown-mode-hook #'auto-fill-mode)
|
2016-10-06 13:55:40 +02:00
|
|
|
|
2018-06-03 15:46:00 +02:00
|
|
|
(define-key! markdown-mode-map
|
|
|
|
[remap find-file-at-point] #'markdown-follow-thing-at-point
|
|
|
|
(kbd "M-*") #'markdown-insert-list-item
|
|
|
|
(kbd "M-b") #'markdown-insert-bold
|
|
|
|
(kbd "M-i") #'markdown-insert-italic
|
|
|
|
(kbd "M-`") #'+markdown/insert-del)
|
|
|
|
(when (featurep! :feature evil +everywhere)
|
|
|
|
(evil-define-key* 'motion markdown-mode-map
|
|
|
|
"gj" #'markdown-next-visible-heading
|
|
|
|
"gk" #'markdown-previous-visible-heading
|
|
|
|
;; TODO: Make context sensitive
|
|
|
|
"]h" #'markdown-next-visible-heading
|
|
|
|
"[h" #'markdown-previous-visible-heading
|
|
|
|
"[p" #'markdown-promote
|
|
|
|
"]p" #'markdown-demote
|
|
|
|
"[l" #'markdown-next-link
|
|
|
|
"]l" #'markdown-previous-link)
|
|
|
|
(evil-define-key* 'insert markdown-mode-map
|
|
|
|
(kbd "M--") #'markdown-insert-hr)
|
|
|
|
(evil-define-key* 'normal markdown-mode-map
|
|
|
|
(kbd "M-r") #'browse-url-of-file))
|
|
|
|
(map! :map markdown-mode-map
|
|
|
|
:localleader
|
|
|
|
:nv "o" #'markdown-open
|
|
|
|
:nv "b" #'markdown-preview
|
|
|
|
(:prefix "i"
|
|
|
|
:nv "t" #'markdown-toc-generate-toc
|
|
|
|
:nv "i" #'markdown-insert-image
|
|
|
|
:nv "l" #'markdown-insert-link)))
|
2018-06-22 13:47:28 +02:00
|
|
|
|
|
|
|
(def-package! pandoc-mode
|
|
|
|
:when (featurep! +pandoc)
|
|
|
|
:commands
|
|
|
|
pandoc-mode
|
|
|
|
:hook
|
|
|
|
(markdown-mode . conditionally-turn-on-pandoc))
|