Skip to content

Latest commit

 

History

History
204 lines (166 loc) · 8.53 KB

README.org

File metadata and controls

204 lines (166 loc) · 8.53 KB

Markdown layer

img/markdown.png

Table of Contents

Description

This layer adds markdown support to Spacemacs.

Features:

  • markdown files support via markdown-mode
  • Fast Github-flavored live preview via vmd-mode
  • TOC generation via markdown-toc
  • Completion of Emojis using company-emoji (still needs a way of showing, either using the emoji layer or having a proper font) 👏

BibTeX

For more extensive support of references with BibTeX files, have a look at the BibTeX layer.

Install

To use this configuration layer, add it to your ~/.spacemacs. You will need to add markdown to the existing dotspacemacs-configuration-layers list in this file.

Configuration

Live preview

By default the built-in Emacs web browser is used to live preview a markdown buffer.

To use vmd (Github-flavored live preview) instead set the value of the variable markdown-live-preview-engine to vmd:

dotspacemacs-configuration-layers '(
  (markdown :variables markdown-live-preview-engine 'vmd))

And install the executable with:

npm install -g vmd

Additionally there is flymd package in chrome layer that allows to preview markdown buffer in Chrome. Please refer to chrome layer documentation for more information.

Automatic MMM-Mode Generation

To generate MMM-Modes for languages set the value of the variable markdown-mmm-auto-modes to a list of the languages. For languages where the mode name directly relates to the language name, use a string. Otherwise, use a list of `(“language” “mode”)`:

dotspacemacs-configuration-layers '(
  (markdown :variables markdown-mmm-auto-modes '("c" "c++" "python" "scala" ("elisp" "emacs-lisp"))

Note: Spacemacs already defines the variable markdown-mmm-auto-modes to a bunch of languages. Consider opening a PR on the Spacemacs repository to add new languages instead of overriding the variable in your dotfile.

Usage

Generate a TOC

To generate a table of contents type on top of the buffer: SPC SPC markdown-toc-generate-toc RET

Key bindings

Element insertion

Key bindingDescription
SPC m -insert horizontal line
SPC m h iinsert header dwim
SPC m h Iinsert header setext dwim
SPC m h 1insert header atx 1
SPC m h 2insert header atx 2
SPC m h 3insert header atx 3
SPC m h 4insert header atx 4
SPC m h 5insert header atx 5
SPC m h 6insert header atx 6
SPC m h !insert header setext 1
SPC m h @insert header setext 2
SPC m i linsert link
SPC m i uinsert uri
SPC m i finsert footnote
SPC m i winsert wiki link
SPC m i iinsert image
SPC m i tinsert Table of Contents (toc)
SPC m x bmake region bold or insert bold
SPC m x imake region italic or insert italic
SPC m x cmake region code or insert code
SPC m x Cmake region code or insert code (Github Flavored Markdown format)
SPC m x qmake region blockquote or insert blockquote
SPC m x Qblockquote region
SPC m x pmake region or insert pre
SPC m x Ppre region

Element removal

Key bindingDescription
SPC m kkill thing at point

Completion

Key bindingDescription
SPC m ]complete

Following and Jumping

Key bindingDescription
SPC m ofollow thing at point
RETjump (markdown-do)

Indentation

Key bindingDescription
SPC m \>indent region
SPC m \<outdent region

Header navigation

Key bindingDescription
gjoutline forward same level
gkoutline backward same level
ghoutline up one level
gloutline next visible heading

Buffer-wide commands

Key bindingDescription
SPC m c ]complete buffer
SPC m c mother window
SPC m c ppreview
SPC m c Plive preview using engine defined with layer variable markdown-live-preview-engine
SPC m c eexport
SPC m c vexport and preview
SPC m c oopen
SPC m c wkill ring save
SPC m c ccheck refs
SPC m c ncleanup list numbers
SPC m c rrender buffer

List editing

Key bindingDescription
SPC m l iinsert list item

Movement

Key bindingDescription
SPC m {backward paragraph
SPC m }forward paragraph
SPC m Nnext link
SPC m Pprevious link

Promotion, Demotion

Key bindingCommand
M-k or M-upmarkdown-move-up
M-j or M-downmarkdown-move-down
M-h or M-leftmarkdown-promote
M-l or M-rightmarkdown-demote

Toggles

Key bindingDescription
SPC m t itoggle inline images
SPC m t ltoggle hidden urls
SPC m t mtoggle markup hiding
SPC m t ttoggle checkbox
SPC m t wtoggle wiki links