笔记内容
插件 Markdown Mode for Emacs 用于在 Emacs 中编写 Markdonn 文档并预览,以及进行其他 Markdown 操作。
该笔记将整理:与该插件有关的内容。
插件信息
Version: 20201015.1327
GitHub: https://github.com/jrblevin/markdown-mode
安装插件
安装,参考 Markdown Mode for Emacs(markdown-mode/README.md) 或 Guide to Markdown Mode for Emacs 文档
注意事项
1)在安装该插件后,即可编写 Markdown 文档。
2)但是预览需要安装额外的 Markdown 命令(Linux Command),并设置 markdown-command 变量
常用配置
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; Markdown ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; 配合 Imenu 显示 Markdown 导航菜单,以进行快速切换章节 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; https://jblevins.org/log/markdown-imenu ;;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Imenu.html ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;; 动态预览设置 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; https://unix.stackexchange.com/questions/4140/markdown-viewer (setq markdown-command "pandoc") ;; 使用 pandoc 进行 markdown 导出,该命令支持更多 markdown 特性 (setq markdown-split-window-direction 'right) ;; 动态预览窗口在右侧打开 ;; 设置预览使用的浏览器 ; 在原有默认配置中,使用 eww 浏览器 ; (setq markdown-live-preview-window-function 'markdown-live-preview-window-eww) ; 我们将其调整,使用 eaf 浏览器 ; @limitation:1)预览的 Buffer 名称是变化的;2)页面会上下滚动 (defun markdown-live-preview-window-eafbrowser (file) "Preview FILE with eaf. To be used with `markdown-live-preview-window-function'." (if (get-buffer "*eaf*") (kill-buffer "*eaf*")) (eaf-open-browser file) (get-buffer "*eaf*")) (setq markdown-live-preview-window-function 'markdown-live-preview-window-eafbrowser)
快捷按键:
1)C-c C-c l => 导出 Markdown 为 HTML,并在 eww 中预览
参考文献
WikiNotes/Markdown Mode for Emacs(编写 Markdown 文档)
markdown-mode/README.md at master · jrblevin/markdown-mode
Markdown Mode for Emacs(markdown-mode/README.md)
Read Guide to Markdown Mode for Emacs | Leanpub
开启markdown预览模式 - 暗无天日