2015-12-02 14:23:39 +00:00
|
|
|
#+TITLE: Markdown layer
|
2015-06-10 16:44:30 +00:00
|
|
|
|
2019-05-07 08:21:07 +00:00
|
|
|
#+TAGS: dsl|layer|markup|programming
|
2019-05-05 17:26:40 +00:00
|
|
|
|
2015-06-10 16:44:30 +00:00
|
|
|
[[file:img/markdown.png]]
|
|
|
|
|
2019-05-07 20:05:06 +00:00
|
|
|
* Table of Contents :TOC_5_gh:noexport:
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#description][Description]]
|
2017-08-06 02:14:10 +00:00
|
|
|
- [[#features][Features:]]
|
2019-04-21 20:04:25 +00:00
|
|
|
- [[#bibtex][BibTeX]]
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#install][Install]]
|
|
|
|
- [[#configuration][Configuration]]
|
|
|
|
- [[#live-preview][Live preview]]
|
|
|
|
- [[#automatic-mmm-mode-generation][Automatic MMM-Mode Generation]]
|
|
|
|
- [[#usage][Usage]]
|
|
|
|
- [[#generate-a-toc][Generate a TOC]]
|
2018-11-07 07:56:16 +00:00
|
|
|
- [[#editing-tables][Editing tables]]
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#key-bindings][Key bindings]]
|
|
|
|
- [[#element-insertion][Element insertion]]
|
|
|
|
- [[#element-removal][Element removal]]
|
2018-03-09 15:18:49 +00:00
|
|
|
- [[#table-manipulation][Table manipulation]]
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#completion][Completion]]
|
|
|
|
- [[#following-and-jumping][Following and Jumping]]
|
|
|
|
- [[#indentation][Indentation]]
|
|
|
|
- [[#header-navigation][Header navigation]]
|
|
|
|
- [[#buffer-wide-commands][Buffer-wide commands]]
|
|
|
|
- [[#list-editing][List editing]]
|
|
|
|
- [[#movement][Movement]]
|
|
|
|
- [[#promotion-demotion][Promotion, Demotion]]
|
2017-06-09 15:21:48 +00:00
|
|
|
- [[#toggles][Toggles]]
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
* Description
|
|
|
|
This layer adds markdown support to Spacemacs.
|
|
|
|
|
2017-08-06 02:14:10 +00:00
|
|
|
** Features:
|
2015-06-10 16:44:30 +00:00
|
|
|
- markdown files support via [[http://jblevins.org/git/markdown-mode.git/][markdown-mode]]
|
2016-06-01 05:53:06 +00:00
|
|
|
- Fast Github-flavored live preview via [[https://github.com/blak3mill3r/vmd-mode][vmd-mode]]
|
2015-06-10 16:44:30 +00:00
|
|
|
- TOC generation via [[https://github.com/ardumont/markdown-toc][markdown-toc]]
|
2015-08-18 22:27:49 +00:00
|
|
|
- Completion of Emojis using [[https://github.com/dunn/company-emoji][company-emoji]] (still needs a way of showing, either
|
|
|
|
using the =emoji= layer or having a proper font) :clap:
|
2015-06-10 16:44:30 +00:00
|
|
|
|
2019-04-21 19:00:24 +00:00
|
|
|
* BibTeX
|
2016-04-17 02:32:11 +00:00
|
|
|
For more extensive support of references with BibTeX files, have a look at the
|
2017-08-18 19:07:43 +00:00
|
|
|
[[https://github.com/syl20bnr/spacemacs/blob/develop/layers/%2Blang/bibtex/README.org][BibTeX layer]].
|
2016-04-17 02:32:11 +00:00
|
|
|
|
2015-06-10 16:44:30 +00:00
|
|
|
* Install
|
2016-01-06 05:21:55 +00:00
|
|
|
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.
|
2015-06-10 16:44:30 +00:00
|
|
|
|
2016-06-07 03:39:41 +00:00
|
|
|
* 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=:
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
dotspacemacs-configuration-layers '(
|
|
|
|
(markdown :variables markdown-live-preview-engine 'vmd))
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
And install the executable with:
|
|
|
|
|
|
|
|
#+BEGIN_SRC shell
|
2018-09-19 03:54:47 +00:00
|
|
|
npm install -g vmd
|
2016-06-07 03:39:41 +00:00
|
|
|
#+END_SRC
|
2016-06-01 05:53:06 +00:00
|
|
|
|
2017-02-01 14:00:43 +00:00
|
|
|
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.
|
|
|
|
|
2016-07-15 08:28:33 +00:00
|
|
|
** Automatic MMM-Mode Generation
|
2016-07-15 11:58:59 +00:00
|
|
|
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
|
2019-05-26 20:58:52 +00:00
|
|
|
list of `("language" "mode")`:
|
2016-07-15 08:28:33 +00:00
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
dotspacemacs-configuration-layers '(
|
2016-07-15 11:58:59 +00:00
|
|
|
(markdown :variables markdown-mmm-auto-modes '("c" "c++" "python" "scala" ("elisp" "emacs-lisp"))
|
2016-07-15 08:28:33 +00:00
|
|
|
#+END_SRC
|
|
|
|
|
2017-04-29 15:08:03 +00:00
|
|
|
*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.
|
|
|
|
|
2015-06-10 16:44:30 +00:00
|
|
|
* Usage
|
2016-06-07 03:39:41 +00:00
|
|
|
** Generate a TOC
|
2015-06-10 16:44:30 +00:00
|
|
|
To generate a table of contents type on top of the buffer:
|
2016-08-22 12:51:33 +00:00
|
|
|
~SPC SPC markdown-toc-generate-toc RET~
|
2015-06-10 16:44:30 +00:00
|
|
|
|
2018-11-07 07:56:16 +00:00
|
|
|
** Editing tables
|
|
|
|
While =markdown-mode= provides functionality to edit tables, users of =org=
|
|
|
|
layer benefit from more sophisticated =orgtbl-mode=.
|
|
|
|
|
|
|
|
In order to use =orgtabl-mode=, add =org= layer to your =~/.spacemacs=.
|
|
|
|
|
2015-06-10 16:44:30 +00:00
|
|
|
* Key bindings
|
|
|
|
** Element insertion
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2015-10-21 21:12:30 +00:00
|
|
|
|-------------+-------------------------------------------------------------------|
|
|
|
|
| ~SPC m -~ | insert horizontal line |
|
|
|
|
| ~SPC m h i~ | insert header dwim |
|
|
|
|
| ~SPC m h I~ | insert header setext dwim |
|
|
|
|
| ~SPC m h 1~ | insert header atx 1 |
|
|
|
|
| ~SPC m h 2~ | insert header atx 2 |
|
|
|
|
| ~SPC m h 3~ | insert header atx 3 |
|
|
|
|
| ~SPC m h 4~ | insert header atx 4 |
|
|
|
|
| ~SPC m h 5~ | insert header atx 5 |
|
|
|
|
| ~SPC m h 6~ | insert header atx 6 |
|
|
|
|
| ~SPC m h !~ | insert header setext 1 |
|
|
|
|
| ~SPC m h @~ | insert header setext 2 |
|
2018-07-24 07:23:44 +00:00
|
|
|
| ~SPC m i l~ | insert link |
|
2015-10-21 21:12:30 +00:00
|
|
|
| ~SPC m i u~ | insert uri |
|
|
|
|
| ~SPC m i f~ | insert footnote |
|
|
|
|
| ~SPC m i w~ | insert wiki link |
|
|
|
|
| ~SPC m i i~ | insert image |
|
2017-02-09 21:48:56 +00:00
|
|
|
| ~SPC m i t~ | insert Table of Contents (toc) |
|
2015-10-21 21:12:30 +00:00
|
|
|
| ~SPC m x b~ | make region bold or insert bold |
|
2018-03-09 15:18:49 +00:00
|
|
|
| ~SPC m x B~ | insert gfm checkbox |
|
2015-10-21 21:12:30 +00:00
|
|
|
| ~SPC m x i~ | make region italic or insert italic |
|
|
|
|
| ~SPC m x c~ | make region code or insert code |
|
|
|
|
| ~SPC m x C~ | make region code or insert code (Github Flavored Markdown format) |
|
|
|
|
| ~SPC m x q~ | make region blockquote or insert blockquote |
|
|
|
|
| ~SPC m x Q~ | blockquote region |
|
|
|
|
| ~SPC m x p~ | make region or insert pre |
|
|
|
|
| ~SPC m x P~ | pre region |
|
2018-03-09 15:18:49 +00:00
|
|
|
| ~SPC m x s~ | make region striked through or insert strikethrough |
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
** Element removal
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2015-06-10 16:44:30 +00:00
|
|
|
|-------------+---------------------|
|
|
|
|
| ~SPC m k~ | kill thing at point |
|
|
|
|
|
2018-03-09 15:18:49 +00:00
|
|
|
** Table manipulation
|
|
|
|
|
|
|
|
| Key Binding | Description |
|
|
|
|
|-------------+-------------------------|
|
|
|
|
| ~SPC m t p~ | move row up |
|
|
|
|
| ~SPC m t n~ | move row down |
|
|
|
|
| ~SPC m t f~ | move column right |
|
|
|
|
| ~SPC m t b~ | move column left |
|
|
|
|
| ~SPC m t r~ | insert row |
|
|
|
|
| ~SPC m t R~ | delete row |
|
|
|
|
| ~SPC m t c~ | insert column |
|
|
|
|
| ~SPC m t C~ | delete column |
|
|
|
|
| ~SPC m t s~ | sort lines |
|
|
|
|
| ~SPC m t t~ | transpose table |
|
|
|
|
| ~SPC m t d~ | convert region to table |
|
|
|
|
|
2016-03-12 08:50:35 +00:00
|
|
|
** Completion
|
2015-06-10 16:44:30 +00:00
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2015-06-10 16:44:30 +00:00
|
|
|
|-------------+-------------|
|
|
|
|
| ~SPC m ]~ | complete |
|
|
|
|
|
|
|
|
** Following and Jumping
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2015-06-10 16:44:30 +00:00
|
|
|
|-------------+-----------------------|
|
|
|
|
| ~SPC m o~ | follow thing at point |
|
2018-07-24 07:23:44 +00:00
|
|
|
| ~RET~ | jump (markdown-do) |
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
** Indentation
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2018-07-24 07:23:44 +00:00
|
|
|
|-------------+----------------|
|
|
|
|
| ~SPC m \>~ | indent region |
|
|
|
|
| ~SPC m \<~ | outdent region |
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
** Header navigation
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2015-06-10 16:44:30 +00:00
|
|
|
|-------------+------------------------------|
|
|
|
|
| ~gj~ | outline forward same level |
|
|
|
|
| ~gk~ | outline backward same level |
|
|
|
|
| ~gh~ | outline up one level |
|
|
|
|
| ~gl~ | outline next visible heading |
|
|
|
|
|
|
|
|
** Buffer-wide commands
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2016-06-07 03:39:41 +00:00
|
|
|
|-------------+--------------------------------------------------------------------------------------|
|
|
|
|
| ~SPC m c ]~ | complete buffer |
|
|
|
|
| ~SPC m c m~ | other window |
|
|
|
|
| ~SPC m c p~ | preview |
|
|
|
|
| ~SPC m c P~ | live preview using engine defined with layer variable =markdown-live-preview-engine= |
|
|
|
|
| ~SPC m c e~ | export |
|
|
|
|
| ~SPC m c v~ | export and preview |
|
|
|
|
| ~SPC m c o~ | open |
|
|
|
|
| ~SPC m c w~ | kill ring save |
|
|
|
|
| ~SPC m c c~ | check refs |
|
|
|
|
| ~SPC m c n~ | cleanup list numbers |
|
|
|
|
| ~SPC m c r~ | render buffer |
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
** List editing
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2015-06-10 16:44:30 +00:00
|
|
|
|-------------+------------------|
|
|
|
|
| ~SPC m l i~ | insert list item |
|
|
|
|
|
|
|
|
** Movement
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2015-06-10 16:44:30 +00:00
|
|
|
|-------------+--------------------|
|
|
|
|
| ~SPC m {~ | backward paragraph |
|
|
|
|
| ~SPC m }~ | forward paragraph |
|
|
|
|
| ~SPC m N~ | next link |
|
|
|
|
| ~SPC m P~ | previous link |
|
|
|
|
|
|
|
|
** Promotion, Demotion
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Command |
|
2018-06-06 05:15:48 +00:00
|
|
|
|--------------------+--------------------|
|
|
|
|
| ~M-k~ or ~M-up~ | markdown-move-up |
|
|
|
|
| ~M-j~ or ~M-down~ | markdown-move-down |
|
|
|
|
| ~M-h~ or ~M-left~ | markdown-promote |
|
|
|
|
| ~M-l~ or ~M-right~ | markdown-demote |
|
2017-06-09 15:21:48 +00:00
|
|
|
|
|
|
|
** Toggles
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2017-06-09 15:21:48 +00:00
|
|
|
|-------------+----------------------|
|
|
|
|
| ~SPC m t i~ | toggle inline images |
|
|
|
|
| ~SPC m t l~ | toggle hidden urls |
|
2018-07-24 07:23:44 +00:00
|
|
|
| ~SPC m t m~ | toggle markup hiding |
|
2017-06-19 20:31:07 +00:00
|
|
|
| ~SPC m t t~ | toggle checkbox |
|
2017-06-09 15:21:48 +00:00
|
|
|
| ~SPC m t w~ | toggle wiki links |
|