Update 2026-01-25 09:38 OpenBSD/amd64-t14

This commit is contained in:
c0dev0id
2026-01-25 09:38:17 +01:00
parent 0769d7a789
commit 186dfa8096
1240 changed files with 189747 additions and 315946 deletions
@@ -1,58 +0,0 @@
# CONTRIBUTING
These contributing guidelines were accepted rather late in the history of this plugin, after much code had already been written.
If you find any existing behavior which does not conform to these guidelines, please correct it and send a pull request.
## General Rules
Every non local identifier must start with `g:vim_markdown_`.
## Documentation
Every new feature must be documented under in the [README.md](README.md). Documentation must be written in [GFM](https://help.github.com/articles/github-flavored-markdown) since GitHub itself is the primary to HTML converter used. In particular, remember that GFM adds line breaks at single newlines, so just forget about the 70 characters wide rule.
Vim help file [doc/vim-markdown.txt](doc/vim-markdown.txt) will be generated from [README.md](README.md) by `make doc` using [vim-tools](https://github.com/xolox/vim-tools).
## Markdown Flavors
There are many flavors of markdown, each one with an unique feature set. This plugin uses the following strategy to deal with all those flavors:
- Features from the [original markdown](http://daringfireball.net/projects/markdown/syntax) are turned on by default. They may not even have an option that turns them off.
- Features from other markdown flavors *must* have an option that turns them on or off. If the feature is common enough across multiple versions of markdown, it may be turned on by default. This shall be decided by the community when the merge request is done.
- If possible, cite the exact point in the documentation of the flavor where a feature is specified. If the feature is not documented, you may also reference the source code itself of the implementation. This way, people who do not know that flavor can check if your implementation is correct.
- Do not use the name of a flavor for a feature that is used across multiple flavors. Instead, create a separate flavor option, that automatically sets each feature.
For example, fenced code blocks (putting code between pairs of three backticks) is not part of the original markdown, but is supported by [GFM](https://help.github.com/articles/github-flavored-markdown#fenced-code-blocks) and [Jekyll](http://jekyllrb.com/docs/configuration/).
Therefore, instead of creating an option `g:vim_markdown_gfm_fenced_code_block`, and an option `g:vim_markdown_jekyll_fenced_code_block`, create a single option `g:vim_markdown_fenced_code_block`.
Next, if there are many more than one Jekyll feature options, create a `g:vim_markdown_jekyll` option that turns them all on at once.
## Style
When choosing between multiple valid Markdown syntaxes, the default behavior must be that specified at: <https://cirosantilli.com/markdown-style-guide>
If you wish to have a behavior that differs from that style guide, add an option to turn it on or off, and leave it off by default.
## Tests
All new features must have unit tests.
## Issues
Issues are tracked within GitHub.
When reporting issues, your report is more effective if you include a minimal example file that reproduces the problem. Try to trim out as much as possible, until you have the smallest possible file that still reproduces the issue. Paste the example inline into your issue report, quoted using four spaces at the beginning of each line, like this example from issue [#189](https://github.com/preservim/vim-markdown/issues/189):
```
Minimal example:
```
=
```
bad!
```
@@ -0,0 +1,6 @@
source "https://rubygems.org"
gem "rspec"
gem "vimrunner"
gem "nokogiri", "~> 1.8.1"
gem "kramdown"
@@ -0,0 +1,34 @@
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.3)
kramdown (1.16.2)
mini_portile2 (2.3.0)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-core (3.7.1)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-mocks (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.1)
vimrunner (0.3.4)
PLATFORMS
ruby
DEPENDENCIES
kramdown
nokogiri (~> 1.8.1)
rspec
vimrunner
BUNDLED WITH
1.16.1
@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2013 Gabriele Lana <gabriele.lana@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,88 +0,0 @@
VIMDIR=$(DESTDIR)/usr/share/vim
ADDONS=${VIMDIR}/addons
REGISTRY=${VIMDIR}/registry
all:
install:
mkdir -pv ${ADDONS}/ftdetect
cp -v ftdetect/markdown.vim ${ADDONS}/ftdetect/markdown.vim
mkdir -pv ${ADDONS}/ftplugin
cp -v ftplugin/markdown.vim ${ADDONS}/ftplugin/markdown.vim
mkdir -pv ${ADDONS}/syntax
cp -v syntax/markdown.vim ${ADDONS}/syntax/markdown.vim
mkdir -pv ${ADDONS}/after/ftplugin
cp -v after/ftplugin/markdown.vim ${ADDONS}/after/ftplugin/markdown.vim
mkdir -pv ${ADDONS}/indent
cp -v indent/markdown.vim ${ADDONS}/indent/markdown.vim
mkdir -pv ${ADDONS}/doc
cp -v doc/vim-markdown.txt ${ADDONS}/doc/vim-markdown.txt
mkdir -pv ${REGISTRY}
cp -v registry/markdown.yaml ${REGISTRY}/markdown.yaml
test: build/tabular build/vim-toml build/vim-json build/vader.vim
test/run-tests.sh
.PHONY: test
update: build/tabular build/vim-toml build/vim-json build/vader.vim
cd build/tabular && git pull
cd build/vim-toml && git pull
cd build/vim-json && git pull
cd build/vader.vim && git pull
.PHONY: update
build/tabular: | build
git clone https://github.com/godlygeek/tabular build/tabular
build/vim-toml: | build
git clone https://github.com/cespare/vim-toml build/vim-toml
build/vim-json: | build
git clone https://github.com/elzr/vim-json build/vim-json
build/vader.vim: | build
git clone https://github.com/junegunn/vader.vim build/vader.vim
build:
mkdir build
doc: build/html2vimdoc build/vim-tools
sed -e '/^\[!\[Build Status\]/d' \
-e '/^1\. \[/d' README.md > doc/tmp.md # remove table of contents
build/html2vimdoc/bin/python build/vim-tools/html2vimdoc.py -f vim-markdown \
doc/tmp.md | \
sed -E -e "s/[[:space:]]*$$//" -e "# remove trailing spaces" \
-e "/^.{79,}\|$$/ {" -e "# wrap table of contents over 79" \
-e "h" -e "# save the matched line to the hold space" \
-e "s/^(.*) (\|[^|]*\|)$$/\1/" -e "# make content title" \
-e "p" -e "# print title" \
-e "g" -e "# restore the matched line" \
-e "s/^.* (\|[^|]*\|)$$/ \1/" -e "# make link" \
-e ":c" -e "s/^(.{1,78})$$/ \1/" -e "tc" -e "# align right" \
-e "}" \
-e "/^- '[^']*':( |$$)/ {" \
-e "h" -e "# save the matched line to the hold space" \
-e "s/^- '([^']{3,})':.*/ \*\1\*/" -e "# make command reference" \
-e "s/^- '([^']{1,2})':.*/ \*vim-markdown-\1\*/" -e "# short command" \
-e ":a" -e "s/^(.{1,78})$$/ \1/" -e "ta" -e "# align right" \
-e "G" -e "# append the matched line after the command reference" \
-e "}" \
-e "/^- 'g:vim_markdown_[[:alnum:]_]*'$$/ {" \
-e "h" -e "# save the matched line to the hold space" \
-e "s/^- '([^']*)'$$/ \*\1\*/" -e "# make global variable reference" \
-e ":g" -e "s/^(.{1,78})$$/ \1/" -e "tg" -e "# align right" \
-e "G" -e "# append the matched line after the global variable reference" \
-e "}" > doc/vim-markdown.txt && rm -f doc/tmp.md
.PHONY: doc
# Prerequire Python and virtualenv.
# $ sudo pip install virtualenv
# Create the virtual environment.
# Install the dependencies.
build/html2vimdoc: | build
virtualenv build/html2vimdoc
build/html2vimdoc/bin/pip install beautifulsoup coloredlogs==4.0 markdown
build/vim-tools: | build
git clone https://github.com/xolox/vim-tools.git build/vim-tools
+150 -456
View File
@@ -1,482 +1,176 @@
# Vim Markdown
# Markdown for Vim
A complete environment to create Markdown files with a syntax highlight that doesn't suck!
[![Vint](https://github.com/preservim/vim-markdown/workflows/Vint/badge.svg)](https://github.com/preservim/vim-markdown/actions?workflow=Vint)
[![Vader](https://github.com/preservim/vim-markdown/workflows/Vader/badge.svg)](https://github.com/preservim/vim-markdown/actions?workflow=Vader)
## Features
* Strong support for the Markdown flavor implemented by GitHub: what you see in Vim is what you get on GitHub
* Complete syntax implementation: supports proper nesting of all elements in list items. This is the only plugin that is able to do that (and I believe it since it took me a *while* to make it right)
* A simple example rendered with this plugin. Headers and the fenced code block in list items are correctly highlighted
![VimMarkdownRendering](https://github.com/gabrielelana/vim-markdown/raw/master/images/vim_markdown_rendering.png)
* The same example rendered with the most popular Markdown plugins for Vim
![VimMarkdownRenderingComparison1](https://github.com/gabrielelana/vim-markdown/raw/master/images/vim_markdown_rendering_comparison_1.png)
![VimMarkdownRenderingComparison2](https://github.com/gabrielelana/vim-markdown/raw/master/images/vim_markdown_rendering_comparison_2.png)
* Code blocks and pieces of Markdown in the current file can be edited in a separate buffer and synchronized back when you finish
* Inside a Ruby fenced code block, `<Leader>e` opens a temporary buffer with the right file type
* Select a range in visual mode and `<Leader>e` opens a temporary buffer with file type `markdown`. I call it *Focus Mode* because you can edit a portion of a Markdown file in isolation
* Finally, on an empty line, `<Leader>e` asks for a file type and then opens a temporary buffer with that file type
* When you leave the temporary buffer the content syncs back to the main file
![EditCodeBlock](https://github.com/gabrielelana/vim-markdown/raw/master/images/vim_markdown_edit_code_block.gif)
* Folding for: headers, code blocks and html blocks
* Format tables automatically (requires [`Tabular`](https://github.com/godlygeek/tabular) plugin)
* Automatically detects Jekyll files and adds support for the Liquid template engine
* This is a work in progress. More goodies and improvements are coming (see [TODO](#TODO)). Stay tuned.
Syntax highlighting, matching rules and mappings for [the original Markdown](http://daringfireball.net/projects/markdown/) and extensions.
1. [Installation](#installation)
1. [Basic usage](#basic-usage)
1. [Options](#options)
1. [Mappings](#mappings)
1. [Commands](#commands)
1. [Credits](#credits)
1. [License](#license)
## Why?
I wanted strong support for the Markdown flavor implemented by GitHub. I wanted syntax highlighting that would mirror the result I would find later on GitHub. I wanted syntax highlighting that would not break easily. I wanted syntax highlighting that I could rely on (aka rapid feedback). I wanted something more than mere syntax highlighting. The [Markdown Syntax](http://daringfireball.net/projects/markdown/syntax), unfortunately, is so loosely defined that there are *flavors* of Markdown that are subtly incompatible with each other. The [Markdown supported by GitHub](https://help.github.com/articles/github-flavored-markdown) is one of them.
## Installation
If you use [Vundle](https://github.com/gmarik/vundle), add the following line to your `~/.vimrc`:
If you use [Vundle](https://github.com/gmarik/vundle), add the following lines to your `~/.vimrc`:
Bundle 'gabrielelana/vim-markdown'
```vim
Plugin 'godlygeek/tabular'
Plugin 'preservim/vim-markdown'
```
OR
The `tabular` plugin must come *before* `vim-markdown`.
Plugin 'gabrielelana/vim-markdown'
Then run inside Vim:
And then execute the following command in your shell:
```vim
:so ~/.vimrc
:PluginInstall
```
$ vim +'PluginInstall! vim-markdown' +qall
If you use [Pathogen](https://github.com/tpope/vim-pathogen), do this:
You can update to the latest version with the following command in your shell:
```sh
cd ~/.vim/bundle
git clone https://github.com/preservim/vim-markdown.git
```
$ vim +PluginUpdate
To install without Pathogen using the Debian [vim-addon-manager](http://packages.qa.debian.org/v/vim-addon-manager.html), do this:
If you use [vim-plug](https://github.com/junegunn/vim-plug), add the following to your plugin section:
```sh
git clone https://github.com/preservim/vim-markdown.git
cd vim-markdown
sudo make install
vim-addon-manager install markdown
```
Plug 'gabrielelana/vim-markdown'
If you are using a package manager with semver support (like [lazy.nvim](https://github.com/folke/lazy.nvim)) make sure you are following the master branch (see https://github.com/preservim/vim-markdown/issues/616).
And then execute the following command in your shell:
If you are not using any package manager, download the [tarball](https://github.com/preservim/vim-markdown/archive/master.tar.gz) and do this:
$ vim +PlugInstall
```sh
cd ~/.vim
tar --strip=1 -zxf vim-markdown-master.tar.gz
```
If you use [NeoBundle](https://github.com/Shougo/neobundle.vim), add the following line to your `~/.vimrc`:
## Basic usage
NeoBundle 'gabrielelana/vim-markdown'
### Folding
And then execute the following command in your shell:
Folding is enabled for headers by default.
$ vim +NeoBundleInstall +qall
The following commands are useful to open and close folds:
You can update to the latest version with the following command in your shell:
- `zr`: reduces fold level throughout the buffer
- `zR`: opens all folds
- `zm`: increases fold level throughout the buffer
- `zM`: folds everything all the way
- `za`: toggle a fold your cursor is on
- `zA`: toggle a fold your cursor is on recursively
- `zo`: open a fold your cursor is on
- `zO`: open a fold your cursor is on recursively
- `zc`: close a fold your cursor is on
- `zC`: close a fold your cursor is on recursively
$ vim +NeoBundleInstall! +qall
[Options](#options) are available to disable folding or change folding style.
If you use [Pathogen](https://github.com/tpope/vim-pathogen), execute the following in your shell:
Try `:help fold-expr` and `:help fold-commands` for details.
$ cd ~/.vim/bundle
$ git clone https://github.com/gabrielelana/vim-markdown.git
### Concealing
If you are not using a package manager, download the [tarball](https://github.com/gabrielelana/vim-markdown/archive/master.tar.gz) and do this:
Concealing is set for some syntax such as bold, italic, code block and link.
Concealing lets you conceal text with other text. The actual source text is not modified. If you put your cursor on the concealed line, the conceal goes away.
[Options](#options) are available to disable or change concealing.
Try `:help concealcursor` and `:help conceallevel` for details.
## Options
### Disable Folding
- `g:vim_markdown_folding_disabled`
Add the following line to your `.vimrc` to disable the folding configuration:
let g:vim_markdown_folding_disabled = 1
This option only controls Vim Markdown specific folding configuration.
To enable/disable folding use Vim's standard folding configuration.
set [no]foldenable
### Change fold style
- `g:vim_markdown_folding_style_pythonic`
To fold in a style like [python-mode](https://github.com/klen/python-mode), add the following to your `.vimrc`:
let g:vim_markdown_folding_style_pythonic = 1
`g:vim_markdown_folding_level` setting (default 1) is set to `foldlevel`.
Thus level 1 heading which is served as a document title is expanded by default.
- `g:vim_markdown_override_foldtext`
To prevent foldtext from being set add the following to your `.vimrc`:
let g:vim_markdown_override_foldtext = 0
### Set header folding level
- `g:vim_markdown_folding_level`
Folding level is a number between 1 and 6. By default, if not specified, it is set to 1.
let g:vim_markdown_folding_level = 6
Tip: it can be changed on the fly with:
:let g:vim_markdown_folding_level = 1
:edit
### Disable Default Key Mappings
- `g:vim_markdown_no_default_key_mappings`
Add the following line to your `.vimrc` to disable default key mappings:
let g:vim_markdown_no_default_key_mappings = 1
You can also map them by yourself with `<Plug>` mappings.
### Enable TOC window auto-fit
- `g:vim_markdown_toc_autofit`
Allow for the TOC window to auto-fit when it's possible for it to shrink.
It never increases its default size (half screen), it only shrinks.
let g:vim_markdown_toc_autofit = 1
### Text emphasis restriction to single-lines
- `g:vim_markdown_emphasis_multiline`
By default text emphasis works across multiple lines until a closing token is found. However, it's possible to restrict text emphasis to a single line (i.e., for it to be applied a closing token must be found on the same line). To do so:
let g:vim_markdown_emphasis_multiline = 0
### Syntax Concealing
- `g:vim_markdown_conceal`
Concealing is set for some syntax.
For example, conceal `[link text](link url)` as just `link text`.
Also, `_italic_` and `*italic*` will conceal to just _italic_.
Similarly `__bold__`, `**bold**`, `___italic bold___`, and `***italic bold***`
will conceal to just __bold__, **bold**, ___italic bold___, and ***italic bold*** respectively.
To enable conceal use Vim's standard conceal configuration.
set conceallevel=2
To disable conceal regardless of `conceallevel` setting, add the following to your `.vimrc`:
let g:vim_markdown_conceal = 0
To disable math conceal with LaTeX math syntax enabled, add the following to your `.vimrc`:
let g:tex_conceal = ""
let g:vim_markdown_math = 1
- `g:vim_markdown_conceal_code_blocks`
Disabling conceal for code fences requires an additional setting:
let g:vim_markdown_conceal_code_blocks = 0
### Fenced code block languages
- `g:vim_markdown_fenced_languages`
You can use filetype name as fenced code block languages for syntax highlighting.
If you want to use different name from filetype, you can add it in your `.vimrc` like so:
let g:vim_markdown_fenced_languages = ['csharp=cs']
This will cause the following to be highlighted using the `cs` filetype syntax.
```csharp
...
```
Default is `['c++=cpp', 'viml=vim', 'bash=sh', 'ini=dosini']`.
### Follow named anchors
- `g:vim_markdown_follow_anchor`
This feature allows the `ge` command to follow named anchors in links of the form
`file#anchor` or just `#anchor`, where file may omit the `.md` extension as
usual. Two variables control its operation:
let g:vim_markdown_follow_anchor = 1
This tells vim-markdown whether to attempt to follow a named anchor in a link or
not. When it is 1, and only if a link can be split in two parts by the pattern
'#', then the first part is interpreted as the file and the second one as the
named anchor. This also includes urls of the form `#anchor`, for which the first
part is considered empty, meaning that the target file is the current one. After
the file is opened, the anchor will be searched.
Default is `0`.
- `g:vim_markdown_anchorexpr`
let g:vim_markdown_anchorexpr = "'<<'.v:anchor.'>>'"
This expression will be evaluated substituting `v:anchor` with a quoted string
that contains the anchor to visit. The result of the evaluation will become the
real anchor to search in the target file. This is useful in order to convert
anchors of the form, say, `my-section-title` to searches of the form `My Section
Title` or `<<my-section-title>>`.
Default is `''`.
### Syntax extensions
The following options control which syntax extensions will be turned on. They are off by default.
#### LaTeX math
- `g:vim_markdown_math`
Used as `$x^2$`, `$$x^2$$`, escapable as `\$x\$` and `\$\$x\$\$`.
let g:vim_markdown_math = 1
#### YAML Front Matter
- `g:vim_markdown_frontmatter`
Highlight YAML front matter as used by Jekyll or [Hugo](https://gohugo.io/content/front-matter/).
let g:vim_markdown_frontmatter = 1
#### TOML Front Matter
- `g:vim_markdown_toml_frontmatter`
Highlight TOML front matter as used by [Hugo](https://gohugo.io/content/front-matter/).
let g:vim_markdown_toml_frontmatter = 1
#### JSON Front Matter
- `g:vim_markdown_json_frontmatter`
Highlight JSON front matter as used by [Hugo](https://gohugo.io/content/front-matter/).
let g:vim_markdown_json_frontmatter = 1
#### Strikethrough
- `g:vim_markdown_strikethrough`
Strikethrough uses two tildes. `~~Scratch this.~~`
let g:vim_markdown_strikethrough = 1
### Adjust new list item indent
- `g:vim_markdown_new_list_item_indent`
You can adjust a new list indent. For example, you insert a single line like below:
* item1
Then if you type `o` to insert new line in vim and type `* item2`, the result will be:
* item1
* item2
vim-markdown automatically insert the indent. By default, the number of spaces of indent is 4. If you'd like to change the number as 2, just write:
let g:vim_markdown_new_list_item_indent = 2
### Do not require .md extensions for Markdown links
- `g:vim_markdown_no_extensions_in_markdown`
If you want to have a link like this `[link text](link-url)` and follow it for editing in vim using the `ge` command, but have it open the file "link-url.md" instead of the file "link-url", then use this option:
let g:vim_markdown_no_extensions_in_markdown = 1
This is super useful for GitLab and GitHub wiki repositories.
Normal behaviour would be that vim-markup required you to do this `[link text](link-url.md)`, but this is not how the Gitlab and GitHub wiki repositories work. So this option adds some consistency between the two.
### Auto-write when following link
- `g:vim_markdown_autowrite`
If you follow a link like this `[link text](link-url)` using the `ge` shortcut, this option will automatically save any edits you made before moving you:
let g:vim_markdown_autowrite = 1
### Change default file extension
- `g:vim_markdown_auto_extension_ext`
If you would like to use a file extension other than `.md` you may do so using the `vim_markdown_auto_extension_ext` variable:
let g:vim_markdown_auto_extension_ext = 'txt'
### Do not automatically insert bulletpoints
- `g:vim_markdown_auto_insert_bullets`
Automatically inserting bulletpoints can lead to problems when wrapping text
(see issue #232 for details), so it can be disabled:
let g:vim_markdown_auto_insert_bullets = 0
In that case, you probably also want to set the new list item indent to 0 as
well, or you will have to remove an indent each time you add a new list item:
let g:vim_markdown_new_list_item_indent = 0
### Change how to open new files
- `g:vim_markdown_edit_url_in`
By default when following a link the target file will be opened in your current buffer. This behavior can change if you prefer using splits or tabs by using the `vim_markdown_edit_url_in` variable. Possible values are `tab`, `vsplit`, `hsplit`, `current` opening in a new tab, vertical split, horizontal split, and current buffer respectively. Defaults to current buffer if not set:
let g:vim_markdown_edit_url_in = 'tab'
### Borderless tables
- `g:vim_markdown_borderless_table`
Add support for borderless tables, such as:
```
header 1|header 2
--|--
data 1|data 2
```
if set to `1`:
let g:vim_markdown_borderless_table = 1
the table would be formatted as usual:
```
| header 1 | header 2 |
|----------|----------|
| data 1 | data 2 |
```
## Mappings
The following work on normal and visual modes:
- `gx`: open the link under the cursor in the same browser as the standard `gx` command. `<Plug>Markdown_OpenUrlUnderCursor`
The standard `gx` is extended by allowing you to put your cursor anywhere inside a link.
For example, all the following cursor positions will work:
[Example](http://example.com)
^ ^ ^^ ^ ^
1 2 34 5 6
<http://example.com>
^ ^ ^
1 2 3
Known limitation: does not work for links that span multiple lines.
- `ge`: open the link under the cursor in Vim for editing. Useful for relative markdown links. Falls back to `gf` with force editing, if not on a markdown link. `<Plug>Markdown_EditUrlUnderCursor`
The rules for the cursor position are the same as the `gx` command.
- `]]`: go to next header. `<Plug>Markdown_MoveToNextHeader`
- `[[`: go to previous header. Contrast with `]h`. `<Plug>Markdown_MoveToPreviousHeader`
- `][`: go to next sibling header if any. `<Plug>Markdown_MoveToNextSiblingHeader`
- `[]`: go to previous sibling header if any. `<Plug>Markdown_MoveToPreviousSiblingHeader`
- `]h`: go to Current header. `<Plug>Markdown_MoveToCurHeader`
- `]u`: go to parent header (Up). `<Plug>Markdown_MoveToParentHeader`
This plugin follows the recommended Vim plugin mapping interface, so to change the map `]u` to `asdf`, add to your `.vimrc`:
map asdf <Plug>Markdown_MoveToParentHeader
To disable a map use:
map <Plug> <Plug>Markdown_MoveToParentHeader
## Commands
The following requires `:filetype plugin on`.
- `:HeaderDecrease`:
Decrease level of all headers in buffer: `h2` to `h1`, `h3` to `h2`, etc.
If range is given, only operate in the range.
If an `h1` would be decreased, abort.
For simplicity of implementation, Setex headers are converted to Atx.
- `:HeaderIncrease`: Analogous to `:HeaderDecrease`, but increase levels instead.
- `:SetexToAtx`:
Convert all Setex style headers in buffer to Atx.
If a range is given, e.g. hit `:` from visual mode, only operate on the range.
- `:TableFormat`: Format the table under the cursor [like this](http://www.cirosantilli.com/markdown-style-guide/#tables).
Requires [Tabular](https://github.com/godlygeek/tabular).
The input table *must* already have a separator line as the second line of the table.
That line only needs to contain the correct pipes `|`, nothing else is required.
- `:Toc`: create a quickfix vertical window navigable table of contents with the headers.
Hit `<Enter>` on a line to jump to the corresponding line of the markdown file.
- `:Toch`: Same as `:Toc` but in an horizontal window.
- `:Toct`: Same as `:Toc` but in a new tab.
- `:Tocv`: Same as `:Toc` for symmetry with `:Toch` and `:Tocv`.
- `:InsertToc`: Insert table of contents at the current line.
An optional argument can be used to specify how many levels of headers to display in the table of content, e.g., to display up to and including `h3`, use `:InsertToc 3`.
- `:InsertNToc`: Same as `:InsertToc`, but the format of `h2` headers in the table of contents is a numbered list, rather than a bulleted list.
## Credits
The main contributors of vim-markdown are:
- **Ben Williams** (A.K.A. **@plasticboy**). The original developer of vim-markdown. [Homepage](http://plasticboy.com/).
If you feel that your name should be on this list, please make a pull request listing your contributions.
## License
The MIT License (MIT)
Copyright (c) 2012 Benjamin D. Williams
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
$ cp vim-markdown-master.tar.gz ~/.vim
$ cd ~/.vim
$ tar --strip-components=1 --overwrite -zxf vim-markdown-master.tar.gz
$ rm vim-markdown-master.tar.gz
## Self-Promotion
If you like this plugin, you are welcome to:
* Star the repository on [GitHub](https://github.com/gabrielelana/vim-markdown)
* Follow me on
* [Twitter](http://twitter.com/gabrielelana)
* [GitHub](https://github.com/gabrielelana)
## Documentation
This section will contain preliminary documentation until full documentation is written.
### Configuration
* `let g:markdown_include_jekyll_support = 0` to disable support for Jekyll files (enabled by default with: `1`)
* `let g:markdown_enable_folding = 1` to enable the fold expression `markdown#FoldLevelOfLine` to fold markdown files. This is disabled by default because it's a huge performance hit even when folding is disabled with the `nofoldenable` option (disabled by default with: `0`)
* `let g:markdown_enable_mappings = 0` to disable default mappings (enabled by default with: `1`)
* `let g:markdown_enable_insert_mode_mappings = 0` to disable insert mode mappings (enabled by default with: `1`)
* `let g:markdown_enable_insert_mode_leader_mappings = 1` to enable insert mode leader mappings (disabled by default with: `0`)
* `let g:markdown_enable_spell_checking = 0` to disable spell checking (enabled by default with: `1`)
* `let g:markdown_enable_input_abbreviations = 0` to disable abbreviations for punctuation and emoticons (enabled by default with: `1`)
* `let g:markdown_enable_conceal = 1` to enable conceal for italic, bold, inline-code and link text (disabled by default with: `0`)
### Default Mappings (normal and visual mode)
_mappings are local to markdown buffers_
* `<Space>` (`NORMAL_MODE`) switch status of things:
* Cases
* A list item `* item` becomes a check list item `* [ ] item`
* A check list item `* [ ] item` becomes a checked list item `* [x] item`
* A checked list item `* [x] item` becomes a list item `* item`
* Can be changed with `g:markdown_mapping_switch_status = '<Leader>s'`
* `<Leader>ft` (`NORMAL_MODE`) format the current table
* `<Leader>e` (`NORMAL_MODE`, `VISUAL_MODE`) `:MarkdownEditCodeBlock` edit the current code block in another buffer with a guessed file type. The guess is based on the start of the range for `VISUAL_MODE`. If it's not possible to guess (you are not in a recognizable code block like a fenced code block) then the default is `markdown`. If it's not possible to guess and the current range is a single line and the line is empty then a new code block is created. It's asked to the user the file type of the new code block. The default file type is `markdown`.
### Optional Mappings (insert mode)
_mappings are local to markdown buffers_
* `<Leader>ft` (`INSERT_MODE`) same as `NORMAL_MODE` `<Leader>ft` with an additional mapping for `INSERT_MODE`
* `<Leader>e` (`INSERT_MODE`) same as `NORMAL_MODE` and `VISUAL_MODE` `<leader>e` with an additional mapping for `INSERT_MODE`
### Motions
* `]]` start of the next header
* `[[` start of the previous header
### While Editing in Insert Mode
* `|` in a table triggers the format command
* `<Tab>`/`<S-Tab>` on a list indents/unindents the item
* `<Tab>`/`<S-Tab>` on a blockquote increases/decreases the quote level
* `<Enter>` on a list item with no text in it (freshly created) deletes everything up to column 0
## Development
### Resources
* [Markdown GitHub Syntax](https://help.github.com/articles/github-flavored-markdown)
* [Markdown GitHub API](http://developer.github.com/v3/markdown)
* [Markdown GitHub Quick Preview](http://github-markdown-preview.heroku.com/)
### Syntax Specs
Testing syntax highlighting can be tricky. Here I use the golden master pattern to at least avoid regressions. This is how it works: in `./rspec/features` you will find a bunch of `*.md` files, one for each syntactic element supported. For each of those files there's an HTML file. This file is created with the `:TOhtml` command and it's the reference (aka golden master) of the syntax highlight of the original file. Running `rspec` compares the current syntax highlighting of all the feature's files with the reference syntax highlighting. If you see something wrong when looking at some of the feature's files, you can fix it and then regenerate the golden master files with `GENERATE_GOLDEN_MASTER=1 rspec`
## Known Bugs
* `formatlistpat` doesn't work for ordered lists
* `formatoptions` thinks that `*` in horizontal rules are list items
## TODO
* Kramdown Syntax
* Block Inline Attributes
* Span Inline Attributes
* Fenced Code Blocks with Inline Attributes
* Definition Lists
* Tables
* Math Blocks
* Footnotes
* Abbreviations
* End of Block Marker
* Code Blocks
* Edit Jekyll front matter code block
* Explain in this file why I chose to avoid to highlighting nested block elements
* Emoji (GFM)
* Start completion when hitting `:` in insert mode only if preceded by empty spaces or at the beginning of the line
* Remove duplication between syntax keywords and dictionary completion
* More `iabbr`
* Lists
* `i_<BS>` on a list item with no text in it (freshly created) will delete everything till the column 0
* `<C-K>` on a list item will swap it with the item above (if it exists)
* `<C-J>` on a list item will swap it with the item below (if it exists)
* `>` and `<` should properly indent/unindent list items
* `i_<C-D>` and `i_<C-T>` should properly indent/unindent list items and quote lines
* Define custom text objects for:
* List items
* Check list items
* Paragraph
* Start of the next paragraph `}`
* Start of the previous paragraph `{`
* Other inline elements
* Folding
* Fold HTML blocks
* Always consider the first non-space character of the line when checking for syntax group
* Always use `synstack` to check the syntax group of a position
* Write specs for the whole thing
* Support `foldtext` option
@@ -1,211 +0,0 @@
" vim: ts=4 sw=4:
" folding for Markdown headers, both styles (atx- and setex-)
" http://daringfireball.net/projects/markdown/syntax#header
"
" this code can be placed in file
" $HOME/.vim/after/ftplugin/markdown.vim
"
" original version from Steve Losh's gist: https://gist.github.com/1038710
function! s:is_mkdCode(lnum)
let name = synIDattr(synID(a:lnum, 1, 0), 'name')
return (name =~# '^mkd\%(Code$\|Snippet\)' || name !=# '' && name !~? '^\%(mkd\|html\)')
endfunction
if get(g:, 'vim_markdown_folding_style_pythonic', 0)
function! Foldexpr_markdown(lnum)
if (a:lnum == 1)
let b:fence_str = ''
endif
let l1 = getline(a:lnum)
"~~~~~ keep track of fenced code blocks ~~~~~
"If we hit a code block fence
if l1 =~# '\v^[[:space:]>]*\v(`{3,}|\~{3,})\s*(\w+)?\s*$'
" toggle the variable that says if we're in a code block
if b:fenced_block == 0
let b:fenced_block = 1
let b:fence_str = matchstr(l1, '\v(`{3,}|\~{3,})')
elseif b:fenced_block == 1 && matchstr(l1, '\v(`{3,}|\~{3,})') ==# b:fence_str
let b:fenced_block = 0
let b:fence_str = ''
endif
" else, if we're caring about front matter
elseif get(g:, 'vim_markdown_frontmatter', 0) == 1
" if we're in front matter and not on line 1
if b:front_matter == 1 && a:lnum > 2
let l0 = getline(a:lnum-1)
" if the previous line fenced front matter
if l0 ==# '---'
" we must not be in front matter
let b:front_matter = 0
endif
" else, if we're on line one
elseif a:lnum == 1
" if we hit a front matter fence
if l1 ==# '---'
" we're in the front matter
let b:front_matter = 1
endif
endif
endif
" if we're in a code block or front matter
if b:fenced_block ==# 1 || b:front_matter ==# 1
if a:lnum ==# 1
" fold any 'preamble'
return '>1'
else
" keep previous foldlevel
return '='
endif
endif
let l2 = getline(a:lnum+1)
" if the next line starts with two or more '='
" and is not code
if l2 =~# '^==\+\s*' && !s:is_mkdCode(a:lnum+1)
" next line is underlined (level 1)
return '>0'
" else, if the nex line starts with two or more '-'
" but is not comment closer (-->)
" and is not code
elseif l2 =~# '^--\+\s*$' && !s:is_mkdCode(a:lnum+1)
" next line is underlined (level 2)
return '>1'
endif
"if we're on a non-code line starting with a pound sign
if l1 =~# '^#' && !s:is_mkdCode(a:lnum)
" set the fold level to the number of hashes -1
" return '>'.(matchend(l1, '^#\+') - 1)
" set the fold level to the number of hashes
return '>'.(matchend(l1, '^#\+'))
" else, if we're on line 1
elseif a:lnum == 1
" fold any 'preamble'
return '>1'
else
" keep previous foldlevel
return '='
endif
endfunction
function! Foldtext_markdown()
let line = getline(v:foldstart)
let has_numbers = &number || &relativenumber
let nucolwidth = &foldcolumn + has_numbers * &numberwidth
let windowwidth = winwidth(0) - nucolwidth - 6
let foldedlinecount = v:foldend - v:foldstart
let line = strpart(line, 0, windowwidth - 2 -len(foldedlinecount))
let line = substitute(line, '\%("""\|''''''\)', '', '')
let fillcharcount = windowwidth - len(line) - len(foldedlinecount) + 1
return line . ' ' . repeat('-', fillcharcount) . ' ' . foldedlinecount
endfunction
else " vim_markdown_folding_style_pythonic == 0
function! Foldexpr_markdown(lnum)
if (a:lnum == 1)
let l0 = ''
let b:fence_str = ''
else
let l0 = getline(a:lnum-1)
endif
" keep track of fenced code blocks
if l0 =~# '\v^[[:space:]>]*\v(`{3,}|\~{3,})\s*(\w+)?\s*$'
if b:fenced_block == 0
let b:fenced_block = 1
let b:fence_str = matchstr(l0, '\v(`{3,}|\~{3,})')
elseif b:fenced_block == 1 && matchstr(l0, '\v(`{3,}|\~{3,})') ==# b:fence_str
let b:fenced_block = 0
let b:fence_str = ''
endif
elseif get(g:, 'vim_markdown_frontmatter', 0) == 1
if b:front_matter == 1
if l0 ==# '---'
let b:front_matter = 0
endif
elseif a:lnum == 2
if l0 ==# '---'
let b:front_matter = 1
endif
endif
endif
if b:fenced_block == 1 || b:front_matter == 1
" keep previous foldlevel
return '='
endif
let l2 = getline(a:lnum+1)
if l2 =~# '^==\+\s*' && !s:is_mkdCode(a:lnum+1)
" next line is underlined (level 1)
return '>1'
elseif l2 =~# '^--\+\s*$' && !s:is_mkdCode(a:lnum+1)
" next line is underlined (level 2)
if s:vim_markdown_folding_level >= 2
return '>1'
else
return '>2'
endif
endif
let l1 = getline(a:lnum)
if l1 =~# '^#' && !s:is_mkdCode(a:lnum)
" fold level according to option
if s:vim_markdown_folding_level == 1 || matchend(l1, '^#\+') > s:vim_markdown_folding_level
if a:lnum == line('$')
return matchend(l1, '^#\+') - 1
else
return -1
endif
else
" headers are not folded
return 0
endif
endif
if l0 =~# '^#' && !s:is_mkdCode(a:lnum-1)
" previous line starts with hashes
return '>'.matchend(l0, '^#\+')
else
" keep previous foldlevel
return '='
endif
endfunction
endif
let b:fenced_block = 0
let b:front_matter = 0
let s:vim_markdown_folding_level = get(g:, 'vim_markdown_folding_level', 1)
function! s:MarkdownSetupFolding()
if !get(g:, 'vim_markdown_folding_disabled', 0)
if get(g:, 'vim_markdown_folding_style_pythonic', 0)
if get(g:, 'vim_markdown_override_foldtext', 1)
setlocal foldtext=Foldtext_markdown()
endif
endif
setlocal foldexpr=Foldexpr_markdown(v:lnum)
setlocal foldmethod=expr
endif
endfunction
function! s:MarkdownSetupFoldLevel()
if get(g:, 'vim_markdown_folding_style_pythonic', 0)
" set default foldlevel
execute 'setlocal foldlevel='.s:vim_markdown_folding_level
endif
endfunction
call s:MarkdownSetupFoldLevel()
call s:MarkdownSetupFolding()
augroup Mkd
" These autocmds need to be kept in sync with the autocmds calling
" s:MarkdownRefreshSyntax in ftplugin/markdown.vim.
autocmd BufWinEnter,BufWritePost <buffer> call s:MarkdownSetupFolding()
autocmd InsertEnter,InsertLeave <buffer> call s:MarkdownSetupFolding()
autocmd CursorHold,CursorHoldI <buffer> call s:MarkdownSetupFolding()
augroup END
@@ -0,0 +1,528 @@
" {{{ FOLDING
function! markdown#FoldLevelOfLine(lnum)
let currentline = getline(a:lnum)
let nextline = getline(a:lnum + 1)
" an empty line is not going to change the indentation level
if match(currentline, '^\s*$') >= 0
return '='
endif
" folding lists
if s:SyntaxGroupOfLineIs(a:lnum, '^markdownListItem')
if s:SyntaxGroupOfLineIs(a:lnum - 1, '^markdownListItem')
return 'a1'
endif
if s:SyntaxGroupOfLineIs(a:lnum + 1, '^markdownListItem')
return 's1'
endif
return '='
endif
" we are not going to fold things inside list items, too hairy
let is_inside_a_list_item = s:SyntaxGroupOfLineIs(a:lnum, '^markdownListItem')
if is_inside_a_list_item
return '='
endif
" folding atx headers
if match(currentline, '^#\{1,6}\s') >= 0
let header_level = strlen(substitute(currentline, '^\(#\{1,6}\).*', '\1', ''))
return '>' . header_level
endif
" folding fenced code blocks
let next_line_syntax_group = synIDattr(synID(a:lnum + 1, 1, 1), 'name')
if match(currentline, '^\s*```') >= 0
if next_line_syntax_group ==# 'markdownFencedCodeBlock'
return 'a1'
endif
return 's1'
endif
" folding code blocks
let current_line_syntax_group = synIDattr(synID(a:lnum, 1, 1), 'name')
let prev_line_syntax_group = synIDattr(synID(a:lnum - 1, 1, 1), 'name')
if match(currentline, '^\s\{4,}') >= 0
if current_line_syntax_group ==# 'markdownCodeBlock'
if prev_line_syntax_group !=# 'markdownCodeBlock'
return 'a1'
endif
if next_line_syntax_group !=# 'markdownCodeBlock'
return 's1'
endif
endif
return '='
endif
" folding setex headers
if (match(currentline, '^.*$') >= 0)
if (match(nextline, '^=\+$') >= 0)
return '>1'
endif
if (match(nextline, '^-\+$') >= 0)
return '>2'
endif
endif
return '='
endfunction
function! s:SyntaxGroupOfLineIs(lnum, pattern)
let stack = synstack(a:lnum, a:cnum)
if len(stack) > 0
return synIDattr(stack[0], 'name') =~# a:pattern
endif
return 0
endfunction
" }}}
" {{{ EDIT
function! markdown#EditBlock() range abort
if exists('b:markdown_temporary_buffer') && b:markdown_temporary_buffer
echo 'Sorry, you cannot edit a code block inside a temporary buffer'
return
endif
" Github fenced code blocks like ```ruby
let code_block = s:LocateFencedCodeBlock(a:firstline,
\ '^\s*`\{3,}\(\w\+\)\%(\s.*$\|$\)',
\ '^\s*`\{3,}\s*$'
\ )
if code_block['from'] == 0 || code_block['to'] == 0
" Github fenced code blocks with metadata like ```{ruby, <WHATEVER>}
let code_block = s:LocateFencedCodeBlock(a:firstline,
\ '^\s*`\{3,}{\(\w\+\),[^}]\+}\%(\s.*$\|$\)',
\ '^\s*`\{3,}\s*$'
\ )
endif
if code_block['from'] == 0 || code_block['to'] == 0
" Github fenced code blocks alternate style like ~~~ruby
let code_block = s:LocateFencedCodeBlock(a:firstline,
\ '^\s*\~\{3,}\(\w\+\)\%(\s.*$\|$\)',
\ '^\s*\~\{3,}\s*$'
\ )
endif
if code_block['from'] == 0 || code_block['to'] == 0
" Liquid fenced code blocks {% highlight ruby %}
" (since we support some liquid/jekyll tags, why not?)
let code_block = s:LocateFencedCodeBlock(a:firstline,
\ '^\s*{%\s*highlight\s\+\(\w\+\)\s*%}\%(\s.*$\|$\)',
\ '^\s*{%\s*endhighlight\s*%}\%(\s.*$\|$\)'
\ )
endif
if code_block['from'] == 0 || code_block['to'] == 0
let code_block = s:LocateRangeBlock(a:firstline, a:lastline)
endif
if code_block['from'] == 0 || code_block['to'] == 0
echo 'Sorry, I did not find any suitable code block to edit or create'
return
endif
let code_block['file_extension'] = '.' . code_block['language']
if has_key(s:known_file_extensions, code_block['language'])
let code_block['file_extension'] = s:known_file_extensions[code_block['language']]
endif
let code_block['file_path'] = tempname() . code_block['file_extension']
let code_block['content'] = getline(code_block['from'], code_block['to'])
let code_block['content'] = s:UnindentBlock(code_block['content'], code_block['indentation'])
call writefile(code_block['content'], code_block['file_path'])
augroup MarkdownReplaceEditedBlock
autocmd BufEnter <buffer> call s:ReplaceEditedBlock()
augroup END
let b:code_block = code_block
execute 'split ' . code_block['file_path']
let b:markdown_temporary_buffer = 1
autocmd BufLeave <buffer> wq
endfunction
function! s:ReplaceEditedBlock()
augroup MarkdownReplaceEditedBlock
autocmd!
augroup END
augroup! MarkdownReplaceEditedBlock
if b:code_block['to'] - b:code_block['from'] >= 0
execute b:code_block['from'] . ',' b:code_block['to'] . ' delete _'
endif
let content = readfile(b:code_block['file_path'])
let content = s:IndentBlock(l:content, b:code_block['indentation'])
let content = s:SurroundWithFencedCodeBlock(l:content, b:code_block)
call append(b:code_block['from']-1, content)
call setpos('.', b:code_block['back_to_position'])
execute 'silent bwipeout! ' . b:code_block['file_path']
call delete(b:code_block['file_path'])
unlet! b:code_block
endfunction
function! s:UnindentBlock(content, indentation)
return map(a:content, 'substitute(v:val, ''^' . a:indentation . ''', '''', ''g'')')
endfunction
function! s:IndentBlock(content, indentation)
return map(a:content, 'substitute(v:val, ''^'', ''' . a:indentation . ''', ''g'')')
endfunction
function! s:SurroundWithFencedCodeBlock(code, editing)
if !a:editing['surround'] | return a:code | endif
if a:editing['language'] =~# 'markdown' | return a:code | endif
let before =
\ (a:editing['make_room_before'] ? [''] : []) +
\ [a:editing['indentation'] . '```' . a:editing['language']]
let after =
\ [a:editing['indentation'] . '```'] +
\ (a:editing['make_room_after'] ? [''] : [])
return l:before + a:code + l:after
endfunction
function! s:LocateRangeBlock(from, to)
" TODO: extract initialize_code_block
let code_block = {'from': 0, 'to': 0, 'language': 'txt', 'indentation': '', 'surround': 0}
if a:to >= a:from
let code_block['from'] = a:from
let code_block['to'] = a:to
let code_block['back_to_position'] = getpos('.')
let code_block['language'] = 'markdown'
if a:from == a:to && getline(a:from) =~ '^\s*$'
let code_block['surround'] = 1
let code_block['make_room_before'] = getline(a:from - 1) !~ '^\s*$'
let code_block['make_room_after'] = getline(a:to + 1) !~ '^\s*$'
let code_block['language'] = input('filetype? (default: markdown) ', '', 'filetype')
if code_block['language'] =~ '^\s*$'
let code_block['language'] = 'markdown'
endif
endif
endif
return code_block
endfunction
function! s:LocateFencedCodeBlock(starting_from, upper_delimiter, lower_delimiter)
" TODO: extract initialize_code_block
let code_block = {'from': 0, 'to': 0, 'language': 'txt', 'indentation': '', 'surround': 0}
let initial_position = getpos('.')
let search_position = copy(initial_position)
let search_position[1] = a:starting_from
let search_position[2] = 0
cal setpos('.', search_position)
let start_code_block_backward = search(a:upper_delimiter, 'cbnW')
let end_code_block_backward = search(a:lower_delimiter, 'cbnW')
let end_code_block_forward = search(a:lower_delimiter, 'cnW')
let found_code_block =
\ start_code_block_backward > 0 &&
\ end_code_block_forward > 0
let between_two_code_blocks =
\ start_code_block_backward < end_code_block_backward &&
\ end_code_block_backward <= a:starting_from
let starting_inside_code_block =
\ found_code_block &&
\ !between_two_code_blocks &&
\ start_code_block_backward <= a:starting_from &&
\ end_code_block_forward >= a:starting_from
if starting_inside_code_block
let code_block['language'] = s:ExtractLanguage(start_code_block_backward, a:upper_delimiter)
let code_block['indentation'] = s:ExtractIndentation(start_code_block_backward)
let code_block['back_to_position'] = initial_position
let code_block['back_to_position'][1] = start_code_block_backward
let code_block['back_to_position'][2] = 0
let code_block['from'] = start_code_block_backward + 1
let code_block['to'] = end_code_block_forward - 1
endif
return code_block
endfunction
function! s:ExtractLanguage(start_at, upper_delimiter)
return substitute(getline(a:start_at), a:upper_delimiter, '\1', '')
endfunction
function! s:ExtractIndentation(start_at)
return substitute(getline(a:start_at), '\(^\s*\).\+$', '\1', '')
endfunction
let s:known_file_extensions = {
\ 'abap': '.abap',
\ 'antlr': '.g4',
\ 'asp': '.asp',
\ 'ats': '.dats',
\ 'actionscript': '.as',
\ 'ada': '.adb',
\ 'agda': '.agda',
\ 'apacheconf': '.apacheconf',
\ 'apex': '.cls',
\ 'applescript': '.applescript',
\ 'arc': '.arc',
\ 'arduino': '.ino',
\ 'asciidoc': '.asciidoc',
\ 'assembly': '.asm',
\ 'augeas': '.aug',
\ 'autohotkey': '.ahk',
\ 'autoit': '.au3',
\ 'awk': '.awk',
\ 'batchfile': '.bat',
\ 'befunge': '.befunge',
\ 'blitzbasic': '.bb',
\ 'blitzmax': '.bmx',
\ 'bluespec': '.bsv',
\ 'boo': '.boo',
\ 'brainfuck': '.b',
\ 'brightscript': '.brs',
\ 'bro': '.bro',
\ 'c': '.c',
\ 'c++': '.cpp',
\ 'cpp': '.cpp',
\ 'clips': '.clp',
\ 'cmake': '.cmake',
\ 'cobol': '.cob',
\ 'css': '.css',
\ 'ceylon': '.ceylon',
\ 'chuck': '.ck',
\ 'cirru': '.cirru',
\ 'clean': '.icl',
\ 'clojure': '.clj',
\ 'coffeescript': '.coffee',
\ 'coldfusion': '.cfm',
\ 'coq': '.coq',
\ 'creole': '.creole',
\ 'crystal': '.cr',
\ 'cucumber': '.feature',
\ 'cuda': '.cu',
\ 'cython': '.pyx',
\ 'd': '.d',
\ 'dm': '.dm',
\ 'dot': '.dot',
\ 'dart': '.dart',
\ 'diff': '.diff',
\ 'dylan': '.dylan',
\ 'ecl': '.ecl',
\ 'eiffel': '.e',
\ 'elixir': '.ex',
\ 'elm': '.elm',
\ 'erlang': '.erl',
\ 'flux': '.fx',
\ 'fortran': '.f90',
\ 'factor': '.factor',
\ 'fancy': '.fy',
\ 'fantom': '.fan',
\ 'forth': '.fth',
\ 'gas': '.s',
\ 'glsl': '.glsl',
\ 'genshi': '.kid',
\ 'glyph': '.glf',
\ 'go': '.go',
\ 'gosu': '.gs',
\ 'groff': '.man',
\ 'groovy': '.groovy',
\ 'html': '.html',
\ 'http': '.http',
\ 'haml': '.haml',
\ 'handlebars': '.handlebars',
\ 'harbour': '.hb',
\ 'haskell': '.hs',
\ 'haxe': '.hx',
\ 'hy': '.hy',
\ 'idl': '.pro',
\ 'ini': '.ini',
\ 'idris': '.idr',
\ 'io': '.io',
\ 'ioke': '.ik',
\ 'j': '.ijs',
\ 'json': '.json',
\ 'json5': '.json5',
\ 'jsonld': '.jsonld',
\ 'jade': '.jade',
\ 'java': '.java',
\ 'javascript': '.js',
\ 'julia': '.jl',
\ 'krl': '.krl',
\ 'kotlin': '.kt',
\ 'lfe': '.lfe',
\ 'llvm': '.ll',
\ 'lasso': '.lasso',
\ 'less': '.less',
\ 'lilypond': '.ly',
\ 'livescript': '.ls',
\ 'logos': '.xm',
\ 'logtalk': '.lgt',
\ 'lua': '.lua',
\ 'm': '.mumps',
\ 'makefile': '.mak',
\ 'mako': '.mako',
\ 'markdown': '.md',
\ 'mask': '.mask',
\ 'matlab': '.matlab',
\ 'max': '.maxpat',
\ 'mediawiki': '.mediawiki',
\ 'mirah': '.druby',
\ 'monkey': '.monkey',
\ 'moocode': '.moo',
\ 'moonscript': '.moon',
\ 'myghty': '.myt',
\ 'nsis': '.nsi',
\ 'nemerle': '.n',
\ 'netlogo': '.nlogo',
\ 'nginx': '.nginxconf',
\ 'nimrod': '.nim',
\ 'nu': '.nu',
\ 'numpy': '.numpy',
\ 'ocaml': '.ml',
\ 'objdump': '.objdump',
\ 'omgrofl': '.omgrofl',
\ 'opa': '.opa',
\ 'opencl': '.cl',
\ 'org': '.org',
\ 'oxygene': '.oxygene',
\ 'pawn': '.pwn',
\ 'php': '.php',
\ 'parrot': '.parrot',
\ 'pascal': '.pas',
\ 'perl': '.pl',
\ 'perl6': '.p6',
\ 'pike': '.pike',
\ 'pod': '.pod',
\ 'pogoscript': '.pogo',
\ 'postscript': '.ps',
\ 'powershell': '.ps1',
\ 'processing': '.pde',
\ 'prolog': '.prolog',
\ 'puppet': '.pp',
\ 'python': '.py',
\ 'qml': '.qml',
\ 'r': '.r',
\ 'rdoc': '.rdoc',
\ 'realbasic': '.rbbas',
\ 'rhtml': '.rhtml',
\ 'rmarkdown': '.rmd',
\ 'racket': '.rkt',
\ 'rebol': '.rebol',
\ 'redcode': '.cw',
\ 'robotframework': '.robot',
\ 'rouge': '.rg',
\ 'ruby': '.rb',
\ 'rust': '.rs',
\ 'scss': '.scss',
\ 'sql': '.sql',
\ 'sage': '.sage',
\ 'sass': '.sass',
\ 'scala': '.scala',
\ 'scaml': '.scaml',
\ 'scheme': '.scm',
\ 'scilab': '.sci',
\ 'self': '.self',
\ 'shell': '.sh',
\ 'shen': '.shen',
\ 'slash': '.sl',
\ 'smalltalk': '.st',
\ 'smarty': '.tpl',
\ 'squirrel': '.nut',
\ 'stylus': '.styl',
\ 'supercollider': '.scd',
\ 'toml': '.toml',
\ 'txl': '.txl',
\ 'tcl': '.tcl',
\ 'tcsh': '.tcsh',
\ 'tex': '.tex',
\ 'tea': '.tea',
\ 'textile': '.textile',
\ 'turing': '.t',
\ 'twig': '.twig',
\ 'typescript': '.ts',
\ 'unrealscript': '.uc',
\ 'vhdl': '.vhdl',
\ 'vala': '.vala',
\ 'verilog': '.v',
\ 'viml': '.vim',
\ 'volt': '.volt',
\ 'xc': '.xc',
\ 'xml': '.xml',
\ 'xproc': '.xpl',
\ 'xquery': '.xquery',
\ 'xs': '.xs',
\ 'xslt': '.xslt',
\ 'xtend': '.xtend',
\ 'yaml': '.yml',
\ 'ec': '.ec',
\ 'edn': '.edn',
\ 'fish': '.fish',
\ 'mupad': '.mu',
\ 'nesc': '.nc',
\ 'ooc': '.ooc',
\ 'restructuredtext': '.rst',
\ 'wisp': '.wisp',
\ 'xbase': '.prg',
\ }
" }}}
" {{{ FORMAT
function! markdown#FormatTable()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
let separator_line_number = search('^\s*|\s*-\{3,}', 'cbnW')
call s:ShrinkTableHeaderSeparator(separator_line_number)
Tabularize/|/l1
call s:ExpandTableHeaderSeparator(separator_line_number)
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
endfunction
function! s:ShrinkTableHeaderSeparator(separator_line_number)
if a:separator_line_number > 0
let separator_line = getline(a:separator_line_number)
let separator_line = substitute(separator_line, '-\+', '---', 'g')
call setline(a:separator_line_number, separator_line)
endif
endfunction
function! s:ExpandTableHeaderSeparator(separator_line_number)
if a:separator_line_number > 0
let separator_line = getline(a:separator_line_number)
let separator_line = substitute(
\ separator_line,
\ '|\([^|]*\)',
\ '\="| " . repeat("-", strlen(submatch(1)) - 2) . " "',
\ 'g')
let separator_line = substitute(separator_line, '\s*$', '', '')
call setline(a:separator_line_number, separator_line)
endif
endfunction
" }}}
" {{{ SWITCH STATUS
function! markdown#SwitchStatus()
let current_line = getline('.')
if match(current_line, '^\s*[*\-+] \[ \]') >= 0
call setline('.', substitute(current_line, '^\(\s*[*\-+]\) \[ \]', '\1 [x]', ''))
return
endif
if match(current_line, '^\s*[*\-+] \[x\]') >= 0
call setline('.', substitute(current_line, '^\(\s*[*\-+]\) \[x\]', '\1', ''))
return
endif
if match(current_line, '^\s*[*\-+] \(\[[x ]\]\)\@!') >= 0
call setline('.', substitute(current_line, '^\(\s*[*\-+]\)', '\1 [ ]', ''))
return
endif
if match(current_line, '^\s*#\{1,5}\s') >= 0
call setline('.', substitute(current_line, '^\(\s*#\{1,5}\) \(.*$\)', '\1# \2', ''))
return
endif
if match(current_line, '^\s*#\{6}\s') >= 0
call setline('.', substitute(current_line, '^\(\s*\)#\{6} \(.*$\)', '\1# \2', ''))
return
endif
endfunction
" }}}
@@ -0,0 +1,868 @@
:bowtie:
:smile:
:laughing:
:blush:
:smiley:
:relaxed:
:smirk:
:heart_eyes:
:kissing_heart:
:kissing_closed_eyes:
:flushed:
:relieved:
:satisfied:
:grin:
:wink:
:stuck_out_tongue_winking_eye:
:stuck_out_tongue_closed_eyes:
:grinning:
:kissing:
:kissing_smiling_eyes:
:stuck_out_tongue:
:sleeping:
:worried:
:frowning:
:anguished:
:open_mouth:
:grimacing:
:confused:
:hushed:
:expressionless:
:unamused:
:sweat_smile:
:sweat:
:disappointed_relieved:
:weary:
:pensive:
:disappointed:
:confounded:
:fearful:
:cold_sweat:
:persevere:
:cry:
:sob:
:joy:
:astonished:
:scream:
:neckbeard:
:tired_face:
:angry:
:rage:
:triumph:
:sleepy:
:yum:
:mask:
:sunglasses:
:dizzy_face:
:imp:
:smiling_imp:
:neutral_face:
:no_mouth:
:innocent:
:alien:
:yellow_heart:
:blue_heart:
:purple_heart:
:heart:
:green_heart:
:broken_heart:
:heartbeat:
:heartpulse:
:two_hearts:
:revolving_hearts:
:cupid:
:sparkling_heart:
:sparkles:
:star:
:star2:
:dizzy:
:boom:
:collision:
:anger:
:exclamation:
:question:
:grey_exclamation:
:grey_question:
:zzz:
:dash:
:sweat_drops:
:notes:
:musical_note:
:fire:
:hankey:
:poop:
:shit:
:+1:
:thumbsup:
:-1:
:thumbsdown:
:ok_hand:
:punch:
:facepunch:
:fist:
:v:
:wave:
:hand:
:raised_hand:
:open_hands:
:point_up:
:point_down:
:point_left:
:point_right:
:raised_hands:
:pray:
:point_up_2:
:clap:
:muscle:
:metal:
:fu:
:walking:
:runner:
:running:
:couple:
:family:
:two_men_holding_hands:
:two_women_holding_hands:
:dancer:
:dancers:
:ok_woman:
:no_good:
:information_desk_person:
:raising_hand:
:bride_with_veil:
:person_with_pouting_face:
:person_frowning:
:bow:
:couplekiss:
:couple_with_heart:
:massage:
:haircut:
:nail_care:
:boy:
:girl:
:woman:
:man:
:baby:
:older_woman:
:older_man:
:person_with_blond_hair:
:man_with_gua_pi_mao:
:man_with_turban:
:construction_worker:
:cop:
:angel:
:princess:
:smiley_cat:
:smile_cat:
:heart_eyes_cat:
:kissing_cat:
:smirk_cat:
:scream_cat:
:crying_cat_face:
:joy_cat:
:pouting_cat:
:japanese_ogre:
:japanese_goblin:
:see_no_evil:
:hear_no_evil:
:speak_no_evil:
:guardsman:
:skull:
:feet:
:lips:
:kiss:
:droplet:
:ear:
:eyes:
:nose:
:tongue:
:love_letter:
:bust_in_silhouette:
:busts_in_silhouette:
:speech_balloon:
:thought_balloon:
:feelsgood:
:finnadie:
:goberserk:
:godmode:
:hurtrealbad:
:rage1:
:rage2:
:rage3:
:rage4:
:suspect:
:trollface:
:sunny:
:umbrella:
:cloud:
:snowflake:
:snowman:
:zap:
:cyclone:
:foggy:
:ocean:
:cat:
:dog:
:mouse:
:hamster:
:rabbit:
:wolf:
:frog:
:tiger:
:koala:
:bear:
:pig:
:pig_nose:
:cow:
:boar:
:monkey_face:
:monkey:
:horse:
:racehorse:
:camel:
:sheep:
:elephant:
:panda_face:
:snake:
:bird:
:baby_chick:
:hatched_chick:
:hatching_chick:
:chicken:
:penguin:
:turtle:
:bug:
:honeybee:
:ant:
:beetle:
:snail:
:octopus:
:tropical_fish:
:fish:
:whale:
:whale2:
:dolphin:
:cow2:
:ram:
:rat:
:water_buffalo:
:tiger2:
:rabbit2:
:dragon:
:goat:
:rooster:
:dog2:
:pig2:
:mouse2:
:ox:
:dragon_face:
:blowfish:
:crocodile:
:dromedary_camel:
:leopard:
:cat2:
:poodle:
:paw_prints:
:bouquet:
:cherry_blossom:
:tulip:
:four_leaf_clover:
:rose:
:sunflower:
:hibiscus:
:maple_leaf:
:leaves:
:fallen_leaf:
:herb:
:mushroom:
:cactus:
:palm_tree:
:evergreen_tree:
:deciduous_tree:
:chestnut:
:seedling:
:blossom:
:ear_of_rice:
:shell:
:globe_with_meridians:
:sun_with_face:
:full_moon_with_face:
:new_moon_with_face:
:new_moon:
:waxing_crescent_moon:
:first_quarter_moon:
:waxing_gibbous_moon:
:full_moon:
:waning_gibbous_moon:
:last_quarter_moon:
:waning_crescent_moon:
:last_quarter_moon_with_face:
:first_quarter_moon_with_face:
:moon:
:earth_africa:
:earth_americas:
:earth_asia:
:volcano:
:milky_way:
:partly_sunny:
:octocat:
:squirrel:
:bamboo:
:gift_heart:
:dolls:
:school_satchel:
:mortar_board:
:flags:
:fireworks:
:sparkler:
:wind_chime:
:rice_scene:
:jack_o_lantern:
:ghost:
:santa:
:christmas_tree:
:gift:
:bell:
:no_bell:
:tanabata_tree:
:tada:
:confetti_ball:
:balloon:
:crystal_ball:
:cd:
:dvd:
:floppy_disk:
:camera:
:video_camera:
:movie_camera:
:computer:
:tv:
:iphone:
:phone:
:telephone:
:telephone_receiver:
:pager:
:fax:
:minidisc:
:vhs:
:sound:
:speaker:
:mute:
:loudspeaker:
:mega:
:hourglass:
:hourglass_flowing_sand:
:alarm_clock:
:watch:
:radio:
:satellite:
:loop:
:mag:
:mag_right:
:unlock:
:lock:
:lock_with_ink_pen:
:closed_lock_with_key:
:key:
:bulb:
:flashlight:
:high_brightness:
:low_brightness:
:electric_plug:
:battery:
:calling:
:email:
:mailbox:
:postbox:
:bath:
:bathtub:
:shower:
:toilet:
:wrench:
:nut_and_bolt:
:hammer:
:seat:
:moneybag:
:yen:
:dollar:
:pound:
:euro:
:credit_card:
:money_with_wings:
:e-mail:
:inbox_tray:
:outbox_tray:
:envelope:
:incoming_envelope:
:postal_horn:
:mailbox_closed:
:mailbox_with_mail:
:mailbox_with_no_mail:
:door:
:smoking:
:bomb:
:gun:
:hocho:
:pill:
:syringe:
:page_facing_up:
:page_with_curl:
:bookmark_tabs:
:bar_chart:
:chart_with_upwards_trend:
:chart_with_downwards_trend:
:scroll:
:clipboard:
:calendar:
:date:
:card_index:
:file_folder:
:open_file_folder:
:scissors:
:pushpin:
:paperclip:
:black_nib:
:pencil2:
:straight_ruler:
:triangular_ruler:
:closed_book:
:green_book:
:blue_book:
:orange_book:
:notebook:
:notebook_with_decorative_cover:
:ledger:
:books:
:bookmark:
:name_badge:
:microscope:
:telescope:
:newspaper:
:football:
:basketball:
:soccer:
:baseball:
:tennis:
:8ball:
:rugby_football:
:bowling:
:golf:
:mountain_bicyclist:
:bicyclist:
:horse_racing:
:snowboarder:
:swimmer:
:surfer:
:ski:
:spades:
:hearts:
:clubs:
:diamonds:
:gem:
:ring:
:trophy:
:musical_score:
:musical_keyboard:
:violin:
:space_invader:
:video_game:
:black_joker:
:flower_playing_cards:
:game_die:
:dart:
:mahjong:
:clapper:
:memo:
:pencil:
:book:
:art:
:microphone:
:headphones:
:trumpet:
:saxophone:
:guitar:
:shoe:
:sandal:
:high_heel:
:lipstick:
:boot:
:shirt:
:tshirt:
:necktie:
:womans_clothes:
:dress:
:running_shirt_with_sash:
:jeans:
:kimono:
:bikini:
:ribbon:
:tophat:
:crown:
:womans_hat:
:mans_shoe:
:closed_umbrella:
:briefcase:
:handbag:
:pouch:
:purse:
:eyeglasses:
:fishing_pole_and_fish:
:coffee:
:tea:
:sake:
:baby_bottle:
:beer:
:beers:
:cocktail:
:tropical_drink:
:wine_glass:
:fork_and_knife:
:pizza:
:hamburger:
:fries:
:poultry_leg:
:meat_on_bone:
:spaghetti:
:curry:
:fried_shrimp:
:bento:
:sushi:
:fish_cake:
:rice_ball:
:rice_cracker:
:rice:
:ramen:
:stew:
:oden:
:dango:
:egg:
:bread:
:doughnut:
:custard:
:icecream:
:ice_cream:
:shaved_ice:
:birthday:
:cake:
:cookie:
:chocolate_bar:
:candy:
:lollipop:
:honey_pot:
:apple:
:green_apple:
:tangerine:
:lemon:
:cherries:
:grapes:
:watermelon:
:strawberry:
:peach:
:melon:
:banana:
:pear:
:pineapple:
:sweet_potato:
:eggplant:
:tomato:
:corn:
:house:
:house_with_garden:
:school:
:office:
:post_office:
:hospital:
:bank:
:convenience_store:
:love_hotel:
:hotel:
:wedding:
:church:
:department_store:
:european_post_office:
:city_sunrise:
:city_sunset:
:japanese_castle:
:european_castle:
:tent:
:factory:
:tokyo_tower:
:japan:
:mount_fuji:
:sunrise_over_mountains:
:sunrise:
:stars:
:statue_of_liberty:
:bridge_at_night:
:carousel_horse:
:rainbow:
:ferris_wheel:
:fountain:
:roller_coaster:
:ship:
:speedboat:
:boat:
:sailboat:
:rowboat:
:anchor:
:rocket:
:airplane:
:helicopter:
:steam_locomotive:
:tram:
:mountain_railway:
:bike:
:aerial_tramway:
:suspension_railway:
:mountain_cableway:
:tractor:
:blue_car:
:oncoming_automobile:
:car:
:red_car:
:taxi:
:oncoming_taxi:
:articulated_lorry:
:bus:
:oncoming_bus:
:rotating_light:
:police_car:
:oncoming_police_car:
:fire_engine:
:ambulance:
:minibus:
:truck:
:train:
:station:
:train2:
:bullettrain_front:
:bullettrain_side:
:light_rail:
:monorail:
:railway_car:
:trolleybus:
:ticket:
:fuelpump:
:vertical_traffic_light:
:traffic_light:
:warning:
:construction:
:beginner:
:atm:
:slot_machine:
:busstop:
:barber:
:hotsprings:
:checkered_flag:
:crossed_flags:
:izakaya_lantern:
:moyai:
:circus_tent:
:performing_arts:
:round_pushpin:
:triangular_flag_on_post:
:jp:
:kr:
:cn:
:us:
:fr:
:es:
:it:
:ru:
:gb:
:uk:
:de:
:one:
:two:
:three:
:four:
:five:
:six:
:seven:
:eight:
:nine:
:keycap_ten:
:1234:
:zero:
:hash:
:symbols:
:arrow_backward:
:arrow_down:
:arrow_forward:
:arrow_left:
:capital_abcd:
:abcd:
:abc:
:arrow_lower_left:
:arrow_lower_right:
:arrow_right:
:arrow_up:
:arrow_upper_left:
:arrow_upper_right:
:arrow_double_down:
:arrow_double_up:
:arrow_down_small:
:arrow_heading_down:
:arrow_heading_up:
:leftwards_arrow_with_hook:
:arrow_right_hook:
:left_right_arrow:
:arrow_up_down:
:arrow_up_small:
:arrows_clockwise:
:arrows_counterclockwise:
:rewind:
:fast_forward:
:information_source:
:ok:
:twisted_rightwards_arrows:
:repeat:
:repeat_one:
:new:
:top:
:up:
:cool:
:free:
:ng:
:cinema:
:koko:
:signal_strength:
:u5272:
:u5408:
:u55b6:
:u6307:
:u6708:
:u6709:
:u6e80:
:u7121:
:u7533:
:u7a7a:
:u7981:
:sa:
:restroom:
:mens:
:womens:
:baby_symbol:
:no_smoking:
:parking:
:wheelchair:
:metro:
:baggage_claim:
:accept:
:wc:
:potable_water:
:put_litter_in_its_place:
:secret:
:congratulations:
:m:
:passport_control:
:left_luggage:
:customs:
:ideograph_advantage:
:cl:
:sos:
:id:
:no_entry_sign:
:underage:
:no_mobile_phones:
:do_not_litter:
:non-potable_water:
:no_bicycles:
:no_pedestrians:
:children_crossing:
:no_entry:
:eight_spoked_asterisk:
:eight_pointed_black_star:
:heart_decoration:
:vs:
:vibration_mode:
:mobile_phone_off:
:chart:
:currency_exchange:
:aries:
:taurus:
:gemini:
:cancer:
:leo:
:virgo:
:libra:
:scorpius:
:sagittarius:
:capricorn:
:aquarius:
:pisces:
:ophiuchus:
:six_pointed_star:
:negative_squared_cross_mark:
:a:
:b:
:ab:
:o2:
:diamond_shape_with_a_dot_inside:
:recycle:
:end:
:on:
:soon:
:clock1:
:clock130:
:clock10:
:clock1030:
:clock11:
:clock1130:
:clock12:
:clock1230:
:clock2:
:clock230:
:clock3:
:clock330:
:clock4:
:clock430:
:clock5:
:clock530:
:clock6:
:clock630:
:clock7:
:clock730:
:clock8:
:clock830:
:clock9:
:clock930:
:heavy_dollar_sign:
:copyright:
:registered:
:tm:
:x:
:heavy_exclamation_mark:
:bangbang:
:interrobang:
:o:
:heavy_multiplication_x:
:heavy_plus_sign:
:heavy_minus_sign:
:heavy_division_sign:
:white_flower:
:100:
:heavy_check_mark:
:ballot_box_with_check:
:radio_button:
:link:
:curly_loop:
:wavy_dash:
:part_alternation_mark:
:trident:
:black_square:
:white_square:
:white_check_mark:
:black_square_button:
:white_square_button:
:black_circle:
:white_circle:
:red_circle:
:large_blue_circle:
:large_blue_diamond:
:large_orange_diamond:
:small_blue_diamond:
:small_orange_diamond:
:small_red_triangle:
:small_red_triangle_down:
:shipit:
@@ -1,691 +0,0 @@
*vim-markdown* Vim Markdown
===============================================================================
Contents ~
1. Introduction |vim-markdown-introduction|
2. Installation |vim-markdown-installation|
3. Basic usage |vim-markdown-basic-usage|
1. Folding |vim-markdown-folding|
2. Concealing |vim-markdown-concealing|
4. Options |vim-markdown-options|
1. Disable Folding |vim-markdown-disable-folding|
2. Change fold style |vim-markdown-change-fold-style|
3. Set header folding level |vim-markdown-set-header-folding-level|
4. Disable Default Key Mappings |vim-markdown-disable-default-key-mappings|
5. Enable TOC window auto-fit |vim-markdown-enable-toc-window-auto-fit|
6. Text emphasis restriction to single-lines
|vim-markdown-text-emphasis-restriction-to-single-lines|
7. Syntax Concealing |vim-markdown-syntax-concealing|
8. Fenced code block languages |vim-markdown-fenced-code-block-languages|
9. Follow named anchors |vim-markdown-follow-named-anchors|
10. Syntax extensions |vim-markdown-syntax-extensions|
1. LaTeX math |vim-markdown-latex-math|
2. YAML Front Matter |vim-markdown-yaml-front-matter|
3. TOML Front Matter |vim-markdown-toml-front-matter|
4. JSON Front Matter |vim-markdown-json-front-matter|
5. Strikethrough |vim-markdown-strikethrough|
11. Adjust new list item indent |vim-markdown-adjust-new-list-item-indent|
12. Do not require .md extensions for Markdown links
|vim-markdown-do-not-require-.md-extensions-for-markdown-links|
13. Auto-write when following link
|vim-markdown-auto-write-when-following-link|
14. Change default file extension
|vim-markdown-change-default-file-extension|
15. Do not automatically insert bulletpoints
|vim-markdown-do-not-automatically-insert-bulletpoints|
16. Change how to open new files |vim-markdown-change-how-to-open-new-files|
5. Mappings |vim-markdown-mappings|
6. Commands |vim-markdown-commands|
7. Credits |vim-markdown-credits|
8. License |vim-markdown-license|
9. References |vim-markdown-references|
===============================================================================
*vim-markdown-introduction*
Introduction ~
Syntax highlighting, matching rules and mappings for the original Markdown [1]
and extensions.
===============================================================================
*vim-markdown-installation*
Installation ~
If you use Vundle [2], add the following lines to your '~/.vimrc':
>
Plugin 'godlygeek/tabular'
Plugin 'preservim/vim-markdown'
<
The 'tabular' plugin must come _before_ 'vim-markdown'.
Then run inside Vim:
>
:so ~/.vimrc
:PluginInstall
<
If you use Pathogen [3], do this:
>
cd ~/.vim/bundle
git clone https://github.com/preservim/vim-markdown.git
<
To install without Pathogen using the Debian vim-addon-manager [4], do this:
>
git clone https://github.com/preservim/vim-markdown.git
cd vim-markdown
sudo make install
vim-addon-manager install markdown
<
If you are not using any package manager, download the tarball [5] and do this:
>
cd ~/.vim
tar --strip=1 -zxf vim-markdown-master.tar.gz
<
===============================================================================
*vim-markdown-basic-usage*
Basic usage ~
-------------------------------------------------------------------------------
*vim-markdown-folding*
Folding ~
Folding is enabled for headers by default.
The following commands are useful to open and close folds:
*vim-markdown-zr*
- 'zr': reduces fold level throughout the buffer
*vim-markdown-zR*
- 'zR': opens all folds
*vim-markdown-zm*
- 'zm': increases fold level throughout the buffer
*vim-markdown-zM*
- 'zM': folds everything all the way
*vim-markdown-za*
- 'za': toggle a fold your cursor is on
*vim-markdown-zA*
- 'zA': toggle a fold your cursor is on recursively
*vim-markdown-zo*
- 'zo': open a fold your cursor is on
*vim-markdown-zO*
- 'zO': open a fold your cursor is on recursively
*vim-markdown-zc*
- 'zc': close a fold your cursor is on
*vim-markdown-zC*
- 'zC': close a fold your cursor is on recursively
Options are available to disable folding or change folding style.
Try ':help fold-expr' and ':help fold-commands' for details.
-------------------------------------------------------------------------------
*vim-markdown-concealing*
Concealing ~
Concealing is set for some syntax such as bold, italic, code block and link.
Concealing lets you conceal text with other text. The actual source text is not
modified. If you put your cursor on the concealed line, the conceal goes away.
Options are available to disable or change concealing.
Try ':help concealcursor' and ':help conceallevel' for details.
===============================================================================
*vim-markdown-options*
Options ~
-------------------------------------------------------------------------------
*vim-markdown-disable-folding*
Disable Folding ~
*g:vim_markdown_folding_disabled*
- 'g:vim_markdown_folding_disabled'
Add the following line to your '.vimrc' to disable the folding
configuration:
>
let g:vim_markdown_folding_disabled = 1
<
This option only controls Vim Markdown specific folding configuration.
To enable/disable folding use Vim's standard folding configuration.
>
set [no]foldenable
<
-------------------------------------------------------------------------------
*vim-markdown-change-fold-style*
Change fold style ~
*g:vim_markdown_folding_style_pythonic*
- 'g:vim_markdown_folding_style_pythonic'
To fold in a style like python-mode [6], add the following to your
'.vimrc':
>
let g:vim_markdown_folding_style_pythonic = 1
<
'g:vim_markdown_folding_level' setting (default 1) is set to 'foldlevel'.
Thus level 1 heading which is served as a document title is expanded by
default.
*g:vim_markdown_override_foldtext*
- 'g:vim_markdown_override_foldtext'
To prevent foldtext from being set add the following to your '.vimrc':
>
let g:vim_markdown_override_foldtext = 0
<
-------------------------------------------------------------------------------
*vim-markdown-set-header-folding-level*
Set header folding level ~
*g:vim_markdown_folding_level*
- 'g:vim_markdown_folding_level'
Folding level is a number between 1 and 6. By default, if not specified, it
is set to 1.
>
let g:vim_markdown_folding_level = 6
<
Tip: it can be changed on the fly with:
>
:let g:vim_markdown_folding_level = 1
:edit
<
-------------------------------------------------------------------------------
*vim-markdown-disable-default-key-mappings*
Disable Default Key Mappings ~
*g:vim_markdown_no_default_key_mappings*
- 'g:vim_markdown_no_default_key_mappings'
Add the following line to your '.vimrc' to disable default key mappings:
>
let g:vim_markdown_no_default_key_mappings = 1
<
You can also map them by yourself with '<Plug>' mappings.
-------------------------------------------------------------------------------
*vim-markdown-enable-toc-window-auto-fit*
Enable TOC window auto-fit ~
*g:vim_markdown_toc_autofit*
- 'g:vim_markdown_toc_autofit'
Allow for the TOC window to auto-fit when it's possible for it to shrink.
It never increases its default size (half screen), it only shrinks.
>
let g:vim_markdown_toc_autofit = 1
<
-------------------------------------------------------------------------------
*vim-markdown-text-emphasis-restriction-to-single-lines*
Text emphasis restriction to single-lines ~
*g:vim_markdown_emphasis_multiline*
- 'g:vim_markdown_emphasis_multiline'
By default text emphasis works across multiple lines until a closing token
is found. However, it's possible to restrict text emphasis to a single line
(i.e., for it to be applied a closing token must be found on the same
line). To do so:
>
let g:vim_markdown_emphasis_multiline = 0
<
-------------------------------------------------------------------------------
*vim-markdown-syntax-concealing*
Syntax Concealing ~
*g:vim_markdown_conceal*
- 'g:vim_markdown_conceal'
Concealing is set for some syntax.
For example, conceal '[link text](link url)' as just 'link text'. Also,
'_italic_' and '*italic*' will conceal to just _italic_. Similarly
'__bold__', '**bold**', '___italic bold___', and '***italic bold***' will
conceal to just **bold**, **bold**, **_italic bold_**, and **_italic
bold_** respectively.
To enable conceal use Vim's standard conceal configuration.
>
set conceallevel=2
<
To disable conceal regardless of 'conceallevel' setting, add the following
to your '.vimrc':
>
let g:vim_markdown_conceal = 0
<
To disable math conceal with LaTeX math syntax enabled, add the following
to your '.vimrc':
>
let g:tex_conceal = ""
let g:vim_markdown_math = 1
<
*g:vim_markdown_conceal_code_blocks*
- 'g:vim_markdown_conceal_code_blocks'
Disabling conceal for code fences requires an additional setting:
>
let g:vim_markdown_conceal_code_blocks = 0
<
-------------------------------------------------------------------------------
*vim-markdown-fenced-code-block-languages*
Fenced code block languages ~
*g:vim_markdown_fenced_languages*
- 'g:vim_markdown_fenced_languages'
You can use filetype name as fenced code block languages for syntax
highlighting. If you want to use different name from filetype, you can add
it in your '.vimrc' like so:
>
let g:vim_markdown_fenced_languages = ['csharp=cs']
<
This will cause the following to be highlighted using the 'cs' filetype
syntax.
>
```csharp
...
```
<
Default is "['c++=cpp', 'viml=vim', 'bash=sh', 'ini=dosini']".
-------------------------------------------------------------------------------
*vim-markdown-follow-named-anchors*
Follow named anchors ~
*g:vim_markdown_follow_anchor*
- 'g:vim_markdown_follow_anchor'
This feature allows the 'ge' command to follow named anchors in links of
the form 'file#anchor' or just '#anchor', where file may omit the '.md'
extension as usual. Two variables control its operation:
>
let g:vim_markdown_follow_anchor = 1
<
This tells vim-markdown whether to attempt to follow a named anchor in a
link or not. When it is 1, and only if a link can be split in two parts by
the pattern '#', then the first part is interpreted as the file and the
second one as the named anchor. This also includes urls of the form
'#anchor', for which the first part is considered empty, meaning that the
target file is the current one. After the file is opened, the anchor will
be searched.
Default is '0'.
*g:vim_markdown_anchorexpr*
- 'g:vim_markdown_anchorexpr'
>
let g:vim_markdown_anchorexpr = "'<<'.v:anchor.'>>'"
<
This expression will be evaluated substituting 'v:anchor' with a quoted
string that contains the anchor to visit. The result of the evaluation will
become the real anchor to search in the target file. This is useful in
order to convert anchors of the form, say, 'my-section-title' to searches
of the form 'My Section Title' or '<<my-section-title>>'.
Default is "''".
-------------------------------------------------------------------------------
*vim-markdown-syntax-extensions*
Syntax extensions ~
The following options control which syntax extensions will be turned on. They
are off by default.
-------------------------------------------------------------------------------
*vim-markdown-latex-math*
LaTeX math ~
*g:vim_markdown_math*
- 'g:vim_markdown_math'
Used as '$x^2$', '$$x^2$$', escapable as '\$x\$' and '\$\$x\$\$'.
>
let g:vim_markdown_math = 1
<
-------------------------------------------------------------------------------
*vim-markdown-yaml-front-matter*
YAML Front Matter ~
*g:vim_markdown_frontmatter*
- 'g:vim_markdown_frontmatter'
Highlight YAML front matter as used by Jekyll or Hugo [7].
>
let g:vim_markdown_frontmatter = 1
<
-------------------------------------------------------------------------------
*vim-markdown-toml-front-matter*
TOML Front Matter ~
*g:vim_markdown_toml_frontmatter*
- 'g:vim_markdown_toml_frontmatter'
Highlight TOML front matter as used by Hugo [7].
TOML syntax highlight requires vim-toml [8].
>
let g:vim_markdown_toml_frontmatter = 1
<
-------------------------------------------------------------------------------
*vim-markdown-json-front-matter*
JSON Front Matter ~
*g:vim_markdown_json_frontmatter*
- 'g:vim_markdown_json_frontmatter'
Highlight JSON front matter as used by Hugo [7].
JSON syntax highlight requires vim-json [9].
>
let g:vim_markdown_json_frontmatter = 1
<
-------------------------------------------------------------------------------
*vim-markdown-strikethrough*
Strikethrough ~
*g:vim_markdown_strikethrough*
- 'g:vim_markdown_strikethrough'
Strikethrough uses two tildes. '~~Scratch this.~~'
>
let g:vim_markdown_strikethrough = 1
<
-------------------------------------------------------------------------------
*vim-markdown-adjust-new-list-item-indent*
Adjust new list item indent ~
*g:vim_markdown_new_list_item_indent*
- 'g:vim_markdown_new_list_item_indent'
You can adjust a new list indent. For example, you insert a single line
like below:
>
* item1
<
Then if you type 'o' to insert new line in vim and type '* item2', the
result will be:
>
* item1
* item2
<
vim-markdown automatically insert the indent. By default, the number of
spaces of indent is 4. If you'd like to change the number as 2, just write:
>
let g:vim_markdown_new_list_item_indent = 2
<
-------------------------------------------------------------------------------
*vim-markdown-do-not-require-.md-extensions-for-markdown-links*
Do not require .md extensions for Markdown links ~
*g:vim_markdown_no_extensions_in_markdown*
- 'g:vim_markdown_no_extensions_in_markdown'
If you want to have a link like this '[link text](link-url)' and follow it
for editing in vim using the 'ge' command, but have it open the file "link-
url.md" instead of the file "link-url", then use this option:
>
let g:vim_markdown_no_extensions_in_markdown = 1
<
This is super useful for GitLab and GitHub wiki repositories.
Normal behaviour would be that vim-markup required you to do this '[link
text](link-url.md)', but this is not how the Gitlab and GitHub wiki
repositories work. So this option adds some consistency between the two.
-------------------------------------------------------------------------------
*vim-markdown-auto-write-when-following-link*
Auto-write when following link ~
*g:vim_markdown_autowrite*
- 'g:vim_markdown_autowrite'
If you follow a link like this '[link text](link-url)' using the 'ge'
shortcut, this option will automatically save any edits you made before
moving you:
>
let g:vim_markdown_autowrite = 1
<
-------------------------------------------------------------------------------
*vim-markdown-change-default-file-extension*
Change default file extension ~
*g:vim_markdown_auto_extension_ext*
- 'g:vim_markdown_auto_extension_ext'
If you would like to use a file extension other than '.md' you may do so
using the 'vim_markdown_auto_extension_ext' variable:
>
let g:vim_markdown_auto_extension_ext = 'txt'
<
-------------------------------------------------------------------------------
*vim-markdown-do-not-automatically-insert-bulletpoints*
Do not automatically insert bulletpoints ~
*g:vim_markdown_auto_insert_bullets*
- 'g:vim_markdown_auto_insert_bullets'
Automatically inserting bulletpoints can lead to problems when wrapping
text (see issue #232 for details), so it can be disabled:
>
let g:vim_markdown_auto_insert_bullets = 0
<
In that case, you probably also want to set the new list item indent to 0
as well, or you will have to remove an indent each time you add a new list
item:
>
let g:vim_markdown_new_list_item_indent = 0
<
-------------------------------------------------------------------------------
*vim-markdown-change-how-to-open-new-files*
Change how to open new files ~
*g:vim_markdown_edit_url_in*
- 'g:vim_markdown_edit_url_in'
By default when following a link the target file will be opened in your
current buffer. This behavior can change if you prefer using splits or tabs
by using the 'vim_markdown_edit_url_in' variable. Possible values are
'tab', 'vsplit', 'hsplit', 'current' opening in a new tab, vertical split,
horizontal split, and current buffer respectively. Defaults to current
buffer if not set:
>
let g:vim_markdown_edit_url_in = 'tab'
<
-------------------------------------------------------------------------------
*vim-markdown-support-borderless-tables*
Support borderless tables ~
*g:vim_markdown_borderless_table*
- 'g:vim_markdown_borderless_table'
Add support for borderless tables, such as:
>
header 1|header 2
--|--
data 1|data 2
<
if set to 1:
>
let g:vim_markdown_borderless_table = 1
<
the table would be formatted as usual:
>
| header 1 | header 2 |
|----------|----------|
| data 1 | data 2 |
<
===============================================================================
*vim-markdown-mappings*
Mappings ~
The following work on normal and visual modes:
*vim-markdown-gx*
- 'gx': open the link under the cursor in the same browser as the standard
'gx' command. '<Plug>Markdown_OpenUrlUnderCursor'
The standard 'gx' is extended by allowing you to put your cursor anywhere
inside a link.
For example, all the following cursor positions will work:
>
[Example](http://example.com)
^ ^ ^^ ^ ^
1 2 34 5 6
<http://example.com>
^ ^ ^
1 2 3
<
Known limitation: does not work for links that span multiple lines.
*vim-markdown-ge*
- 'ge': open the link under the cursor in Vim for editing. Useful for
relative markdown links. '<Plug>Markdown_EditUrlUnderCursor'
The rules for the cursor position are the same as the 'gx' command.
*vim-markdown-]]*
- ']]': go to next header. '<Plug>Markdown_MoveToNextHeader'
*vim-markdown-[[*
- '[[': go to previous header. Contrast with ']h'.
'<Plug>Markdown_MoveToPreviousHeader'
*vim-markdown-][*
- '][': go to next sibling header if any.
'<Plug>Markdown_MoveToNextSiblingHeader'
*vim-markdown-[]*
- '[]': go to previous sibling header if any.
'<Plug>Markdown_MoveToPreviousSiblingHeader'
*vim-markdown-]h*
- ']h': go to Current header. '<Plug>Markdown_MoveToCurHeader'
*vim-markdown-]u*
- ']u': go to parent header (Up). '<Plug>Markdown_MoveToParentHeader'
This plugin follows the recommended Vim plugin mapping interface, so to change
the map ']u' to 'asdf', add to your '.vimrc':
>
map asdf <Plug>Markdown_MoveToParentHeader
<
To disable a map use:
>
map <Plug> <Plug>Markdown_MoveToParentHeader
<
===============================================================================
*vim-markdown-commands*
Commands ~
The following requires ':filetype plugin on'.
*:HeaderDecrease*
- ':HeaderDecrease':
Decrease level of all headers in buffer: 'h2' to 'h1', 'h3' to 'h2', etc.
If range is given, only operate in the range.
If an 'h1' would be decreased, abort.
For simplicity of implementation, Setex headers are converted to Atx.
*:HeaderIncrease*
- ':HeaderIncrease': Analogous to ':HeaderDecrease', but increase levels
instead.
*:SetexToAtx*
- ':SetexToAtx':
Convert all Setex style headers in buffer to Atx.
If a range is given, e.g. hit ':' from visual mode, only operate on the
range.
*:TableFormat*
- ':TableFormat': Format the table under the cursor like this [10].
Requires Tabular [11].
The input table _must_ already have a separator line as the second line of
the table. That line only needs to contain the correct pipes '|', nothing
else is required.
*:Toc*
- ':Toc': create a quickfix vertical window navigable table of contents with
the headers.
Hit '<Enter>' on a line to jump to the corresponding line of the markdown
file.
*:Toch*
- ':Toch': Same as ':Toc' but in an horizontal window.
*:Toct*
- ':Toct': Same as ':Toc' but in a new tab.
*:Tocv*
- ':Tocv': Same as ':Toc' for symmetry with ':Toch' and ':Tocv'.
===============================================================================
*vim-markdown-credits*
Credits ~
The main contributors of vim-markdown are:
- **Ben Williams** (A.K.A. **plasticboy**). The original developer of vim-
markdown. Homepage [12].
If you feel that your name should be on this list, please make a pull request
listing your contributions.
===============================================================================
*vim-markdown-license*
License ~
The MIT License (MIT)
Copyright (c) 2012 Benjamin D. Williams
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
===============================================================================
*vim-markdown-references*
References ~
[1] http://daringfireball.net/projects/markdown/
[2] https://github.com/gmarik/vundle
[3] https://github.com/tpope/vim-pathogen
[4] http://packages.qa.debian.org/v/vim-addon-manager.html
[5] https://github.com/preservim/vim-markdown/archive/master.tar.gz
[6] https://github.com/klen/python-mode
[7] https://gohugo.io/content/front-matter/
[8] https://github.com/cespare/vim-toml
[9] https://github.com/elzr/vim-json
[10] http://www.cirosantilli.com/markdown-style-guide/#tables
[11] https://github.com/godlygeek/tabular
[12] http://plasticboy.com/
vim: ft=help
@@ -1,8 +1 @@
if !has('patch-7.4.480')
" Before this patch, vim used modula2 for .md.
au! filetypedetect BufRead,BufNewFile *.md
endif
" vint: -ProhibitAutocmdWithNoGroup
au BufRead,BufNewFile *.{md,mdx,mdown,mkd,mkdn,markdown,mdwn} setfiletype markdown
au BufRead,BufNewFile *.{md,mdx,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx} setfiletype markdown
au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} set filetype=markdown
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 699 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

@@ -1,75 +0,0 @@
if exists('b:did_indent') | finish | endif
let b:did_indent = 1
setlocal indentexpr=GetMarkdownIndent()
setlocal nolisp
setlocal autoindent
" Automatically continue blockquote on line break
setlocal formatoptions+=r
setlocal comments=b:>
if get(g:, 'vim_markdown_auto_insert_bullets', 1)
" Do not automatically insert bullets when auto-wrapping with text-width
setlocal formatoptions-=c
" Accept various markers as bullets
setlocal comments+=b:*,b:+,b:-
endif
" Only define the function once
if exists('*GetMarkdownIndent') | finish | endif
function! s:IsMkdCode(lnum)
let name = synIDattr(synID(a:lnum, 1, 0), 'name')
return (name =~# '^mkd\%(Code$\|Snippet\)' || name !=# '' && name !~? '^\%(mkd\|html\)')
endfunction
function! s:IsLiStart(line)
return a:line !~# '^ *\([*-]\)\%( *\1\)\{2}\%( \|\1\)*$' &&
\ a:line =~# '^\s*[*+-] \+'
endfunction
function! s:IsHeaderLine(line)
return a:line =~# '^\s*#'
endfunction
function! s:IsBlankLine(line)
return a:line =~# '^$'
endfunction
function! s:PrevNonBlank(lnum)
let i = a:lnum
while i > 1 && s:IsBlankLine(getline(i))
let i -= 1
endwhile
return i
endfunction
function GetMarkdownIndent()
if v:lnum > 2 && s:IsBlankLine(getline(v:lnum - 1)) && s:IsBlankLine(getline(v:lnum - 2))
return 0
endif
let list_ind = get(g:, 'vim_markdown_new_list_item_indent', 4)
" Find a non-blank line above the current line.
let lnum = s:PrevNonBlank(v:lnum - 1)
" At the start of the file use zero indent.
if lnum == 0 | return 0 | endif
let ind = indent(lnum)
let line = getline(lnum) " Last line
let cline = getline(v:lnum) " Current line
if s:IsLiStart(cline)
" Current line is the first line of a list item, do not change indent
return indent(v:lnum)
elseif s:IsHeaderLine(cline) && !s:IsMkdCode(v:lnum)
" Current line is the header, do not indent
return 0
elseif s:IsLiStart(line)
if s:IsMkdCode(lnum)
return ind
else
" Last line is the first line of a list item, increase indent
return ind + list_ind
end
else
return ind
endif
endfunction
@@ -1,9 +0,0 @@
addon: markdown
description: "Markdown syntax highlighting"
files:
- ftdetect/markdown.vim
- ftplugin/markdown.vim
- syntax/markdown.vim
- after/ftplugin/markdown.vim
- indent/markdown.vim
- doc/vim-markdown.txt
@@ -0,0 +1,47 @@
require_relative "spec_helper"
describe "autoformatting" do
let(:filename) { "autoformatting.md" }
it "should format long item lists" do
before = <<-EOF.gsub /^ /, ""
* long long long long long long long long long long long long long long long long long long long long long long long long
EOF
# I don't know why but the interaction with vimrunner inserts a couple of
# stars at the end
expected = <<-EOF.gsub /^ /, ""
* long long long long long long long long long long long long long long long
long long long long long long long long long
*
*
EOF
given_content before do |source|
vim.command "set textwidth=80"
vim.normal "gggqq"
vim.write
expect(File.read(source)).to eql(expected)
end
end
it "should create new list items" do
before = <<-EOF.gsub /^ /, ""
* item
EOF
# I don't know why but the interaction with vimrunner inserts a couple of
# stars at the end
expected = <<-EOF.gsub /^ /, ""
* item
*
*
EOF
given_content before do |source|
vim.normal "ggA"
vim.type "<CR>"
vim.write
given = File.read(source).gsub /[ ]+$/, ""
expect(given).to eql(expected)
end
end
end
@@ -0,0 +1,31 @@
require_relative "spec_helper"
describe "change header level" do
let(:filename) { "headers.md" }
it "should increase header of level 1 to level 2" do
given_content "# Header" do |source|
vim.command "call markdown#SwitchStatus()"
vim.write
expect(source).to have_content("## Header")
end
end
it "should increase header of level 3 to level 4" do
given_content "### Header" do |source|
vim.command "call markdown#SwitchStatus()"
vim.write
expect(source).to have_content("#### Header")
end
end
it "should go back to level 1 after level 6" do
given_content "###### Header" do |source|
vim.command "call markdown#SwitchStatus()"
vim.write
expect(source).to have_content("# Header")
end
end
end
@@ -0,0 +1,34 @@
require_relative "spec_helper"
describe "change list items" do
let(:filename) { "list_items.md" }
["*", "+", "-"].each do |symbol|
it "should change from simple list (#{symbol}) to check list unchecked" do
given_content "#{symbol} item" do |source|
vim.command "call markdown#SwitchStatus()"
vim.write
expect(File.read(source)).to eql("#{symbol} [ ] item\n")
end
end
it "should change from check list unchecked (#{symbol}) to check list checked" do
given_content "#{symbol} [ ] item" do |source|
vim.command "call markdown#SwitchStatus()"
vim.write
expect(File.read(source)).to eql("#{symbol} [x] item\n")
end
end
it "should change from check list checked (#{symbol}) to simple list" do
given_content "#{symbol} [x] item" do |source|
vim.command "call markdown#SwitchStatus()"
vim.write
expect(File.read(source)).to eql("#{symbol} item\n")
end
end
end
end
@@ -0,0 +1,28 @@
URL like http://google.com gets auto linked
URL may contain punctuation http://example.com/foo,bar,baz
URL may be preceded by punctuation !http://example.com/foo,bar,baz so the exclamation point is not part of the URL
URL are terminated by punctuation so http://example.com/foo, the comma is not part of the URL
URL may contain parenthesis http://example.com/(foo)?foo[1]=bar&foo[2]=baz
URL may be surrounded by parenthesis (http://example.com/foo) but parenthesis are not part of the URL
URL may terminate with parenthesis http://example.com/foo()
URL may be surrounded by parenthesis (http://example.com/foo()) but the surrounding parenthesis are not part of the URL
Email addresses bill@microsoft.com get auto linked
Path are supported /clean/code/that/works but they must be preceded by a non work because this /is a path and this/is not a path
Pull requests and issues are linked #42
could be preceded by symbols \#42
could not be preceded by letters a#42 or numbers 3#42
Reference to other users are linked @gabrielelana
could be preceded by symbols \@gabrielelana
could not be preceded by letters a@gabrielelana or numbers 3@gabrielelana
@@ -0,0 +1,59 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/autolinks.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Underlined { color: #c000c0; text-decoration: underline; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
URL like <span class="Underlined"><a href="http://google.com">http://google.com</a></span> gets auto linked
URL may contain punctuation <span class="Underlined"><a href="http://example.com/foo,bar,baz">http://example.com/foo,bar,baz</a></span>
URL may be preceded by punctuation !<span class="Underlined"><a href="http://example.com/foo,bar,baz">http://example.com/foo,bar,baz</a></span> so the exclamation point is not part of the URL
URL are terminated by punctuation so <span class="Underlined"><a href="http://example.com/foo">http://example.com/foo</a></span>, the comma is not part of the URL
URL may contain parenthesis <span class="Underlined"><a href="http://example.com/(foo)?foo[1]=bar&amp;foo[2]=baz">http://example.com/(foo)?foo[1]=bar&amp;foo[2]=baz</a></span>
URL may be surrounded by parenthesis (<span class="Underlined"><a href="http://example.com/foo">http://example.com/foo</a></span>) but parenthesis are not part of the URL
URL may terminate with parenthesis <span class="Underlined"><a href="http://example.com/foo()">http://example.com/foo()</a></span>
URL may be surrounded by parenthesis (<span class="Underlined"><a href="http://example.com/foo()">http://example.com/foo()</a></span>) but the surrounding parenthesis are not part of the URL
Email addresses <span class="Underlined">bill@microsoft.com</span> get auto linked
Path are supported <span class="Underlined">/clean/code/that/works</span> but they must be preceded by a non work because this <span class="Underlined">/is</span> a path and this/is not a path
Pull requests and issues are linked <span class="Underlined">#42</span>
could be preceded by symbols \<span class="Underlined">#42</span>
could not be preceded by letters a#42 or numbers 3#42
Reference to other users are linked <span class="Underlined">@gabrielelana</span>
could be preceded by symbols \<span class="Underlined">@gabrielelana</span>
could not be preceded by letters a@gabrielelana or numbers 3@gabrielelana
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,22 @@
> This is a blockquote
> This is a blockquote even if the angle bracket is not at the beginning of the line
> This is a single
> blockquote even if it
> spans a few lines
> This is a single
blockquote, you can put the angle bracket
jnly at the first line of the paragraph and
the all the paragraph is a blockquote
This is not a blockquote because it's another paragraph
>
This is not a blockquote because the first line, the line with the angle bracket, must not be empty
>
This is a blockquote because the first line, the line with the angle bracket, is not empty, in this case contains a single space
And again, this is not a blockquote because is another paragraph
@@ -0,0 +1,54 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/blockquotes.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Comment { color: #0000c0; }
.Special { color: #c000c0; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Special">&gt; </span><span class="Comment">This is a blockquote</span>
<span class="Special"> &gt; </span><span class="Comment">This is a blockquote even if the angle bracket is not at the beginning of the line</span>
<span class="Special">&gt; </span><span class="Comment">This is a single</span>
<span class="Special">&gt; </span><span class="Comment">blockquote even if it</span>
<span class="Special">&gt; </span><span class="Comment">spans a few lines</span>
<span class="Special">&gt; </span><span class="Comment">This is a single</span>
<span class="Comment">blockquote, you can put the angle bracket</span>
<span class="Comment">jnly at the first line of the paragraph and</span>
<span class="Comment">the all the paragraph is a blockquote</span>
This is not a blockquote because it's another paragraph
&gt;
This is not a blockquote because the first line, the line with the angle bracket, must not be empty
<span class="Special">&gt; </span>
<span class="Comment">This is a blockquote because the first line, the line with the angle bracket, is not empty, in this case contains a single space</span>
And again, this is not a blockquote because is another paragraph
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,16 @@
> First level blockquote
> > Second level blockquote
>> Second level blockquote
> > > Third level blockquote
>>> Third level blockquote
> # Nested elements problem
> Nested elements inside blockquotes and other elements could be very problematic
>
> ## A conscious choice
> I chose to not highlight nested elements because:
> * things could get really nasty in the syntax definition
> * the end result could get confusing for the user (ex. No difference in the highlight between an headline inside and outside a blockquote)
>
> ## An alternative solution
> MdEditBlock will open the next level of the Blockquote block under cursor in a scratch buffer with a markdown syntax highlight
@@ -0,0 +1,48 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/blockquotes_nested.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Comment { color: #0000c0; }
.Special { color: #c000c0; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Special">&gt; </span><span class="Comment">First level blockquote</span>
<span class="Special">&gt; &gt; </span><span class="Comment">Second level blockquote</span>
<span class="Special">&gt;&gt; </span><span class="Comment">Second level blockquote</span>
<span class="Special">&gt; &gt; &gt; </span><span class="Comment">Third level blockquote</span>
<span class="Special">&gt;&gt;&gt; </span><span class="Comment">Third level blockquote</span>
<span class="Special">&gt; </span><span class="Comment"># Nested elements problem</span>
<span class="Special">&gt; </span><span class="Comment">Nested elements inside blockquotes and other elements could be very problematic</span>
<span class="Special">&gt;</span>
<span class="Special">&gt; </span><span class="Comment">## A conscious choice</span>
<span class="Special">&gt; </span><span class="Comment">I chose to not highlight nested elements because:</span>
<span class="Special">&gt; </span><span class="Comment">* things could get really nasty in the syntax definition</span>
<span class="Special">&gt; </span><span class="Comment">* the end result could get confusing for the user (ex. No difference in the highlight between an headline inside and outside a blockquote)</span>
<span class="Special">&gt;</span>
<span class="Special">&gt; </span><span class="Comment">## An alternative solution</span>
<span class="Special">&gt; </span><span class="Comment">MdEditBlock will open the next level of the Blockquote block under cursor in a scratch buffer with a markdown syntax highlight</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,76 @@
This is inline `code` with a single back tick
This is inline ``code`` with double back ticks
This is inline ```code``` with triple back ticks. This is not standard Markdown but Github supports it and so do we. Actually Github allows an arbitrary number of backs ticks around inline `````codeblocks````` the only constraint is that they should be ```even```` the remainder, in this case the last back tick, should not be highlighted
The following is a generic block code with a triple tick
```
code
```
The following is a fenced block code with a triple tick
```js
var foo = 'bar'
```
A fenced code block must have at least 3 back ticks in the start delimiter but could have more
````````ruby
foo = 'bar' if foo.empty?
```
A fenced code block must have at least 3 back ticks in the end delimiter but could have more
```ruby
foo = 'bar' if foo.empty?
````````
A fenced code block could have at most 3 leading spaces in the start delimiter
```ruby
foo = 'bar' if foo.empty?
```
A fenced code block could have at most 3 leading spaces in the end delimiter
```ruby
foo = 'bar' if foo.empty?
```
A fenced code block could have at most 3 leading spaces in the start and in the end delimiter
```ruby
foo = 'bar' if foo.empty?
```
this is a code block because it's indented with 4 spaces
this should be a continuation
This line separates two blocks
this is a code block because it's indented with a \t
this should be a continuation
The following is not standard Markdown, officially it's not the Github Flavored Markdown either, it's inspired by the Kramdown Flavored Markdown. Even if not documented Github supports it and so do we
~~~ruby
foo = 'bar' if foo.empty?
~~~
~~~~~~~~ruby
foo = 'bar' if foo.empty?
~~~
~~~ruby
foo = 'bar' if foo.empty?
~~~~~~~~
~~~ruby
foo = 'bar' if foo.empty?
~~~
~~~ruby
foo = 'bar' if foo.empty?
~~~
~~~ruby
foo = 'bar' if foo.empty?
~~~
@@ -0,0 +1,108 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/codeblocks.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Constant { color: #c00000; }
.Special { color: #c000c0; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
This is inline <span class="Special">`</span><span class="Constant">code</span><span class="Special">`</span> with a single back tick
This is inline <span class="Special">``</span><span class="Constant">code</span><span class="Special">``</span> with double back ticks
This is inline <span class="Special">```</span><span class="Constant">code</span><span class="Special">```</span> with triple back ticks. This is not standard Markdown but Github supports it and so do we. Actually Github allows an arbitrary number of backs ticks around inline <span class="Special">`````</span><span class="Constant">codeblocks</span><span class="Special">`````</span> the only constraint is that they should be <span class="Special">```</span><span class="Constant">even</span><span class="Special">```</span>` the remainder, in this case the last back tick, should not be highlighted
The following is a generic block code with a triple tick
<span class="Special">```</span>
<span class="Constant">code</span>
<span class="Special">```</span>
The following is a fenced block code with a triple tick
<span class="Special">```js</span>
<span class="Constant">var foo = 'bar'</span>
<span class="Special">```</span>
A fenced code block must have at least 3 back ticks in the start delimiter but could have more
<span class="Special">````````ruby</span>
<span class="Constant">foo = 'bar' if foo.empty?</span>
<span class="Special">```</span>
A fenced code block must have at least 3 back ticks in the end delimiter but could have more
<span class="Special">```ruby</span>
<span class="Constant">foo = 'bar' if foo.empty?</span>
<span class="Special">````````</span>
A fenced code block could have at most 3 leading spaces in the start delimiter
<span class="Special"> ```ruby</span>
<span class="Constant">foo = 'bar' if foo.empty?</span>
<span class="Special">```</span>
A fenced code block could have at most 3 leading spaces in the end delimiter
<span class="Special">```ruby</span>
<span class="Constant">foo = 'bar' if foo.empty?</span>
<span class="Special"> ```</span>
A fenced code block could have at most 3 leading spaces in the start and in the end delimiter
<span class="Special"> ```ruby</span>
<span class="Constant">foo = 'bar' if foo.empty?</span>
<span class="Special"> ```</span>
<span class="Constant"> this is a code block because it's indented with 4 spaces</span>
<span class="Constant"> this should be a continuation</span>
This line separates two blocks
<span class="Constant"> this is a code block because it's indented with a \t</span>
<span class="Constant"> this should be a continuation</span>
The following is not standard Markdown, officially it's not the Github Flavored Markdown either, it's inspired by the Kramdown Flavored Markdown. Even if not documented Github supports it and so do we
<span class="Special">~~~ruby</span>
<span class="Constant">foo = 'bar' if foo.empty?</span>
<span class="Special">~~~</span>
<span class="Special">~~~~~~~~ruby</span>
<span class="Constant">foo = 'bar' if foo.empty?</span>
<span class="Special">~~~</span>
<span class="Special">~~~ruby</span>
<span class="Constant">foo = 'bar' if foo.empty?</span>
<span class="Special">~~~~~~~~</span>
<span class="Special"> ~~~ruby</span>
<span class="Constant">foo = 'bar' if foo.empty?</span>
<span class="Special">~~~</span>
<span class="Special">~~~ruby</span>
<span class="Constant">foo = 'bar' if foo.empty?</span>
<span class="Special"> ~~~</span>
<span class="Special"> ~~~ruby</span>
<span class="Constant">foo = 'bar' if foo.empty?</span>
<span class="Special"> ~~~</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,8 @@
___foo___ must be both highlighted as italic and bold
***foo*** must be both highlighted as italic and bold
**_foo_** must be both highlighted as italic and bold
__*foo*__ must be both highlighted as italic and bold
@@ -0,0 +1,40 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/combined_emphasis.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Special { color: #c000c0; }
.BoldItalic { font-weight: bold; font-style: italic; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Special">___</span><span class="BoldItalic">foo</span><span class="Special">___</span> must be both highlighted as italic and bold
<span class="Special">***</span><span class="BoldItalic">foo</span><span class="Special">***</span> must be both highlighted as italic and bold
<span class="Special">**_</span><span class="BoldItalic">foo</span><span class="Special">_**</span> must be both highlighted as italic and bold
<span class="Special">__*</span><span class="BoldItalic">foo</span><span class="Special">*__</span> must be both highlighted as italic and bold
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,12 @@
# This is an header that _contains_ *weak* highlighed elements
# This is an header that __contains__ **strong** highlighed elements
## This is an header that __*contains*__ **_strong_** emphasis elements
This is also an header that _contains_ *weak* highlighed elements
=================================================================
This is an header that __contains__ **strong** highlighed elements
------------------------------------------------------------------
@@ -0,0 +1,47 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/contained_emphasis.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Bold { font-weight: bold; }
.Title { color: #c000c0; }
.Italic { font-style: italic; }
.Special { color: #c000c0; }
.BoldItalic { font-weight: bold; font-style: italic; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Special">#</span><span class="Title"> This is an header that </span><span class="Special">_</span><span class="Italic">contains</span><span class="Special">_</span><span class="Title"> </span><span class="Special">*</span><span class="Italic">weak</span><span class="Special">*</span><span class="Title"> highlighed elements</span>
<span class="Special">#</span><span class="Title"> This is an header that </span><span class="Special">__</span><span class="Bold">contains</span><span class="Special">__</span><span class="Title"> </span><span class="Special">**</span><span class="Bold">strong</span><span class="Special">**</span><span class="Title"> highlighed elements</span>
<span class="Special">##</span><span class="Title"> This is an header that </span><span class="Special">__*</span><span class="BoldItalic">contains</span><span class="Special">*__</span><span class="Title"> </span><span class="Special">**_</span><span class="BoldItalic">strong</span><span class="Special">_**</span><span class="Title"> emphasis elements</span>
<span class="Title">This is also an header that </span><span class="Special">_</span><span class="Italic">contains</span><span class="Special">_</span><span class="Title"> </span><span class="Special">*</span><span class="Italic">weak</span><span class="Special">*</span><span class="Title"> highlighed elements</span>
<span class="Special">=================================================================</span>
<span class="Title">This is an header that </span><span class="Special">__</span><span class="Bold">contains</span><span class="Special">__</span><span class="Title"> </span><span class="Special">**</span><span class="Bold">strong</span><span class="Special">**</span><span class="Title"> highlighed elements</span>
<span class="Special">------------------------------------------------------------------</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,35 @@
# One
## Two
### Three
#### Four
##### Five
###### Six
# One with closing hash #
## Two with closing hash #
### Three with closing hash #
#### Four with closing hash #
##### Five with closing hash #
###### Six with closing hash #
# Can have multiple closing hashes #####
# An hash in the middle # have no special meaning
# This should not be an header because the hash should be the first character in the line
This is # not an header, this is a normal paragraph and the hash must not be considered a delimiter
####### Seven hashes is an `H6` that begins with an hash character for Dingus but for Github those are seven hashes, an header must have a mandatory space before any character
######This is not an header on Github because it lacks the mandatory white space between the hashes (delimiter) and the first character of the header
@@ -0,0 +1,68 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/headers_atx.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Title { color: #c000c0; }
.Constant { color: #c00000; }
.Special { color: #c000c0; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Special">#</span><span class="Title"> One</span>
<span class="Special">##</span><span class="Title"> Two</span>
<span class="Special">###</span><span class="Title"> Three</span>
<span class="Special">####</span><span class="Title"> Four</span>
<span class="Special">#####</span><span class="Title"> Five</span>
<span class="Special">######</span><span class="Title"> Six</span>
<span class="Special">#</span><span class="Title"> One with closing hash </span><span class="Special">#</span>
<span class="Special">##</span><span class="Title"> Two with closing hash </span><span class="Special">#</span>
<span class="Special">###</span><span class="Title"> Three with closing hash </span><span class="Special">#</span>
<span class="Special">####</span><span class="Title"> Four with closing hash </span><span class="Special">#</span>
<span class="Special">#####</span><span class="Title"> Five with closing hash </span><span class="Special">#</span>
<span class="Special">######</span><span class="Title"> Six with closing hash </span><span class="Special">#</span>
<span class="Special">#</span><span class="Title"> Can have multiple closing hashes </span><span class="Special">#####</span>
<span class="Special">#</span><span class="Title"> An hash in the middle # have no special meaning</span>
# This should not be an header because the hash should be the first character in the line
This is # not an header, this is a normal paragraph and the hash must not be considered a delimiter
####### Seven hashes is an <span class="Special">`</span><span class="Constant">H6</span><span class="Special">`</span> that begins with an hash character for Dingus but for Github those are seven hashes, an header must have a mandatory space before any character
######This is not an header on Github because it lacks the mandatory white space between the hashes (delimiter) and the first character of the header
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,24 @@
H1 Header
=========
H2 Header
---------
H1 Header, underline could be of any length
=
H2 Header, underline could be of any length
-
H1 Header, underline could be of any length
=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
H2 Header, underline could be of any length
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This is not an header because the underline must begin at the beginnning of the line
=
This is not an header because the underline must begin at the beginnning of the line
.=
@@ -0,0 +1,56 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/headers_setext.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Title { color: #c000c0; }
.Special { color: #c000c0; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Title">H1 Header</span>
<span class="Special">=========</span>
<span class="Title">H2 Header</span>
<span class="Special">---------</span>
<span class="Title">H1 Header, underline could be of any length</span>
<span class="Special">=</span>
<span class="Title">H2 Header, underline could be of any length</span>
<span class="Special">-</span>
<span class="Title">H1 Header, underline could be of any length</span>
<span class="Special">=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================</span>
<span class="Title">H2 Header, underline could be of any length</span>
<span class="Special">---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</span>
This is not an header because the underline must begin at the beginnning of the line
=
This is not an header because the underline must begin at the beginnning of the line
.=
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,30 @@
The following are all horizontal rules
***
---
___
*********************
---------------------
_____________________
- - -
_ _ _
* * *
- - -
Now a special case
---
The line before is an horizontal rule
This is however is a title
---
@@ -0,0 +1,29 @@
<div>
This is a <span>block</span> of html
</div>
<!--
This is a comment
-->
<a href="http://example.com" title="This is an empty element" />
<a href="http://example.com"/>
<br />
This is normal text
* XML <i>element</i> in a list item
# XML <i>element</i> in an header
<div id="container">
XML/HTML could not contain *everything*
Like code blocks
* Or
* List
* Items
</div>
@@ -0,0 +1,62 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/inline_html.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.NonText { color: #8080ff; }
.Title { color: #c000c0; }
.Special { color: #c000c0; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="NonText">&lt;div&gt;</span>
<span class="NonText"> This is a &lt;span&gt;block&lt;/span&gt; of html</span>
<span class="NonText">&lt;/div&gt;</span>
<span class="NonText">&lt;!--</span>
<span class="NonText"> This is a comment</span>
<span class="NonText">--&gt;</span>
<span class="NonText">&lt;a href=&quot;<a href="http://example.com">http://example.com</a>&quot; title=&quot;This is an empty element&quot; /&gt;</span>
<span class="NonText">&lt;a href=&quot;<a href="http://example.com">http://example.com</a>&quot;/&gt;</span>
<span class="NonText">&lt;br /&gt;</span>
This is normal text
<span class="Special">* </span>XML <span class="NonText">&lt;i&gt;element&lt;/i&gt;</span> in a list item
<span class="Special">#</span><span class="Title"> XML </span><span class="NonText">&lt;i&gt;element&lt;/i&gt;</span><span class="Title"> in an header</span>
<span class="NonText">&lt;div id=&quot;container&quot;&gt;</span>
<span class="NonText">XML/HTML could not contain *everything*</span>
<span class="NonText"> Like code blocks</span>
<span class="NonText">* Or</span>
<span class="NonText">* List</span>
<span class="NonText">* Items</span>
<span class="NonText">&lt;/div&gt;</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,61 @@
Link [link](http://example.com)
Link with title [link](http://example.com "Title")
Link with title surrounded by single quotes [link](http://example.com 'Title')
Link to a relative path [link](/about)
Link to an anchor [link](#about)
Link to an image ![image](path/to/image.png)
Link with escaped parenthesis in URL [link](/url\(test\) "Title")
Link with unescaped parenthesis in URL [link](/url(test) "Title")
The following is not a link because it's escaped \[link](http://example.com) the URL must be auto linked anyway but the rounded parenthesis must not be highlighted
Link with escaped closed square bracket in text [text \] link](http://example.com)
Link with inline element in text [this **is** a link](http://example.com)
Link with newline in text [text
link](http://inline.com)
Link with multiple newline in text [this
is
text
in
link](http://inline.com)
Link with spaces between text and URL it's ok [link] (http://example.com)
Link with newline between text and URL it's ok [link]
(http://example.com)
Link with newline between URL and title it's ok [link](http://example.com
"Title")
# This is [link](http://github.com) in a title
[Link](http://example.com) at beginning of the line. Bug: this was considered as link definition
---
The following are not valid links
No more than one newline between text and URL [link]
(http://example.com)
No more that one newline in text [text
link](http://example.com)
No more that one newline between URL and title [link](http://example.com
"Title")
@@ -0,0 +1,96 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/inline_links.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Underlined { color: #c000c0; text-decoration: underline; }
.Title { color: #c000c0; }
.Bold { font-weight: bold; }
.Special { color: #c000c0; }
.Identifier { color: #008080; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
Link <span class="Special">[</span><span class="Underlined">link</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined"><a href="http://example.com">http://example.com</a></span><span class="Special">)</span>
Link with title <span class="Special">[</span><span class="Underlined">link</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined"><a href="http://example.com">http://example.com</a></span><span class="Bold"> &quot;Title&quot;</span><span class="Special">)</span>
Link with title surrounded by single quotes <span class="Special">[</span><span class="Underlined">link</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined"><a href="http://example.com">http://example.com</a></span><span class="Bold"> 'Title'</span><span class="Special">)</span>
Link to a relative path <span class="Special">[</span><span class="Underlined">link</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined">/about</span><span class="Special">)</span>
Link to an anchor <span class="Special">[</span><span class="Underlined">link</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined">#about</span><span class="Special">)</span>
Link to an image <span class="Special">![</span><span class="Underlined">image</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined">path/to/image.png</span><span class="Special">)</span>
Link with escaped parenthesis in URL <span class="Special">[</span><span class="Underlined">link</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined">/url\(test\)</span><span class="Bold"> &quot;Title&quot;</span><span class="Special">)</span>
Link with unescaped parenthesis in URL <span class="Special">[</span><span class="Underlined">link</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined">/url(test)</span><span class="Bold"> &quot;Title&quot;</span><span class="Special">)</span>
The following is not a link because it's escaped \[link](<span class="Underlined"><a href="http://example.com">http://example.com</a></span>) the URL must be auto linked anyway but the rounded parenthesis must not be highlighted
Link with escaped closed square bracket in text <span class="Special">[</span><span class="Underlined">text \] link</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined"><a href="http://example.com">http://example.com</a></span><span class="Special">)</span>
Link with inline element in text <span class="Special">[</span><span class="Underlined">this </span><span class="Special">**</span><span class="Bold">is</span><span class="Special">**</span><span class="Underlined"> a link</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined"><a href="http://example.com">http://example.com</a></span><span class="Special">)</span>
Link with newline in text <span class="Special">[</span><span class="Underlined">text</span>
<span class="Underlined">link</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined"><a href="http://inline.com">http://inline.com</a></span><span class="Special">)</span>
Link with multiple newline in text <span class="Special">[</span><span class="Underlined">this</span>
<span class="Underlined">is</span>
<span class="Underlined">text</span>
<span class="Underlined">in</span>
<span class="Underlined">link</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined"><a href="http://inline.com">http://inline.com</a></span><span class="Special">)</span>
Link with spaces between text and URL it's ok <span class="Special">[</span><span class="Underlined">link</span><span class="Special">]</span> <span class="Special">(</span><span class="Underlined"><a href="http://example.com">http://example.com</a></span><span class="Special">)</span>
Link with newline between text and URL it's ok <span class="Special">[</span><span class="Underlined">link</span><span class="Special">]</span>
<span class="Special">(</span><span class="Underlined"><a href="http://example.com">http://example.com</a></span><span class="Special">)</span>
Link with newline between URL and title it's ok <span class="Special">[</span><span class="Underlined">link</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined"><a href="http://example.com">http://example.com</a></span>
<span class="Bold">&quot;Title&quot;</span><span class="Special">)</span>
<span class="Special">#</span><span class="Title"> This is </span><span class="Special">[</span><span class="Underlined">link</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined"><a href="http://github.com">http://github.com</a></span><span class="Special">)</span><span class="Title"> in a title</span>
<span class="Special">[</span><span class="Underlined">Link</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined"><a href="http://example.com">http://example.com</a></span><span class="Special">)</span> at beginning of the line. Bug: this was considered as link definition
<span class="Identifier">---</span>
The following are not valid links
No more than one newline between text and URL [link]
(<span class="Underlined"><a href="http://example.com">http://example.com</a></span>)
No more that one newline in text [text
link](<span class="Underlined"><a href="http://example.com">http://example.com</a></span>)
No more that one newline between URL and title [link](<span class="Underlined"><a href="http://example.com">http://example.com</a></span>
&quot;Title&quot;)
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,52 @@
Reference [bar] [1]
Reference [bar][1]
Reference [bar]
[1]
[1]: /url/ "Title"
With [embedded [brackets]][b]
With quoted [embedded \[brackets\]][b]
With quoted [embedded \[ brackets][b]
With quoted [embedded \] brackets][b]
[b]: /url/
Indented [once][] times
Indented [twice][] times
Indented [thrice][] times
Indented [four][] times must not a reference, must be a code block
[once]: /url
[twice]: /url
[thrice]: /url
[four]: /url
With [angle brackets][]
And [without][]
[angle brackets]: <http://example.com/> "Angle Brackets"
[without]: http://example.com/ "Without angle brackets."
With [line
breaks][]
[line breaks]: http://example.com "Yes this works"
---
The following should be supported but they are not... In GFM and Kramdown link references could omit the second pair of square brackets, with a programming language is possible to check if something between square brackets has a related link definition an so to be interpreted as link reference but here it would be impossible
[short ref]
[short
ref]
[short ref]: http://example.com "No more hanging empty bracket!"
[a ref]
[a ref]: http://example.com
"Title on next line."
@@ -0,0 +1,86 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/inline_references.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.NonText { color: #8080ff; }
.Underlined { color: #c000c0; text-decoration: underline; }
.Special { color: #c000c0; }
.Identifier { color: #008080; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
Reference <span class="Special">[</span><span class="Underlined">bar</span><span class="Special">]</span> <span class="Special">[</span><span class="Underlined">1</span><span class="Special">]</span>
Reference <span class="Special">[</span><span class="Underlined">bar</span><span class="Special">][</span><span class="Underlined">1</span><span class="Special">]</span>
Reference <span class="Special">[</span><span class="Underlined">bar</span><span class="Special">]</span>
<span class="Special">[</span><span class="Underlined">1</span><span class="Special">]</span>
<span class="NonText">[1]: /url/ &quot;Title&quot;</span>
With <span class="Special">[</span><span class="Underlined">embedded [brackets]</span><span class="Special">][</span><span class="Underlined">b</span><span class="Special">]</span>
With quoted <span class="Special">[</span><span class="Underlined">embedded \[brackets\]</span><span class="Special">][</span><span class="Underlined">b</span><span class="Special">]</span>
With quoted <span class="Special">[</span><span class="Underlined">embedded \[ brackets</span><span class="Special">][</span><span class="Underlined">b</span><span class="Special">]</span>
With quoted <span class="Special">[</span><span class="Underlined">embedded \] brackets</span><span class="Special">][</span><span class="Underlined">b</span><span class="Special">]</span>
<span class="NonText">[b]: /url/</span>
Indented <span class="Special">[</span><span class="Underlined">once</span><span class="Special">][]</span> times
Indented <span class="Special">[</span><span class="Underlined">twice</span><span class="Special">][]</span> times
Indented <span class="Special">[</span><span class="Underlined">thrice</span><span class="Special">][]</span> times
Indented <span class="Special">[</span><span class="Underlined">four</span><span class="Special">][]</span> times must not a reference, must be a code block
<span class="NonText"> [once]: /url</span>
<span class="NonText"> [twice]: /url</span>
<span class="NonText"> [thrice]: /url</span>
<span class="NonText"> [four]: /url</span>
With <span class="Special">[</span><span class="Underlined">angle brackets</span><span class="Special">][]</span>
And <span class="Special">[</span><span class="Underlined">without</span><span class="Special">][]</span>
<span class="NonText">[angle brackets]: &lt;<a href="http://example.com/">http://example.com/</a>&gt; &quot;Angle Brackets&quot;</span>
<span class="NonText">[without]: <a href="http://example.com/">http://example.com/</a> &quot;Without angle brackets.&quot;</span>
With <span class="Special">[</span><span class="Underlined">line</span>
<span class="Underlined">breaks</span><span class="Special">][]</span>
<span class="NonText">[line breaks]: <a href="http://example.com">http://example.com</a> &quot;Yes this works&quot;</span>
<span class="Identifier">---</span>
The following should be supported but they are not... In GFM and Kramdown link references could omit the second pair of square brackets, with a programming language is possible to check if something between square brackets has a related link definition an so to be interpreted as link reference but here it would be impossible
[short ref]
[short
ref]
<span class="NonText">[short ref]: <a href="http://example.com">http://example.com</a> &quot;No more hanging empty bracket!&quot;</span>
[a ref]
<span class="NonText">[a ref]: <a href="http://example.com">http://example.com</a></span>
<span class="NonText"> &quot;Title on next line.&quot;</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,32 @@
---
layout: post
title: Blogging Like a Hacker
---
{% include footer.html %}
This is a Jekyll output tag {{ post.title }}
The following are Jekyll output tag with escape
{{ "{{" }} {{ "{%" }} {{ "}}" }} {{ "%}" }}
{{ "{%" }} this %}
{{ "{{" }} this }}
{{ "{{" }} {{ '"{%"' }} }} this %}
{{ "{{" }} {{ '"{{"' }} }} this }}
{% comment %}
This is a comment
{% endcomment %}
{% raw %}
This is a raw
{% endraw %}
{% highlight ruby %}
puts "This is some ruby code ;-)"
{% endhighlight %}
@@ -0,0 +1,64 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/jekyll.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.NonText { color: #8080ff; }
.Special { color: #c000c0; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Special">---</span>
<span class="NonText">layout: post</span>
<span class="NonText">title: Blogging Like a Hacker</span>
<span class="Special">---</span>
<span class="Special">{%</span><span class="NonText"> include footer.html </span><span class="Special">%}</span>
This is a Jekyll output tag <span class="Special">{{</span><span class="NonText"> post.title </span><span class="Special">}}</span>
The following are Jekyll output tag with escape
<span class="Special">{{</span><span class="NonText"> &quot;{{&quot; </span><span class="Special">}}</span> <span class="Special">{{</span><span class="NonText"> &quot;{%&quot; </span><span class="Special">}}</span> <span class="Special">{{</span><span class="NonText"> &quot;}}&quot; </span><span class="Special">}}</span> <span class="Special">{{</span><span class="NonText"> &quot;%}&quot; </span><span class="Special">}}</span>
<span class="Special">{{</span><span class="NonText"> &quot;{%&quot; </span><span class="Special">}}</span> this %}
<span class="Special">{{</span><span class="NonText"> &quot;{{&quot; </span><span class="Special">}}</span> this }}
<span class="Special">{{</span><span class="NonText"> &quot;{{&quot; </span><span class="Special">}}</span> <span class="Special">{{</span><span class="NonText"> '&quot;{%&quot;' </span><span class="Special">}}</span> }} this %}
<span class="Special">{{</span><span class="NonText"> &quot;{{&quot; </span><span class="Special">}}</span> <span class="Special">{{</span><span class="NonText"> '&quot;{{&quot;' </span><span class="Special">}}</span> }} this }}
<span class="Special">{% comment %}</span>
<span class="NonText">This is a comment</span>
<span class="Special">{% endcomment %}</span>
<span class="Special">{% raw %}</span>
<span class="NonText">This is a raw</span>
<span class="Special">{% endraw %}</span>
<span class="Special">{% highlight ruby %}</span>
<span class="NonText">puts &quot;This is some ruby code ;-)&quot;</span>
<span class="Special">{% endhighlight %}</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,21 @@
Hello {#id-1}
-----
Hello {#id-2}
=====
# Header With Identifier {#id-3}
# Header With Trailing Hashes and Identifier # {#id-4}
# Trailing Hashes could be as many as you want ####### {#id-5}
# Header With Hashes # In Text and Identifier {#id-6}
The following should a level 1 header with a `#` character for content
##
The following should a level 2 header with a `#` character for content
###
@@ -0,0 +1,54 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/kramdown/headers_with_id.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Title { color: #c000c0; }
.Constant { color: #c00000; }
.Special { color: #c000c0; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Title">Hello </span><span class="Special">{#id-1}</span>
<span class="Special">-----</span>
<span class="Title">Hello </span><span class="Special">{#id-2}</span>
<span class="Special">=====</span>
<span class="Special">#</span><span class="Title"> Header With Identifier </span><span class="Special">{#id-3}</span>
<span class="Special">#</span><span class="Title"> Header With Trailing Hashes and Identifier </span><span class="Special">#</span> <span class="Special">{#id-4}</span>
<span class="Special">#</span><span class="Title"> Trailing Hashes could be as many as you want </span><span class="Special">#######</span> <span class="Special">{#id-5}</span>
<span class="Special">#</span><span class="Title"> Header With Hashes # In Text and Identifier </span><span class="Special">{#id-6}</span>
The following should a level 1 header with a <span class="Special">`</span><span class="Constant">#</span><span class="Special">`</span> character for content
<span class="Special">#</span><span class="Title">#</span>
The following should a level 2 header with a <span class="Special">`</span><span class="Constant">#</span><span class="Special">`</span> character for content
<span class="Special">##</span><span class="Title">#</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,99 @@
Stars
* First item
* Second item
* Third item
Dashes
- First item
- Second item
- Third item
Pluses
+ First item
+ Second item
+ Third item
Ordered
1. First item
2. Second item
3. Third item
10. Index with more than one digit item
11. Index with more than one digit item
12. Index with more than one digit item
Nesting
* First item first level
* Second item second level
* Third item third level
* Fourth item third level
1. First item of the fourth level
2. Second item of the fourth level
List items on multiple lines
* This is the first item in the list
this is still the first item even if it's the second line
* This is the second item in the list
this is still the second item even if it's the second line
this is still the second item even if it's the third line
This is not part of the above list
List items on multiple lines aligned
* This is the first item in the list
this is still the first item even if it's the second line
* This is the second item in the list
this is still the second item even if it's the second line
this is still the second item even if it's the third line
This is still the second item even if it's separated with a newline
This is not part of the above list
Leading space are not allowed, well technically they are… in Dingus (the official markdown engine) leading spaces (up to 3) are allowed in list items but I chose to not allow it because it could lead to nasty situations like the following
* On Dingus this is a first level list item
* But this is a second level list item, even if its indentation it's lower than the line before… looking at the text don't tell me this is not confusing
A single list delimiter followed by a newline is not a list item
*
A single list delimiter followed by a single space and a newline is a list item
*
List with inline elements
* List item _ending_
with _emphasis_.
* List item with **strong emphasis**.
* List item with [a link](http://google.com).
* List items can have *inline content
that spans multiple lines*
*this is not a list item but a weak emphasis element beginning at the beginning of the line*
* This is a list item that ends with an asterisk *
Everything that immediately follows a list item is still part of the list item and a list item could not contain (at least for Github but not for the original Dingus interpreter) block elements like headers if not preceded by a new line
* This is a list item
# This is not an header, is the continuation of the previous list item, an empty line is needed to terminate a list item
# This is an header
@@ -0,0 +1,134 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/lists.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Underlined { color: #c000c0; text-decoration: underline; }
.Title { color: #c000c0; }
.Italic { font-style: italic; }
.Special { color: #c000c0; }
.Bold { font-weight: bold; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
Stars
<span class="Special">* </span>First item
<span class="Special">* </span>Second item
<span class="Special">* </span>Third item
Dashes
<span class="Special">- </span>First item
<span class="Special">- </span>Second item
<span class="Special">- </span>Third item
Pluses
<span class="Special">+ </span>First item
<span class="Special">+ </span>Second item
<span class="Special">+ </span>Third item
Ordered
<span class="Special">1. </span>First item
<span class="Special">2. </span>Second item
<span class="Special">3. </span>Third item
<span class="Special">10. </span>Index with more than one digit item
<span class="Special">11. </span>Index with more than one digit item
<span class="Special">12. </span>Index with more than one digit item
Nesting
<span class="Special">* </span>First item first level
<span class="Special"> * </span>Second item second level
<span class="Special"> * </span>Third item third level
<span class="Special"> * </span>Fourth item third level
<span class="Special"> 1. </span>First item of the fourth level
<span class="Special"> 2. </span>Second item of the fourth level
List items on multiple lines
<span class="Special">* </span>This is the first item in the list
this is still the first item even if it's the second line
<span class="Special">* </span>This is the second item in the list
this is still the second item even if it's the second line
this is still the second item even if it's the third line
This is not part of the above list
List items on multiple lines aligned
<span class="Special">* </span>This is the first item in the list
this is still the first item even if it's the second line
<span class="Special">* </span>This is the second item in the list
this is still the second item even if it's the second line
this is still the second item even if it's the third line
This is still the second item even if it's separated with a newline
This is not part of the above list
Leading space are not allowed, well technically they are… in Dingus (the official markdown engine) leading spaces (up to 3) are allowed in list items but I chose to not allow it because it could lead to nasty situations like the following
* On Dingus this is a first level list item
* But this is a second level list item, even if its indentation it's lower than the line before… looking at the text don't tell me this is not confusing
A single list delimiter followed by a newline is not a list item
*
A single list delimiter followed by a single space and a newline is a list item
*
List with inline elements
<span class="Special">* </span>List item <span class="Special">_</span><span class="Italic">ending</span><span class="Special">_</span>
with <span class="Special">_</span><span class="Italic">emphasis</span><span class="Special">_</span>.
<span class="Special">* </span>List item with <span class="Special">**</span><span class="Bold">strong emphasis</span><span class="Special">**</span>.
<span class="Special">* </span>List item with <span class="Special">[</span><span class="Underlined">a link</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined"><a href="http://google.com">http://google.com</a></span><span class="Special">)</span>.
<span class="Special">* </span>List items can have <span class="Special">*</span><span class="Italic">inline content</span>
<span class="Italic"> that spans multiple lines</span><span class="Special">*</span>
<span class="Special">*</span><span class="Italic">this is not a list item but a weak emphasis element beginning at the beginning of the line</span><span class="Special">*</span>
<span class="Special">* </span>This is a list item that ends with an asterisk *
Everything that immediately follows a list item is still part of the list item and a list item could not contain (at least for Github but not for the original Dingus interpreter) block elements like headers if not preceded by a new line
<span class="Special">* </span>This is a list item
# This is not an header, is the continuation of the previous list item, an empty line is needed to terminate a list item
<span class="Special">#</span><span class="Title"> This is an header</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,63 @@
* First level, first item
# Header 1 in Level 1
## Header 2 in Level 1
### Header 3 in Level 1
#### Header 4 in Level 1
##### Header 5 in Level 1
###### Header 6 in Level 1
Hello
===
* Level 2 list item
# Header 1 in Level 2
## Header 2 in Level 2
### Header 3 in Level 2
#### Header 4 in Level 1
##### Header 5 in Level 1
###### Header 6 in Level 1
* First level, first item, the following it's a rule
***
* Second level, first item,, the following it's a rule
***
* Third level, first item, the following it's not a rule because the preceding empty line it's mandatory
***
* Third level, second item, the following it's not a rule because it's anchored at the exact indentation
***
* First level, first item, the following it's blockquote
> Blockquotes terminates with an empty line
* Second level, first item,, the following it's a blockquote
> Blockquotes terminates with an empty line
* Third level, first item, the following it's not a blockquote because the preceding empty line it's mandatory
> Blockquotes terminates with an empty line
* Third level, second item, the following it's not a rule because it's anchored at the exact indentation
> Blockquotes terminates with an empty line
@@ -0,0 +1,95 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/lists_with_anchored_elements.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Comment { color: #0000c0; }
.Special { color: #c000c0; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Special">* </span>First level, first item
# Header 1 in Level 1
## Header 2 in Level 1
### Header 3 in Level 1
#### Header 4 in Level 1
##### Header 5 in Level 1
###### Header 6 in Level 1
Hello
===
<span class="Special"> * </span>Level 2 list item
# Header 1 in Level 2
## Header 2 in Level 2
### Header 3 in Level 2
#### Header 4 in Level 1
##### Header 5 in Level 1
###### Header 6 in Level 1
<span class="Special">* </span>First level, first item, the following it's a rule
***
<span class="Special"> * </span>Second level, first item,, the following it's a rule
***
<span class="Special"> * </span>Third level, first item, the following it's not a rule because the preceding empty line it's mandatory
***
<span class="Special"> * </span>Third level, second item, the following it's not a rule because it's anchored at the exact indentation
***
<span class="Special">* </span>First level, first item, the following it's blockquote
<span class="Special"> &gt; </span><span class="Comment">Blockquotes terminates with an empty line</span>
<span class="Special"> * </span>Second level, first item,, the following it's a blockquote
<span class="Special"> &gt; </span><span class="Comment">Blockquotes terminates with an empty line</span>
<span class="Special"> * </span>Third level, first item, the following it's not a blockquote because the preceding empty line it's mandatory
&gt; Blockquotes terminates with an empty line
<span class="Special"> * </span>Third level, second item, the following it's not a rule because it's anchored at the exact indentation
&gt; Blockquotes terminates with an empty line
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,53 @@
* this is not an item list this is a code block because it has 4 leading spaces
* First level, first item
Code blocks not contained in list items must have at least 4 leading spaces. Code blocks contained in list items must have at least 8 leading spaces for the first level and additional 2 leading spaces per level
This is a code block contained in a first level list item
* Second level, first item
This is not a code block, it could be because it has 8 leading spaces but it's not because it's contained in a second level list item, the following it's a code block because it has 10 leading spaces (8+2*(level-1))
This is a code block contained in a second level list item
Now we are back to the first level item so the following code block could be indented with 8 leading spaces
This is a code block contained in a first level list item
* Second level, second item
* Third level, first item
This is a code block contained in a third level list item because it has 12 leading spaces (8+2*(level-1))
* Second level, third item
This could be a code block because it has 10 leading spaces but it's not because it's not preceded by a mandatory blank line
This is a code block because it has 10 leading spaces and it's preceded by a blank line
* First level, third item
This is a code block, not a surprise
This is a code block because two consecutive new lines terminates the list item so 4 leading spaces are enough for a code block
* First level, first item
First level, first item
* First level, second item
First level, second item
First level, second item
First level, second item, a single blank line is not enough to terminate a list item
So this is not a code block even with 6 leading spaces
This is code block because 8 leading white spaces are needed as it's contained by a first level list item
@@ -0,0 +1,85 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/lists_with_codeblocks.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Constant { color: #c00000; }
.Special { color: #c000c0; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Constant"> * this is not an item list this is a code block because it has 4 leading spaces</span>
<span class="Special">* </span>First level, first item
Code blocks not contained in list items must have at least 4 leading spaces. Code blocks contained in list items must have at least 8 leading spaces for the first level and additional 2 leading spaces per level
<span class="Constant"> This is a code block contained in a first level list item</span>
<span class="Special"> * </span>Second level, first item
This is not a code block, it could be because it has 8 leading spaces but it's not because it's contained in a second level list item, the following it's a code block because it has 10 leading spaces (8+2*(level-1))
<span class="Constant"> This is a code block contained in a second level list item</span>
Now we are back to the first level item so the following code block could be indented with 8 leading spaces
<span class="Constant"> This is a code block contained in a first level list item</span>
<span class="Special"> * </span>Second level, second item
<span class="Special"> * </span>Third level, first item
<span class="Constant"> This is a code block contained in a third level list item because it has 12 leading spaces (8+2*(level-1))</span>
<span class="Special"> * </span>Second level, third item
This could be a code block because it has 10 leading spaces but it's not because it's not preceded by a mandatory blank line
<span class="Constant"> This is a code block because it has 10 leading spaces and it's preceded by a blank line</span>
<span class="Special">* </span>First level, third item
<span class="Constant"> This is a code block, not a surprise</span>
<span class="Constant"> This is a code block because two consecutive new lines terminates the list item so 4 leading spaces are enough for a code block</span>
<span class="Special">* </span>First level, first item
First level, first item
<span class="Special">* </span>First level, second item
First level, second item
First level, second item
First level, second item, a single blank line is not enough to terminate a list item
So this is not a code block even with 6 leading spaces
<span class="Constant"> This is code block because 8 leading white spaces are needed as it's contained by a first level list item</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,54 @@
```ruby
# This is a fenced code block
def ruby; end
```
```ruby
# This is not a fenced code block but a code block
def ruby; end
```
* First level, first item
First level, first item with `inline` element ``foo`` ``foo``
Still first level, first item, the following it's not a fenced code block but an inline code block
```ruby
def ruby; end
```
Still first level, first item, the following it's a fenced code block because it's preceded by an empty line
```ruby
def ruby; end
```
* First level, first item
* Second level, first item
* Third level, first item
* Fourth level, first item
```ruby
# This is a fenced code block and not a code block even it has 8 leading spaces because it's contained in a fourth level list item
def ruby; end
```
* First level, first item
```ruby
def ruby; end
```
```ruby
def ruby; end
```
```ruby
def ruby; end
```
```ruby
# This is not a fenced code block because it has 8 leading white spaces and so it's a code block
def ruby; end
```
@@ -0,0 +1,86 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/lists_with_fenced_codeblocks.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Constant { color: #c00000; }
.Special { color: #c000c0; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Special">```ruby</span>
<span class="Constant"># This is a fenced code block</span>
<span class="Constant">def ruby; end</span>
<span class="Special">```</span>
<span class="Constant"> ```ruby</span>
<span class="Constant"> # This is not a fenced code block but a code block</span>
<span class="Constant"> def ruby; end</span>
<span class="Constant"> ```</span>
<span class="Special">* </span>First level, first item
First level, first item with <span class="Special">`</span><span class="Constant">inline</span><span class="Special">`</span> element <span class="Special">``</span><span class="Constant">foo</span><span class="Special">``</span> <span class="Special">``</span><span class="Constant">foo</span><span class="Special">``</span>
Still first level, first item, the following it's not a fenced code block but an inline code block
<span class="Special">```</span><span class="Constant">ruby</span>
<span class="Constant"> def ruby; end</span>
<span class="Constant"> </span><span class="Special">```</span>
Still first level, first item, the following it's a fenced code block because it's preceded by an empty line
<span class="Special"> ```ruby</span>
<span class="Constant"> def ruby; end</span>
<span class="Special"> ```</span>
<span class="Special">* </span>First level, first item
<span class="Special"> * </span>Second level, first item
<span class="Special"> * </span>Third level, first item
<span class="Special"> * </span>Fourth level, first item
<span class="Special"> ```ruby</span>
<span class="Constant"> # This is a fenced code block and not a code block even it has 8 leading spaces because it's contained in a fourth level list item</span>
<span class="Constant"> def ruby; end</span>
<span class="Special"> ```</span>
<span class="Special">* </span>First level, first item
<span class="Special"> ```ruby</span>
<span class="Constant"> def ruby; end</span>
<span class="Special"> ```</span>
<span class="Special"> ```ruby</span>
<span class="Constant"> def ruby; end</span>
<span class="Special"> ```</span>
<span class="Special"> ```ruby</span>
<span class="Constant"> def ruby; end</span>
<span class="Special"> ```</span>
<span class="Constant"> ```ruby</span>
<span class="Constant"> # This is not a fenced code block because it has 8 leading white spaces and so it's a code block</span>
<span class="Constant"> def ruby; end</span>
<span class="Constant"> ```</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,21 @@
* First level, first item
* Second level, first item
* Third level, first item
still on the third level, first item
Back to the second level, first item, yes, the indentation it's the same as the last non blank line but this it's preceded with a blank line so it's not considered a continuation of the list item but another element ans since it's less indented than the list item it's not contained in it but in it's parent
Back to the first level, first item
* Second level, second item
Still on the third level, first item because the indentation is right for the third level
* First level, first item
* Second level, first item
* Third level, first item
* Fourth level, first item
this is still the fourth level, it's a continuation of the first line no matter what, a blank line it's needed to end the list item
* First level, first item
* A third level could not be contained in a first level, again this is technically supported but I choose to not allow it both for the sake of simplicity and to avoid confusing situation: this would be considered not a third level but a second level with leading spaces until a certain point, after that it's considered as a continuation of the first item… as I said, confusing better to stick to simple and consistent rules
@@ -0,0 +1,52 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/lists_with_lists.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Special { color: #c000c0; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Special">* </span>First level, first item
<span class="Special"> * </span>Second level, first item
<span class="Special"> * </span>Third level, first item
still on the third level, first item
Back to the second level, first item, yes, the indentation it's the same as the last non blank line but this it's preceded with a blank line so it's not considered a continuation of the list item but another element ans since it's less indented than the list item it's not contained in it but in it's parent
Back to the first level, first item
<span class="Special"> * </span>Second level, second item
Still on the third level, first item because the indentation is right for the third level
<span class="Special">* </span>First level, first item
<span class="Special"> * </span>Second level, first item
<span class="Special"> * </span>Third level, first item
<span class="Special"> * </span>Fourth level, first item
this is still the fourth level, it's a continuation of the first line no matter what, a blank line it's needed to end the list item
<span class="Special">* </span>First level, first item
* A third level could not be contained in a first level, again this is technically supported but I choose to not allow it both for the sake of simplicity and to avoid confusing situation: this would be considered not a third level but a second level with leading spaces until a certain point, after that it's considered as a continuation of the first item… as I said, confusing better to stick to simple and consistent rules
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,36 @@
* First level, first item with table
Header-1|Header-2
---|---
Row-1-Column-1|Row-1-Column-2
* Second level, first item with table
Header-1|Header-2
---|---
Row-1-Column-1|Row-1-Column-2
Row-2-Column-1|Row-2-Column-2
Row-3-Column-1|Row-3-Column-2
Row-4-Column-1|Row-4-Column-2
* Second level, second item with table, it's not a code block, tables could have as many leading spaces as wanted
Header-1|Header-2
---|---
Row-1-Column-1|Row-1-Column-2
Row-2-Column-1|Row-2-Column-2
Row-3-Column-1|Row-3-Column-2
Row-4-Column-1|Row-4-Column-2
* Third level, first item
* Fourth level, first item
* Fifth level, first item
The following it's a table in the third level list item
Header-1|Header-2
---|---
Row-1-Column-1|Row-1-Column-2
Header-1|Header-2
---|---
@@ -0,0 +1,68 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/lists_with_tables.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Bold { font-weight: bold; }
.Special { color: #c000c0; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Special">* </span>First level, first item with table
<span class="Bold"> Header-1</span><span class="Special">|</span><span class="Bold">Header-2</span>
<span class="Special"> ---|---</span>
Row-1-Column-1<span class="Special">|</span>Row-1-Column-2
<span class="Special"> * </span>Second level, first item with table
<span class="Bold"> Header-1</span><span class="Special">|</span><span class="Bold">Header-2</span>
<span class="Special"> ---|---</span>
Row-1-Column-1<span class="Special">|</span>Row-1-Column-2
Row-2-Column-1<span class="Special">|</span>Row-2-Column-2
Row-3-Column-1<span class="Special">|</span>Row-3-Column-2
Row-4-Column-1<span class="Special">|</span>Row-4-Column-2
<span class="Special"> * </span>Second level, second item with table, it's not a code block, tables could have as many leading spaces as wanted
<span class="Bold"> Header-1</span><span class="Special">|</span><span class="Bold">Header-2</span>
<span class="Special"> ---|---</span>
Row-1-Column-1<span class="Special">|</span>Row-1-Column-2
Row-2-Column-1<span class="Special">|</span>Row-2-Column-2
Row-3-Column-1<span class="Special">|</span>Row-3-Column-2
Row-4-Column-1<span class="Special">|</span>Row-4-Column-2
<span class="Special"> * </span>Third level, first item
<span class="Special"> * </span>Fourth level, first item
<span class="Special"> * </span>Fifth level, first item
The following it's a table in the third level list item
<span class="Bold"> Header-1</span><span class="Special">|</span><span class="Bold">Header-2</span>
<span class="Special"> ---|---</span>
Row-1-Column-1<span class="Special">|</span>Row-1-Column-2
<span class="Bold"> Header-1</span><span class="Special">|</span><span class="Bold">Header-2</span>
<span class="Special"> ---|---</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,29 @@
Stars
* [ ] First tasks item
* [x] Second tasks item
* [ ] Third tasks item
Dashes
- [x] First tasks item
- [ ] Second tasks item
- [x] Third tasks item
Pluses
+ [x] First tasks item
+ [x] Second tasks item
+ [ ] Third tasks item
Ordered
1. [ ] First tasks item
2. [x] Second tasks item
3. [x] Third tasks item
* [] This is not a task list item because the space between the brackets is mandatory for a non completed task
* [*] This is not a task list item because the `x` is the only allowed character to mark a task as done
* [ ]This is not a task list item because the space after the brackets is mandatory
* [x]This is not a task list item because the space after the brackets is mandatory
Aside from that task lists behaves in the same way as the simple lists
@@ -0,0 +1,61 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/lists_with_tasks.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Constant { color: #c00000; }
.Special { color: #c000c0; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
Stars
<span class="Special">* [ ] </span>First tasks item
<span class="Special">* [x] </span>Second tasks item
<span class="Special">* [ ] </span>Third tasks item
Dashes
<span class="Special">- [x] </span>First tasks item
<span class="Special">- [ ] </span>Second tasks item
<span class="Special">- [x] </span>Third tasks item
Pluses
<span class="Special">+ [x] </span>First tasks item
<span class="Special">+ [x] </span>Second tasks item
<span class="Special">+ [ ] </span>Third tasks item
Ordered
<span class="Special">1. [ ] </span>First tasks item
<span class="Special">2. [x] </span>Second tasks item
<span class="Special">3. [x] </span>Third tasks item
<span class="Special">* </span>[] This is not a task list item because the space between the brackets is mandatory for a non completed task
<span class="Special">* </span>[*] This is not a task list item because the <span class="Special">`</span><span class="Constant">x</span><span class="Special">`</span> is the only allowed character to mark a task as done
<span class="Special">* </span>[ ]This is not a task list item because the space after the brackets is mandatory
<span class="Special">* </span>[x]This is not a task list item because the space after the brackets is mandatory
Aside from that task lists behaves in the same way as the simple lists
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,896 @@
Markdown: Syntax
================
<ul id="ProjectSubmenu">
<li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
<li><a href="/projects/markdown/basics" title="Markdown Basics">Basics</a></li>
<li><a class="selected" title="Markdown Syntax Documentation">Syntax</a></li>
<li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
<li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
</ul>
* [Overview](#overview)
* [Philosophy](#philosophy)
* [Inline HTML](#html)
* [Automatic Escaping for Special Characters](#autoescape)
* [Block Elements](#block)
* [Paragraphs and Line Breaks](#p)
* [Headers](#header)
* [Blockquotes](#blockquote)
* [Lists](#list)
* [Code Blocks](#precode)
* [Horizontal Rules](#hr)
* [Span Elements](#span)
* [Links](#link)
* [Emphasis](#em)
* [Code](#code)
* [Images](#img)
* [Miscellaneous](#misc)
* [Backslash Escapes](#backslash)
* [Automatic Links](#autolink)
**Note:** This document is itself written using Markdown; you
can [see the source for it by adding '.text' to the URL][src].
[src]: /projects/markdown/syntax.text
* * *
<h2 id="overview">Overview</h2>
<h3 id="philosophy">Philosophy</h3>
Markdown is intended to be as easy-to-read and easy-to-write as is feasible.
Readability, however, is emphasized above all else. A Markdown-formatted
document should be publishable as-is, as plain text, without looking
like it's been marked up with tags or formatting instructions. While
Markdown's syntax has been influenced by several existing text-to-HTML
filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4],
[Grutatext] [5], and [EtText] [6] -- the single biggest source of
inspiration for Markdown's syntax is the format of plain text email.
[1]: http://docutils.sourceforge.net/mirror/setext.html
[2]: http://www.aaronsw.com/2002/atx/
[3]: http://textism.com/tools/textile/
[4]: http://docutils.sourceforge.net/rst.html
[5]: http://www.triptico.com/software/grutatxt.html
[6]: http://ettext.taint.org/doc/
To this end, Markdown's syntax is comprised entirely of punctuation
characters, which punctuation characters have been carefully chosen so
as to look like what they mean. E.g., asterisks around a word actually
look like \*emphasis\*. Markdown lists look like, well, lists. Even
blockquotes look like quoted passages of text, assuming you've ever
used email.
<h3 id="html">Inline HTML</h3>
Markdown's syntax is intended for one purpose: to be used as a
format for *writing* for the web.
Markdown is not a replacement for HTML, or even close to it. Its
syntax is very small, corresponding only to a very small subset of
HTML tags. The idea is *not* to create a syntax that makes it easier
to insert HTML tags. In my opinion, HTML tags are already easy to
insert. The idea for Markdown is to make it easy to read, write, and
edit prose. HTML is a *publishing* format; Markdown is a *writing*
format. Thus, Markdown's formatting syntax only addresses issues that
can be conveyed in plain text.
For any markup that is not covered by Markdown's syntax, you simply
use HTML itself. There's no need to preface it or delimit it to
indicate that you're switching from Markdown to HTML; you just use
the tags.
The only restrictions are that block-level HTML elements -- e.g. `<div>`,
`<table>`, `<pre>`, `<p>`, etc. -- must be separated from surrounding
content by blank lines, and the start and end tags of the block should
not be indented with tabs or spaces. Markdown is smart enough not
to add extra (unwanted) `<p>` tags around HTML block-level tags.
For example, to add an HTML table to a Markdown article:
This is a regular paragraph.
<table>
<tr>
<td>Foo</td>
</tr>
</table>
This is another regular paragraph.
Note that Markdown formatting syntax is not processed within block-level
HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an
HTML block.
Span-level HTML tags -- e.g. `<span>`, `<cite>`, or `<del>` -- can be
used anywhere in a Markdown paragraph, list item, or header. If you
want, you can even use HTML tags instead of Markdown formatting; e.g. if
you'd prefer to use HTML `<a>` or `<img>` tags instead of Markdown's
link or image syntax, go right ahead.
Unlike block-level HTML tags, Markdown syntax *is* processed within
span-level tags.
<h3 id="autoescape">Automatic Escaping for Special Characters</h3>
In HTML, there are two characters that demand special treatment: `<`
and `&`. Left angle brackets are used to start tags; ampersands are
used to denote HTML entities. If you want to use them as literal
characters, you must escape them as entities, e.g. `&lt;`, and
`&amp;`.
Ampersands in particular are bedeviling for web writers. If you want to
write about 'AT&T', you need to write '`AT&amp;T`'. You even need to
escape ampersands within URLs. Thus, if you want to link to:
http://images.google.com/images?num=30&q=larry+bird
you need to encode the URL as:
http://images.google.com/images?num=30&amp;q=larry+bird
in your anchor tag `href` attribute. Needless to say, this is easy to
forget, and is probably the single most common source of HTML validation
errors in otherwise well-marked-up web sites.
Markdown allows you to use these characters naturally, taking care of
all the necessary escaping for you. If you use an ampersand as part of
an HTML entity, it remains unchanged; otherwise it will be translated
into `&amp;`.
So, if you want to include a copyright symbol in your article, you can write:
&copy;
and Markdown will leave it alone. But if you write:
AT&T
Markdown will translate it to:
AT&amp;T
Similarly, because Markdown supports [inline HTML](#html), if you use
angle brackets as delimiters for HTML tags, Markdown will treat them as
such. But if you write:
4 < 5
Markdown will translate it to:
4 &lt; 5
However, inside Markdown code spans and blocks, angle brackets and
ampersands are *always* encoded automatically. This makes it easy to use
Markdown to write about HTML code. (As opposed to raw HTML, which is a
terrible format for writing about HTML syntax, because every single `<`
and `&` in your example code needs to be escaped.)
* * *
<h2 id="block">Block Elements</h2>
<h3 id="p">Paragraphs and Line Breaks</h3>
A paragraph is simply one or more consecutive lines of text, separated
by one or more blank lines. (A blank line is any line that looks like a
blank line -- a line containing nothing but spaces or tabs is considered
blank.) Normal paragraphs should not be indented with spaces or tabs.
The implication of the "one or more consecutive lines of text" rule is
that Markdown supports "hard-wrapped" text paragraphs. This differs
significantly from most other text-to-HTML formatters (including Movable
Type's "Convert Line Breaks" option) which translate every line break
character in a paragraph into a `<br />` tag.
When you *do* want to insert a `<br />` break tag using Markdown, you
end a line with two or more spaces, then type return.
Yes, this takes a tad more effort to create a `<br />`, but a simplistic
"every line break is a `<br />`" rule wouldn't work for Markdown.
Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l]
work best -- and look better -- when you format them with hard breaks.
[bq]: #blockquote
[l]: #list
<h3 id="header">Headers</h3>
Markdown supports two styles of headers, [Setext] [1] and [atx] [2].
Setext-style headers are "underlined" using equal signs (for first-level
headers) and dashes (for second-level headers). For example:
This is an H1
=============
This is an H2
-------------
Any number of underlining `=`'s or `-`'s will work.
Atx-style headers use 1-6 hash characters at the start of the line,
corresponding to header levels 1-6. For example:
# This is an H1
## This is an H2
###### This is an H6
Optionally, you may "close" atx-style headers. This is purely
cosmetic -- you can use this if you think it looks better. The
closing hashes don't even need to match the number of hashes
used to open the header. (The number of opening hashes
determines the header level.) :
# This is an H1 #
## This is an H2 ##
### This is an H3 ######
<h3 id="blockquote">Blockquotes</h3>
Markdown uses email-style `>` characters for blockquoting. If you're
familiar with quoting passages of text in an email message, then you
know how to create a blockquote in Markdown. It looks best if you hard
wrap the text and put a `>` before every line:
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
>
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
> id sem consectetuer libero luctus adipiscing.
Markdown allows you to be lazy and only put the `>` before the first
line of a hard-wrapped paragraph:
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
id sem consectetuer libero luctus adipiscing.
Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by
adding additional levels of `>`:
> This is the first level of quoting.
>
> > This is nested blockquote.
>
> Back to the first level.
Blockquotes can contain other Markdown elements, including headers, lists,
and code blocks:
> ## This is a header.
>
> 1. This is the first list item.
> 2. This is the second list item.
>
> Here's some example code:
>
> return shell_exec("echo $input | $markdown_script");
Any decent text editor should make email-style quoting easy. For
example, with BBEdit, you can make a selection and choose Increase
Quote Level from the Text menu.
<h3 id="list">Lists</h3>
Markdown supports ordered (numbered) and unordered (bulleted) lists.
Unordered lists use asterisks, pluses, and hyphens -- interchangably
-- as list markers:
* Red
* Green
* Blue
is equivalent to:
+ Red
+ Green
+ Blue
and:
- Red
- Green
- Blue
Ordered lists use numbers followed by periods:
1. Bird
2. McHale
3. Parish
It's important to note that the actual numbers you use to mark the
list have no effect on the HTML output Markdown produces. The HTML
Markdown produces from the above list is:
<ol>
<li>Bird</li>
<li>McHale</li>
<li>Parish</li>
</ol>
If you instead wrote the list in Markdown like this:
1. Bird
1. McHale
1. Parish
or even:
3. Bird
1. McHale
8. Parish
you'd get the exact same HTML output. The point is, if you want to,
you can use ordinal numbers in your ordered Markdown lists, so that
the numbers in your source match the numbers in your published HTML.
But if you want to be lazy, you don't have to.
If you do use lazy list numbering, however, you should still start the
list with the number 1. At some point in the future, Markdown may support
starting ordered lists at an arbitrary number.
List markers typically start at the left margin, but may be indented by
up to three spaces. List markers must be followed by one or more spaces
or a tab.
To make lists look nice, you can wrap items with hanging indents:
* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
viverra nec, fringilla in, laoreet vitae, risus.
* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
Suspendisse id sem consectetuer libero luctus adipiscing.
But if you want to be lazy, you don't have to:
* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
viverra nec, fringilla in, laoreet vitae, risus.
* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
Suspendisse id sem consectetuer libero luctus adipiscing.
If list items are separated by blank lines, Markdown will wrap the
items in `<p>` tags in the HTML output. For example, this input:
* Bird
* Magic
will turn into:
<ul>
<li>Bird</li>
<li>Magic</li>
</ul>
But this:
* Bird
* Magic
will turn into:
<ul>
<li><p>Bird</p></li>
<li><p>Magic</p></li>
</ul>
List items may consist of multiple paragraphs. Each subsequent
paragraph in a list item must be indented by either 4 spaces
or one tab:
1. This is a list item with two paragraphs. Lorem ipsum dolor
sit amet, consectetuer adipiscing elit. Aliquam hendrerit
mi posuere lectus.
Vestibulum enim wisi, viverra nec, fringilla in, laoreet
vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
sit amet velit.
2. Suspendisse id sem consectetuer libero luctus adipiscing.
It looks nice if you indent every line of the subsequent
paragraphs, but here again, Markdown will allow you to be
lazy:
* This is a list item with two paragraphs.
This is the second paragraph in the list item. You're
only required to indent the first line. Lorem ipsum dolor
sit amet, consectetuer adipiscing elit.
* Another item in the same list.
To put a blockquote within a list item, the blockquote's `>`
delimiters need to be indented:
* A list item with a blockquote:
> This is a blockquote
> inside a list item.
To put a code block within a list item, the code block needs
to be indented *twice* -- 8 spaces or two tabs:
* A list item with a code block:
<code goes here>
It's worth noting that it's possible to trigger an ordered list by
accident, by writing something like this:
1986. What a great season.
In other words, a *number-period-space* sequence at the beginning of a
line. To avoid this, you can backslash-escape the period:
1986\. What a great season.
<h3 id="precode">Code Blocks</h3>
Pre-formatted code blocks are used for writing about programming or
markup source code. Rather than forming normal paragraphs, the lines
of a code block are interpreted literally. Markdown wraps a code block
in both `<pre>` and `<code>` tags.
To produce a code block in Markdown, simply indent every line of the
block by at least 4 spaces or 1 tab. For example, given this input:
This is a normal paragraph:
This is a code block.
Markdown will generate:
<p>This is a normal paragraph:</p>
<pre><code>This is a code block.
</code></pre>
One level of indentation -- 4 spaces or 1 tab -- is removed from each
line of the code block. For example, this:
Here is an example of AppleScript:
tell application "Foo"
beep
end tell
will turn into:
<p>Here is an example of AppleScript:</p>
<pre><code>tell application "Foo"
beep
end tell
</code></pre>
A code block continues until it reaches a line that is not indented
(or the end of the article).
Within a code block, ampersands (`&`) and angle brackets (`<` and `>`)
are automatically converted into HTML entities. This makes it very
easy to include example HTML source code using Markdown -- just paste
it and indent it, and Markdown will handle the hassle of encoding the
ampersands and angle brackets. For example, this:
<div class="footer">
&copy; 2004 Foo Corporation
</div>
will turn into:
<pre><code>&lt;div class="footer"&gt;
&amp;copy; 2004 Foo Corporation
&lt;/div&gt;
</code></pre>
Regular Markdown syntax is not processed within code blocks. E.g.,
asterisks are just literal asterisks within a code block. This means
it's also easy to use Markdown to write about Markdown's own syntax.
<h3 id="hr">Horizontal Rules</h3>
You can produce a horizontal rule tag (`<hr />`) by placing three or
more hyphens, asterisks, or underscores on a line by themselves. If you
wish, you may use spaces between the hyphens or asterisks. Each of the
following lines will produce a horizontal rule:
* * *
***
*****
- - -
---------------------------------------
* * *
<h2 id="span">Span Elements</h2>
<h3 id="link">Links</h3>
Markdown supports two style of links: *inline* and *reference*.
In both styles, the link text is delimited by [square brackets].
To create an inline link, use a set of regular parentheses immediately
after the link text's closing square bracket. Inside the parentheses,
put the URL where you want the link to point, along with an *optional*
title for the link, surrounded in quotes. For example:
This is [an example](http://example.com/ "Title") inline link.
[This link](http://example.net/) has no title attribute.
Will produce:
<p>This is <a href="http://example.com/" title="Title">
an example</a> inline link.</p>
<p><a href="http://example.net/">This link</a> has no
title attribute.</p>
If you're referring to a local resource on the same server, you can
use relative paths:
See my [About](/about/) page for details.
Reference-style links use a second set of square brackets, inside
which you place a label of your choosing to identify the link:
This is [an example][id] reference-style link.
You can optionally use a space to separate the sets of brackets:
This is [an example] [id] reference-style link.
Then, anywhere in the document, you define your link label like this,
on a line by itself:
[id]: http://example.com/ "Optional Title Here"
That is:
* Square brackets containing the link identifier (optionally
indented from the left margin using up to three spaces);
* followed by a colon;
* followed by one or more spaces (or tabs);
* followed by the URL for the link;
* optionally followed by a title attribute for the link, enclosed
in double or single quotes, or enclosed in parentheses.
The following three link definitions are equivalent:
[foo]: http://example.com/ "Optional Title Here"
[foo]: http://example.com/ 'Optional Title Here'
[foo]: http://example.com/ (Optional Title Here)
**Note:** There is a known bug in Markdown.pl 1.0.1 which prevents
single quotes from being used to delimit link titles.
The link URL may, optionally, be surrounded by angle brackets:
[id]: <http://example.com/> "Optional Title Here"
You can put the title attribute on the next line and use extra spaces
or tabs for padding, which tends to look better with longer URLs:
[id]: http://example.com/longish/path/to/resource/here
"Optional Title Here"
Link definitions are only used for creating links during Markdown
processing, and are stripped from your document in the HTML output.
Link definition names may consist of letters, numbers, spaces, and
punctuation -- but they are *not* case sensitive. E.g. these two
links:
[link text][a]
[link text][A]
are equivalent.
The *implicit link name* shortcut allows you to omit the name of the
link, in which case the link text itself is used as the name.
Just use an empty set of square brackets -- e.g., to link the word
"Google" to the google.com web site, you could simply write:
[Google][]
And then define the link:
[Google]: http://google.com/
Because link names may contain spaces, this shortcut even works for
multiple words in the link text:
Visit [Daring Fireball][] for more information.
And then define the link:
[Daring Fireball]: http://daringfireball.net/
Link definitions can be placed anywhere in your Markdown document. I
tend to put them immediately after each paragraph in which they're
used, but if you want, you can put them all at the end of your
document, sort of like footnotes.
Here's an example of reference links in action:
I get 10 times more traffic from [Google] [1] than from
[Yahoo] [2] or [MSN] [3].
[1]: http://google.com/ "Google"
[2]: http://search.yahoo.com/ "Yahoo Search"
[3]: http://search.msn.com/ "MSN Search"
Using the implicit link name shortcut, you could instead write:
I get 10 times more traffic from [Google][] than from
[Yahoo][] or [MSN][].
[google]: http://google.com/ "Google"
[yahoo]: http://search.yahoo.com/ "Yahoo Search"
[msn]: http://search.msn.com/ "MSN Search"
Both of the above examples will produce the following HTML output:
<p>I get 10 times more traffic from <a href="http://google.com/"
title="Google">Google</a> than from
<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
For comparison, here is the same paragraph written using
Markdown's inline link style:
I get 10 times more traffic from [Google](http://google.com/ "Google")
than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
[MSN](http://search.msn.com/ "MSN Search").
The point of reference-style links is not that they're easier to
write. The point is that with reference-style links, your document
source is vastly more readable. Compare the above examples: using
reference-style links, the paragraph itself is only 81 characters
long; with inline-style links, it's 176 characters; and as raw HTML,
it's 234 characters. In the raw HTML, there's more markup than there
is text.
With Markdown's reference-style links, a source document much more
closely resembles the final output, as rendered in a browser. By
allowing you to move the markup-related metadata out of the paragraph,
you can add links without interrupting the narrative flow of your
prose.
<h3 id="em">Emphasis</h3>
Markdown treats asterisks (`*`) and underscores (`_`) as indicators of
emphasis. Text wrapped with one `*` or `_` will be wrapped with an
HTML `<em>` tag; double `*`'s or `_`'s will be wrapped with an HTML
`<strong>` tag. E.g., this input:
*single asterisks*
_single underscores_
**double asterisks**
__double underscores__
will produce:
<em>single asterisks</em>
<em>single underscores</em>
<strong>double asterisks</strong>
<strong>double underscores</strong>
You can use whichever style you prefer; the lone restriction is that
the same character must be used to open and close an emphasis span.
Emphasis can be used in the middle of a word:
un*frigging*believable
But if you surround an `*` or `_` with spaces, it'll be treated as a
literal asterisk or underscore.
To produce a literal asterisk or underscore at a position where it
would otherwise be used as an emphasis delimiter, you can backslash
escape it:
\*this text is surrounded by literal asterisks\*
<h3 id="code">Code</h3>
To indicate a span of code, wrap it with backtick quotes (`` ` ``).
Unlike a pre-formatted code block, a code span indicates code within a
normal paragraph. For example:
Use the `printf()` function.
will produce:
<p>Use the <code>printf()</code> function.</p>
To include a literal backtick character within a code span, you can use
multiple backticks as the opening and closing delimiters:
``There is a literal backtick (`) here.``
which will produce this:
<p><code>There is a literal backtick (`) here.</code></p>
The backtick delimiters surrounding a code span may include spaces --
one after the opening, one before the closing. This allows you to place
literal backtick characters at the beginning or end of a code span:
A single backtick in a code span: `` ` ``
A backtick-delimited string in a code span: `` `foo` ``
will produce:
<p>A single backtick in a code span: <code>`</code></p>
<p>A backtick-delimited string in a code span: <code>`foo`</code></p>
With a code span, ampersands and angle brackets are encoded as HTML
entities automatically, which makes it easy to include example HTML
tags. Markdown will turn this:
Please don't use any `<blink>` tags.
into:
<p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
You can write this:
`&#8212;` is the decimal-encoded equivalent of `&mdash;`.
to produce:
<p><code>&amp;#8212;</code> is the decimal-encoded
equivalent of <code>&amp;mdash;</code>.</p>
<h3 id="img">Images</h3>
Admittedly, it's fairly difficult to devise a "natural" syntax for
placing images into a plain text document format.
Markdown uses an image syntax that is intended to resemble the syntax
for links, allowing for two styles: *inline* and *reference*.
Inline image syntax looks like this:
![Alt text](/path/to/img.jpg)
![Alt text](/path/to/img.jpg "Optional title")
That is:
* An exclamation mark: `!`;
* followed by a set of square brackets, containing the `alt`
attribute text for the image;
* followed by a set of parentheses, containing the URL or path to
the image, and an optional `title` attribute enclosed in double
or single quotes.
Reference-style image syntax looks like this:
![Alt text][id]
Where "id" is the name of a defined image reference. Image references
are defined using syntax identical to link references:
[id]: url/to/image "Optional title attribute"
As of this writing, Markdown has no syntax for specifying the
dimensions of an image; if this is important to you, you can simply
use regular HTML `<img>` tags.
* * *
<h2 id="misc">Miscellaneous</h2>
<h3 id="autolink">Automatic Links</h3>
Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:
<http://example.com/>
Markdown will turn this into:
<a href="http://example.com/">http://example.com/</a>
Automatic links for email addresses work similarly, except that
Markdown will also perform a bit of randomized decimal and hex
entity-encoding to help obscure your address from address-harvesting
spambots. For example, Markdown will turn this:
<address@example.com>
into something like this:
<a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
which will render in a browser as a clickable link to "address@example.com".
(This sort of entity-encoding trick will indeed fool many, if not
most, address-harvesting bots, but it definitely won't fool all of
them. It's better than nothing, but an address published in this way
will probably eventually start receiving spam.)
<h3 id="backslash">Backslash Escapes</h3>
Markdown allows you to use backslash escapes to generate literal
characters which would otherwise have special meaning in Markdown's
formatting syntax. For example, if you wanted to surround a word
with literal asterisks (instead of an HTML `<em>` tag), you can use
backslashes before the asterisks, like this:
\*literal asterisks\*
Markdown provides backslash escapes for the following characters:
\ backslash
` backtick
* asterisk
_ underscore
{} curly braces
[] square brackets
() parentheses
# hash mark
+ plus sign
- minus sign (hyphen)
. dot
! exclamation mark
@@ -0,0 +1,30 @@
~~one line strikethrough~~
~~multiple line
strike through~~
The end could not be escaped ~~this is striked\~~
There is no escape in the middle ~~this is \~~ striked~~ so the end is not striked
The begin could be escaped \~~this is not striked~~
* this is a list ~~with a strikethrough~~
# this is a header ~~with a strikethrough~~ this is still part of the header
~~strikethrough *could* __contain__ other http://google.it inline elements~~
~~
could not begin
with a new line
this is not striked~~
~~ could not begin with a space this is not striked~~
~~could not end with a space, this is not striked ~~
~~could not end
with a newline
this is not striked
~~
@@ -0,0 +1,66 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/strikethrough.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.NonText { color: #8080ff; }
.Underlined { color: #c000c0; text-decoration: underline; }
.Bold { font-weight: bold; }
.Title { color: #c000c0; }
.Italic { font-style: italic; }
.Special { color: #c000c0; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Special">~~</span><span class="NonText">one line strikethrough</span><span class="Special">~~</span>
<span class="Special">~~</span><span class="NonText">multiple line</span>
<span class="NonText">strike through</span><span class="Special">~~</span>
The end could not be escaped <span class="Special">~~</span><span class="NonText">this is striked\</span><span class="Special">~~</span>
There is no escape in the middle <span class="Special">~~</span><span class="NonText">this is \</span><span class="Special">~~</span> striked~~ so the end is not striked
The begin could be escaped \~~this is not striked~~
<span class="Special">* </span>this is a list <span class="Special">~~</span><span class="NonText">with a strikethrough</span><span class="Special">~~</span>
<span class="Special">#</span><span class="Title"> this is a header </span><span class="Special">~~</span><span class="NonText">with a strikethrough</span><span class="Special">~~</span><span class="Title"> this is still part of the header</span>
<span class="Special">~~</span><span class="NonText">strikethrough </span><span class="Special">*</span><span class="Italic">could</span><span class="Special">*</span><span class="NonText"> </span><span class="Special">__</span><span class="Bold">contain</span><span class="Special">__</span><span class="NonText"> other </span><span class="Underlined"><a href="http://google.it">http://google.it</a></span><span class="NonText"> inline elements</span><span class="Special">~~</span>
~~
could not begin
with a new line
this is not striked~~
~~ could not begin with a space this is not striked~~
~~could not end with a space, this is not striked ~~
~~could not end
with a newline
this is not striked
~~
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,57 @@
This is __strong__ emphasis
This is also **strong** emphasis
This is __multiple words__ strong emphasis
This is also **multiple words** strong emphasis
This is __ not valid __
**strong** emphasis could be the first word in the line
__strong__ emphasis could be the first word in the line
Strong **emphasis
could span** multiple lines
Strong __emphasis
could span__ multiple lines
Strong __emphasis `could` contain__ inline code
Strong __emphasis *could* contain__ weak emphasis
The following is not a strong emphasis __
that span multiple lines
__ because the start delimiter must be followed by something (not the end of line)
The following is not a strong emphasis **
that span multiple lines
** because the start delimiter must be followed by something (not the end of line)
The usage of alternate delimiters must be idempotent, so all __foo__ **foo** __**foo**__ **__foo__** must be "foo" highlighted as bold
The same delimiter could not be used twice ****foo*** and ____foo____ must be normal
__foo____bar__ must be "foo" highlighted as bold followed by "{UNDERSCORE}{UNDERSCORE}bar{UNDERSCORE}{UNDERSCORE}" highlighted as normal
__foo__**bar** must be "foo" highlighted as bold followed by "bar" highlighted as bold
__foo__b must be "foo" highlighted as bold followed by "b" highlighted as normal
__foo__bar__baz__ must be "foo" highlighted as bold followed by "bar{UNDERSCORE}baz{UNDERSCORE}" highlighted as normal
__foo__bar __baz__ must be "foo" and "baz" highlighted as bold and "bar" highlighted as normal
Four underscore ____ or four asterisks **** must not be highlighted without something in between
Spaces do not count for something so __ __ and ** ** must be normal
FOO__BAR must not be normal
FOO__BAR and BAR__FOO must be normal
Unfortunately __FOO__BAR doesn't work but escaping \__FOO__BAR is always possible
@@ -0,0 +1,91 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/strong_emphasis.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Italic { font-style: italic; }
.Bold { font-weight: bold; }
.Constant { color: #c00000; }
.Special { color: #c000c0; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
This is <span class="Special">__</span><span class="Bold">strong</span><span class="Special">__</span> emphasis
This is also <span class="Special">**</span><span class="Bold">strong</span><span class="Special">**</span> emphasis
This is <span class="Special">__</span><span class="Bold">multiple words</span><span class="Special">__</span> strong emphasis
This is also <span class="Special">**</span><span class="Bold">multiple words</span><span class="Special">**</span> strong emphasis
This is __ not valid __
<span class="Special">**</span><span class="Bold">strong</span><span class="Special">**</span> emphasis could be the first word in the line
<span class="Special">__</span><span class="Bold">strong</span><span class="Special">__</span> emphasis could be the first word in the line
Strong <span class="Special">**</span><span class="Bold">emphasis</span>
<span class="Bold">could span</span><span class="Special">**</span> multiple lines
Strong <span class="Special">__</span><span class="Bold">emphasis</span>
<span class="Bold">could span</span><span class="Special">__</span> multiple lines
Strong <span class="Special">__</span><span class="Bold">emphasis </span><span class="Special">`</span><span class="Constant">could</span><span class="Special">`</span><span class="Bold"> contain</span><span class="Special">__</span> inline code
Strong <span class="Special">__</span><span class="Bold">emphasis </span><span class="Special">*</span><span class="Italic">could</span><span class="Special">*</span><span class="Bold"> contain</span><span class="Special">__</span> weak emphasis
The following is not a strong emphasis __
that span multiple lines
__ because the start delimiter must be followed by something (not the end of line)
The following is not a strong emphasis **
that span multiple lines
** because the start delimiter must be followed by something (not the end of line)
The usage of alternate delimiters must be idempotent, so all <span class="Special">__</span><span class="Bold">foo</span><span class="Special">__</span> <span class="Special">**</span><span class="Bold">foo</span><span class="Special">**</span> <span class="Special">__**</span><span class="Bold">foo</span><span class="Special">**__</span> <span class="Special">**__</span><span class="Bold">foo</span><span class="Special">__**</span> must be &quot;foo&quot; highlighted as bold
The same delimiter could not be used twice ****foo*** and ____foo____ must be normal
<span class="Special">__</span><span class="Bold">foo</span><span class="Special">__</span>__bar__ must be &quot;foo&quot; highlighted as bold followed by &quot;{UNDERSCORE}{UNDERSCORE}bar{UNDERSCORE}{UNDERSCORE}&quot; highlighted as normal
<span class="Special">__</span><span class="Bold">foo</span><span class="Special">__**</span><span class="Bold">bar</span><span class="Special">**</span> must be &quot;foo&quot; highlighted as bold followed by &quot;bar&quot; highlighted as bold
<span class="Special">__</span><span class="Bold">foo</span><span class="Special">__</span>b must be &quot;foo&quot; highlighted as bold followed by &quot;b&quot; highlighted as normal
<span class="Special">__</span><span class="Bold">foo</span><span class="Special">__</span>bar__baz__ must be &quot;foo&quot; highlighted as bold followed by &quot;bar{UNDERSCORE}baz{UNDERSCORE}&quot; highlighted as normal
<span class="Special">__</span><span class="Bold">foo</span><span class="Special">__</span>bar <span class="Special">__</span><span class="Bold">baz</span><span class="Special">__</span> must be &quot;foo&quot; and &quot;baz&quot; highlighted as bold and &quot;bar&quot; highlighted as normal
Four underscore ____ or four asterisks **** must not be highlighted without something in between
Spaces do not count for something so __ __ and ** ** must be normal
FOO__BAR must not be normal
FOO__BAR and BAR__FOO must be normal
Unfortunately <span class="Special">__</span><span class="Bold">FOO</span><span class="Special">__</span>BAR doesn't work but escaping \__FOO__BAR is always possible
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,105 @@
Tables with at least two columns at least must have pipes to separate columns
Header-1|Header-2
---|---
Row-1-Column-1|Row-1-Column-2
Header-1|Header-2
---|---
Row-1-Column-1|Row-1-Column-2
Row-2-Column-1|Row-2-Column-2
|Header-1|Header-2
|---|---
|Row-1-Column-1|Row-1-Column-2
Header-1|Header-2|
---|---|
Row-1-Column-1|Row-1-Column-2|
|Header-1|Header-2|
|---|---|
|Row-1-Column-1|Row-1-Column-2|
Between dashes and pipes spaces are allowed
Header-1 | Header-2
--- | ---
Row-1-Column-1 | Row-1-Column-2
Tables with alignment hints (left, right and center)
Header-1 | Header-2
:--------------|:--------------
Row-1-Column-1 | Row-1-Column-2
Header-1 | Header-2
--------------:|--------------:
Row-1-Column-1 | Row-1-Column-2
Header-1 | Header-2
:-------------:|:-------------:
Row-1-Column-1 | Row-1-Column-2
Tables could contain inline elements
www.example.com | Header-2
--- | ---
~~Row-1-Column-1~~ | *Row-1-Column-2*
Tables with single column at least should have a pipes on one side
|Header-1
|---
|Row-1-Column-1
Header-1|
---|
Row-1-Column-1|
|Header-1|
|---|
|Row-1-Column-1|
So this is not not a table with one column but some stings and a separator (it's not an header because it doesn't begin at the first column)
Header-1
---
Row-1-Column-1
Tables could have only headers
Header-1|Header-2
---|---
Surprisingly tables could have as many leading spaces as wanted, they never turn as code blocks
Header-1|Header-2
---|---
Row-1-Column-1|Row-1-Column-2
Header-1|Header-2
---|---
Row-1-Column-1|Row-1-Column-2
Tables should be preceded by an empty line, so the following is not a table
Not an empty line
Header-1|Header-2
---|---
Row-1-Column-1|Row-1-Column-2
The separator between header and the rows should have at least 3 dashes, so the following is not a table
Header-1|Header-2
--|---
Row-1-Column-1|Row-1-Column-2
@@ -0,0 +1,141 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/tables.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.NonText { color: #8080ff; }
.Underlined { color: #c000c0; text-decoration: underline; }
.Special { color: #c000c0; }
.Italic { font-style: italic; }
.Bold { font-weight: bold; }
.Identifier { color: #008080; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
Tables with at least two columns at least must have pipes to separate columns
<span class="Bold"> Header-1</span><span class="Special">|</span><span class="Bold">Header-2</span>
<span class="Special"> ---|---</span>
Row-1-Column-1<span class="Special">|</span>Row-1-Column-2
<span class="Bold"> Header-1</span><span class="Special">|</span><span class="Bold">Header-2</span>
<span class="Special"> ---|---</span>
Row-1-Column-1<span class="Special">|</span>Row-1-Column-2
Row-2-Column-1<span class="Special">|</span>Row-2-Column-2
<span class="Bold"> </span><span class="Special">|</span><span class="Bold">Header-1</span><span class="Special">|</span><span class="Bold">Header-2</span>
<span class="Special"> |---|---</span>
<span class="Special">|</span>Row-1-Column-1<span class="Special">|</span>Row-1-Column-2
<span class="Bold"> Header-1</span><span class="Special">|</span><span class="Bold">Header-2</span><span class="Special">|</span>
<span class="Special"> ---|---|</span>
Row-1-Column-1<span class="Special">|</span>Row-1-Column-2<span class="Special">|</span>
<span class="Bold"> </span><span class="Special">|</span><span class="Bold">Header-1</span><span class="Special">|</span><span class="Bold">Header-2</span><span class="Special">|</span>
<span class="Special"> |---|---|</span>
<span class="Special">|</span>Row-1-Column-1<span class="Special">|</span>Row-1-Column-2<span class="Special">|</span>
Between dashes and pipes spaces are allowed
<span class="Bold"> Header-1 </span><span class="Special">|</span><span class="Bold"> Header-2</span>
<span class="Special"> --- | ---</span>
Row-1-Column-1 <span class="Special">|</span> Row-1-Column-2
Tables with alignment hints (left, right and center)
<span class="Bold"> Header-1 </span><span class="Special">|</span><span class="Bold"> Header-2</span>
<span class="Special"> :--------------|:--------------</span>
Row-1-Column-1 <span class="Special">|</span> Row-1-Column-2
<span class="Bold"> Header-1 </span><span class="Special">|</span><span class="Bold"> Header-2</span>
<span class="Special"> --------------:|--------------:</span>
Row-1-Column-1 <span class="Special">|</span> Row-1-Column-2
<span class="Bold"> Header-1 </span><span class="Special">|</span><span class="Bold"> Header-2</span>
<span class="Special"> :-------------:|:-------------:</span>
Row-1-Column-1 <span class="Special">|</span> Row-1-Column-2
Tables could contain inline elements
<span class="Bold"> </span><span class="Underlined">www.example.com</span><span class="Bold"> </span><span class="Special">|</span><span class="Bold"> Header-2</span>
<span class="Special"> --- | ---</span>
<span class="Special">~~</span><span class="NonText">Row-1-Column-1</span><span class="Special">~~</span> <span class="Special">|</span> <span class="Special">*</span><span class="Italic">Row-1-Column-2</span><span class="Special">*</span>
Tables with single column at least should have a pipes on one side
<span class="Bold"> </span><span class="Special">|</span><span class="Bold">Header-1</span>
<span class="Special"> |---</span>
<span class="Special">|</span>Row-1-Column-1
<span class="Bold"> Header-1</span><span class="Special">|</span>
<span class="Special"> ---|</span>
Row-1-Column-1<span class="Special">|</span>
<span class="Bold"> </span><span class="Special">|</span><span class="Bold">Header-1</span><span class="Special">|</span>
<span class="Special"> |---|</span>
<span class="Special">|</span>Row-1-Column-1<span class="Special">|</span>
So this is not not a table with one column but some stings and a separator (it's not an header because it doesn't begin at the first column)
Header-1
<span class="Identifier"> ---</span>
Row-1-Column-1
Tables could have only headers
<span class="Bold"> Header-1</span><span class="Special">|</span><span class="Bold">Header-2</span>
<span class="Special"> ---|---</span>
Surprisingly tables could have as many leading spaces as wanted, they never turn as code blocks
<span class="Bold"> Header-1</span><span class="Special">|</span><span class="Bold">Header-2</span>
<span class="Special"> ---|---</span>
Row-1-Column-1<span class="Special">|</span>Row-1-Column-2
<span class="Bold"> Header-1</span><span class="Special">|</span><span class="Bold">Header-2</span>
<span class="Special"> ---|---</span>
Row-1-Column-1<span class="Special">|</span>Row-1-Column-2
Tables should be preceded by an empty line, so the following is not a table
Not an empty line
Header-1|Header-2
---|---
Row-1-Column-1|Row-1-Column-2
The separator between header and the rows should have at least 3 dashes, so the following is not a table
Header-1|Header-2
--|---
Row-1-Column-1|Row-1-Column-2
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,57 @@
This is _weak_ emphasis
This is also *weak* emphasis
This is _multiple words_ weak emphasis
This is also *multiple words* weak emphasis
This is _ not valid _ because the start delimiter must be followed by something (not a space)
*weak* emphasis could be the first word in the line
_weak_ emphasis could be the first word in the line
Weak *emphasis
could span* multiple lines
Weak _emphasis
could span_ multiple lines
Weak _emphasis `could` contain_ inline code
Weak _emphasis **could** contain_ strong emphasis
The following is not a weak emphasis _
that span multiple lines
_ because the start delimiter must be followed by something (not the end of line)
The following is not a weak emphasis *
that span multiple
lines* because the start delimiter must be followed by something (not the end of line)
The usage of alternate delimiters must be idempotent, so all _foo_ *foo* _*foo*_ *_foo_* must be "foo" highlighted as italic
The same delimiter could not be used twice **foo** and __foo__ must not be highlighted as italic
_foo__bar_ must be "foo" highlighted as italic followed by "{UNDERSCORE}bar{UNDERSCORE}" highlighted as normal
_foo_*bar* must be "foo" highlighted as italic followed by "bar" highlighted as italic
_foo_b must be "foo" highlighted as italic followed by "b" highlighted as normal
_foo_bar_baz_ must be "foo" highlighted as italic followed by "bar{UNDERSCORE}baz{UNDERSCORE}" highlighted as normal
_foo_bar _baz_ must be "foo" and "baz" highlighted as italic and "bar" highlighted as normal
Two underscores __ or two asterisks ** must not be highlighted without something between them
Spaces do not count for something so _ _ and * * must be normal
FOO_BAR must be normal
FOO_BAR and BAR_FOO must be normal
Unfortunately _FOO_BAR doesn't work but escaping \_FOO_BAR is always possible
@@ -0,0 +1,91 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/code/vim-markdown/spec/features/weak_emphasis.md.html</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="markdown">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="none">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.Constant { color: #c00000; }
.Bold { font-weight: bold; }
.Italic { font-style: italic; }
.Special { color: #c000c0; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
This is <span class="Special">_</span><span class="Italic">weak</span><span class="Special">_</span> emphasis
This is also <span class="Special">*</span><span class="Italic">weak</span><span class="Special">*</span> emphasis
This is <span class="Special">_</span><span class="Italic">multiple words</span><span class="Special">_</span> weak emphasis
This is also <span class="Special">*</span><span class="Italic">multiple words</span><span class="Special">*</span> weak emphasis
This is _ not valid _ because the start delimiter must be followed by something (not a space)
<span class="Special">*</span><span class="Italic">weak</span><span class="Special">*</span> emphasis could be the first word in the line
<span class="Special">_</span><span class="Italic">weak</span><span class="Special">_</span> emphasis could be the first word in the line
Weak <span class="Special">*</span><span class="Italic">emphasis</span>
<span class="Italic">could span</span><span class="Special">*</span> multiple lines
Weak <span class="Special">_</span><span class="Italic">emphasis</span>
<span class="Italic">could span</span><span class="Special">_</span> multiple lines
Weak <span class="Special">_</span><span class="Italic">emphasis </span><span class="Special">`</span><span class="Constant">could</span><span class="Special">`</span><span class="Italic"> contain</span><span class="Special">_</span> inline code
Weak <span class="Special">_</span><span class="Italic">emphasis </span><span class="Special">**</span><span class="Bold">could</span><span class="Special">**</span><span class="Italic"> contain</span><span class="Special">_</span> strong emphasis
The following is not a weak emphasis _
that span multiple lines
_ because the start delimiter must be followed by something (not the end of line)
The following is not a weak emphasis *
that span multiple
lines* because the start delimiter must be followed by something (not the end of line)
The usage of alternate delimiters must be idempotent, so all <span class="Special">_</span><span class="Italic">foo</span><span class="Special">_</span> <span class="Special">*</span><span class="Italic">foo</span><span class="Special">*</span> <span class="Special">_*</span><span class="Italic">foo</span><span class="Special">*_</span> <span class="Special">*_</span><span class="Italic">foo</span><span class="Special">_*</span> must be &quot;foo&quot; highlighted as italic
The same delimiter could not be used twice <span class="Special">**</span><span class="Bold">foo</span><span class="Special">**</span> and <span class="Special">__</span><span class="Bold">foo</span><span class="Special">__</span> must not be highlighted as italic
<span class="Special">_</span><span class="Italic">foo</span><span class="Special">_</span>_bar_ must be &quot;foo&quot; highlighted as italic followed by &quot;{UNDERSCORE}bar{UNDERSCORE}&quot; highlighted as normal
<span class="Special">_</span><span class="Italic">foo</span><span class="Special">_*</span><span class="Italic">bar</span><span class="Special">*</span> must be &quot;foo&quot; highlighted as italic followed by &quot;bar&quot; highlighted as italic
<span class="Special">_</span><span class="Italic">foo</span><span class="Special">_</span>b must be &quot;foo&quot; highlighted as italic followed by &quot;b&quot; highlighted as normal
<span class="Special">_</span><span class="Italic">foo</span><span class="Special">_</span>bar_baz_ must be &quot;foo&quot; highlighted as italic followed by &quot;bar{UNDERSCORE}baz{UNDERSCORE}&quot; highlighted as normal
<span class="Special">_</span><span class="Italic">foo</span><span class="Special">_</span>bar <span class="Special">_</span><span class="Italic">baz</span><span class="Special">_</span> must be &quot;foo&quot; and &quot;baz&quot; highlighted as italic and &quot;bar&quot; highlighted as normal
Two underscores __ or two asterisks ** must not be highlighted without something between them
Spaces do not count for something so _ _ and * * must be normal
FOO_BAR must be normal
FOO_BAR and BAR_FOO must be normal
Unfortunately <span class="Special">_</span><span class="Italic">FOO</span><span class="Special">_</span>BAR doesn't work but escaping \_FOO_BAR is always possible
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,48 @@
require "nokogiri"
require_relative "spec_helper"
features = [
"jekyll",
"lists",
"lists_with_tasks",
"lists_with_lists",
"lists_with_tables",
"lists_with_codeblocks",
"lists_with_fenced_codeblocks",
"lists_with_anchored_elements",
"autolinks",
"blockquotes",
"blockquotes_nested",
"combined_emphasis",
"contained_emphasis",
"strikethrough",
"headers_atx",
"headers_setext",
"strong_emphasis",
"weak_emphasis",
"inline_html",
"inline_links",
"inline_references",
"codeblocks",
"tables"
]
describe "github markdown syntax" do
let(:filename) {"syntax.html"}
features.each do |feature|
source = File.expand_path("./features/#{feature}.md", File.dirname(__FILE__))
master = source + ".html"
it "should support #{feature.gsub("_", " ")}" do
vim.command "let g:markdown_flavor=github"
vim.edit source
vim.command "TOhtml | w #{filename}"
if not File.exists?(master) or ENV["GENERATE_GOLDEN_MASTER"]
vim.command "w #{master}"
end
master_syntax = Nokogiri::HTML(IO.read(master))
source_syntax = Nokogiri::HTML(IO.read(filename))
expect(source_syntax.css("#vimCodeElement").first.to_s).to eq(master_syntax.css("#vimCodeElement").first.to_s)
end
end
end
@@ -0,0 +1,26 @@
require "nokogiri"
require_relative "spec_helper"
features = [
"kramdown/headers_with_id"
]
describe "kramdown markdown syntax" do
let(:filename) {"syntax.html"}
features.each do |feature|
source = File.expand_path("./features/#{feature}.md", File.dirname(__FILE__))
master = source + ".html"
it "should support #{feature.split(/\//).last.gsub("_", " ")}" do
vim.command "let g:markdown_flavor='kramdown'"
vim.edit source
vim.command "TOhtml | w #{filename}"
if not File.exists?(master) or ENV["GENERATE_GOLDEN_MASTER"]
vim.command "w #{master}"
end
master_syntax = Nokogiri::HTML(IO.read(master))
source_syntax = Nokogiri::HTML(IO.read(filename))
expect(source_syntax.css("#vimCodeElement").first.to_s).to eq(master_syntax.css("#vimCodeElement").first.to_s)
end
end
end
@@ -0,0 +1,40 @@
require "rspec"
require "vimrunner"
require "vimrunner/rspec"
RSpec.configure do |config|
config.formatter = :documentation
end
Vimrunner::RSpec.configure do |config|
plugin_path = File.expand_path("..", File.dirname(__FILE__))
config.reuse_server = false
config.start_vim do
vim = Vimrunner.start
vim.prepend_runtimepath(plugin_path)
vim.command "let g:markdown_include_jekyll_support = 1"
vim.command "set nospell"
vim.command "set nofoldenable"
vim
end
end
RSpec.configure do |config|
require_relative "support/vim"
config.include Support::Vim
config.after(:each) do
if File.exists? source
File.delete source
end
end
end
RSpec::Matchers.define :have_content do |expected|
match do |source|
File.read(source).match(expected)
end
failure_message_for_should do |source|
"expected file '#{source}' to match '#{expected}' but contains:\n'#{File.read(source)}'"
end
end
@@ -0,0 +1,16 @@
require "tmpdir"
module Support
module Vim
def source
File.join(Dir.tmpdir, filename)
end
def given_content(string)
vim.edit source
vim.insert string
yield source
end
end
end
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,30 @@
let b:markdown_in_jekyll=0
if getline(1) =~ '^---\s*$'
let b:markdown_in_jekyll=1
syn region markdownJekyllFrontMatter matchgroup=markdownJekyllDelimiter contains=@NoSpell
\ start="\%^---" end="^---$"
syn region markdownJekyllLiquidTag matchgroup=markdownJekyllDelimiter contains=@NoSpell oneline
\ start="{%" end="%}"
syn region markdownJekyllLiquidOutputTag matchgroup=markdownJekyllDelimiter contains=@NoSpell oneline
\ start="{{" skip=/"}}"/ end="}}"
syn region markdownJekyllLiquidBlockTag matchgroup=markdownJekyllDelimiter contains=@NoSpell
\ start="{%\s*\z(comment\|raw\|highlight\)[^%]*%}" end="{%\s*\%(no\|end\)\z1\s*%}"
silent spell! nocomment
silent spell! endcomment
silent spell! nohighlight
silent spell! endhighlight
silent spell! noraw
silent spell! endraw
hi def link markdownJekyllFrontMatter NonText
hi def link markdownJekyllLiquidTag NonText
hi def link markdownJekyllLiquidOutputTag NonText
hi def link markdownJekyllLiquidBlockTag NonText
hi def link markdownJekyllDelimiter Delimiter
endif
@@ -1,5 +0,0 @@
You can run the tests using the Makefile from the top directory:
make test
To run them manually please refer to the instructions/commands in the Makefile.
@@ -1,179 +0,0 @@
" Tests atx and setext folding, and :Toc.
Before:
source ../after/ftplugin/markdown.vim
setlocal foldtext=foldtext()
After:
setlocal foldexpr=0
setlocal foldmethod=manual
Given markdown;
# chap 1
hello
world
```bash
# some bash scripting
pwd
# this is another comment
# other
echo "foo"
```
## chap 1.1
- dog
- cat
~~~~bash
mkdir foo
# comment in ~
~~~~
### chap 1.1.1
- dragons
- fenixs
# chap 2
another
## chap 2.1
- uk
- japan
- china
# chap 3
nothing here
chap 4
======
setext are evil
chap 4.1
--------
evil indeed
````bash
# get system info
uname -a
````
Execute (fold level):
AssertEqual foldlevel(1), 0, '# chap 1'
AssertEqual foldlevel(3), 1, 'hello'
AssertEqual foldlevel(6), 1, '```bash'
AssertEqual foldlevel(7), 1, '# some bash scripting'
AssertEqual foldlevel(15), 1, '## chap 1.1'
AssertEqual foldlevel(21), 2, 'mkdir foo'
AssertEqual foldlevel(22), 2, 'comment in ~'
AssertEqual foldlevel(25), 2, '### chap 1.1.1'
AssertEqual foldlevel(27), 3, '- dragons'
AssertEqual foldlevel(30), 1, '# chap 2'
AssertEqual foldlevel(32), 1, 'another'
AssertEqual foldlevel(34), 1, '# chap 2.1'
AssertEqual foldlevel(37), 2, '- japan'
AssertEqual foldlevel(41), 1, '# chap 3'
AssertEqual foldlevel(45), 1, 'chap 4\n======'
AssertEqual foldlevel(48), 1, 'setext are evil'
AssertEqual foldlevel(50), 2, 'chap 4.1\n------'
Execute (fold text result):
AssertEqual foldtextresult(2), '+-- 28 lines: hello'
AssertEqual foldtextresult(31), '+-- 10 lines: another'
AssertEqual foldtextresult(42), '+-- 3 lines: nothing here'
AssertEqual foldtextresult(45), '+-- 14 lines: chap 4'
Execute (fold level with setting):
let g:vim_markdown_folding_level = 2
source ../after/ftplugin/markdown.vim
AssertEqual foldlevel(1), 0, '# chap 1'
AssertEqual foldlevel(3), 1, 'hello'
AssertEqual foldlevel(6), 1, '```bash'
AssertEqual foldlevel(7), 1, '# some bash scripting'
AssertEqual foldlevel(15), 0, '## chap 1.1'
AssertEqual foldlevel(21), 2, 'mkdir foo'
AssertEqual foldlevel(22), 2, 'comment in ~'
AssertEqual foldlevel(25), 2, '### chap 1.1.1'
AssertEqual foldlevel(27), 3, '- dragons'
AssertEqual foldlevel(30), 0, '# chap 2'
AssertEqual foldlevel(32), 1, 'another'
AssertEqual foldlevel(34), 0, '# chap 2.1'
AssertEqual foldlevel(37), 2, '- japan'
AssertEqual foldlevel(41), 0, '# chap 3'
AssertEqual foldlevel(45), 1, 'chap 4\n======'
AssertEqual foldlevel(48), 1, 'setext are evil'
AssertEqual foldlevel(50), 1, 'chap 4.1\n------'
let g:vim_markdown_folding_level = 0
Execute (check TOC):
:Toc
:lclose
let res = getloclist(0)
let elem = res[0]
AssertEqual elem.lnum, 1
AssertEqual elem.text, 'chap 1'
let elem = res[1]
AssertEqual elem.lnum, 15
AssertEqual elem.text, ' chap 1.1'
let elem = res[2]
AssertEqual elem.lnum, 25
AssertEqual elem.text, ' chap 1.1.1'
let elem = res[3]
AssertEqual elem.lnum, 30
AssertEqual elem.text, 'chap 2'
let elem = res[4]
AssertEqual elem.lnum, 34
AssertEqual elem.text, ' chap 2.1'
let elem = res[5]
AssertEqual elem.lnum, 41
AssertEqual elem.text, 'chap 3'
let elem = res[6]
AssertEqual elem.lnum, 45
AssertEqual elem.text, 'chap 4'
let elem = res[7]
AssertEqual elem.lnum, 50
AssertEqual elem.text, ' chap 4.1'
Given markdown;
---
layout: article
title: A test of the heading folding when there is YAML frontmatter
tags: markdown yaml vim-markdown
---
body
heading
-------
Execute (fold level of yaml front matter):
let g:vim_markdown_frontmatter = 1
source ../after/ftplugin/markdown.vim
AssertEqual foldlevel(1), 0, '---'
AssertEqual foldlevel(2), 0, 'layout: article'
AssertEqual foldlevel(4), 0, 'tags: markdown yaml vim-markdown'
AssertEqual foldlevel(5), 0, '---'
AssertEqual foldlevel(6), 0, 'body'
AssertEqual foldlevel(8), 2, 'heading'
AssertEqual foldlevel(9), 2, '-------'
unlet g:vim_markdown_frontmatter
Execute (check Toc of yaml front matter):
let g:vim_markdown_frontmatter = 1
:Toc
:lclose
let res = getloclist(0)
AssertEqual len(res), 1
let elem = res[0]
AssertEqual elem.lnum, 8
AssertEqual elem.text, ' heading'
unlet g:vim_markdown_frontmatter
@@ -1,53 +0,0 @@
Before:
source ../after/ftplugin/markdown.vim
After:
setlocal foldexpr=0
setlocal foldmethod=manual
Given markdown;
# Title
## Chapter 1
```
This is code block
# This is just a comment
```
## Capter 2
foobar
Execute (fold level # in code block):
AssertEqual foldlevel(1), 0, '# Title'
AssertEqual foldlevel(3), 1, '## Chapter 1'
AssertEqual foldlevel(7), 2, '# This is just a comment'
AssertEqual foldlevel(8), 2, '```'
AssertEqual foldlevel(10), 1, '## Chapter 2'
AssertEqual foldlevel(12), 2, 'foobar'
Given markdown;
Fold Level 1
============
Fold Level 2
------------
Execute (fold level ==, --):
AssertEqual foldlevel(2), 1, '=='
AssertEqual foldlevel(4), 2, '--'
Given markdown;
# H1
## H1.1
## H1.2
# H2
Execute (fold level # in last line):
AssertEqual foldlevel(1), 0, '# H1'
AssertEqual foldlevel(3), 1, '## H1.1'
AssertEqual foldlevel(5), 1, '## H1.2'
AssertEqual foldlevel(7), 0, '# H2'
@@ -1 +0,0 @@
ge test
@@ -1,116 +0,0 @@
Given markdown;
# a
## b
### c
#### d
##### e
Execute (HeaderIncrease without forbidden level):
:HeaderIncrease
Expect (increase level of all headers):
## a
### b
#### c
##### d
###### e
Given markdown;
# a
###### b
Execute (HeaderIncrease with forbidden level):
:HeaderIncrease
Expect (no changes):
# a
###### b
Given markdown;
## a
### b
#### c
##### d
###### e
Execute (HeaderDecrease without forbidden level):
:HeaderDecrease
Expect (decrease level of all headers):
# a
## b
### c
#### d
##### e
Given markdown;
# a
## b
### c
#### d
##### e
###### f
Execute (HeaderDecrease with forbidden level):
:HeaderDecrease
Expect (no changes):
# a
## b
### c
#### d
##### e
###### f
Given markdown;
a
=
b
-
Execute (HeaderIncrease with setext headers):
:HeaderIncrease
Expect (convert to atx headers):
## a
### b
Given markdown;
a
-
Execute (HeaderDecrease with setext headers):
:HeaderDecrease
Expect (convert to atx headers):
# a
@@ -1,15 +0,0 @@
Before:
let g:vim_markdown_new_list_item_indent = 2
After:
unlet g:vim_markdown_new_list_item_indent
Given markdown;
* item1
Do (new line from the first item of the list and add the second item):
o* item2
Expect (insert 2 spaces to the head of second item):
* item1
* item2
@@ -1,26 +0,0 @@
1. Confirm indent with new line insert after list items
'\' is not list item.
\ foo
If only space and three '*' or '-' character are in the line,
this line means horizontal item.
If current line is below horizontal item, it need not to indent.
Following example is horizontal item.
---
***
- - -
* * *
And list item must be specified space after [*-+].
Following example is list item.
* foo
- bar
+ baz
But following example is not list item.
*foo
-bar
+baz
@@ -1,73 +0,0 @@
Given markdown;
* item1
Do (insert enter at list end):
A\<cr>item2
Expect (auto insert * and indent level is same):
* item1
* item2
Given markdown;
Execute:
syntax off
Do (insert enter at list end with syntax off):
i* item1\<cr>item2
Expect (auto insert * and indent level is same):
* item1
* item2
Execute:
syntax on
Given markdown;
```
* item1
Do (insert after list items in code block):
jotext
Expect (no autoindent in code block):
```
* item1
text
Given markdown;
* item1
a
Do (insert enter after list):
jji\<cr>b
Expect (no autoindent outside list):
* item1
ba
Given markdown;
- a
# b
Do (insert header after list):
jjwi#
Expect (no indent header after list):
- a
## b
Given markdown;
* item1
Do (new line from the first item of the list and add the second item):
o* item2
Expect (insert 4 spaces to the head of second item):
* item1
* item2
@@ -1,147 +0,0 @@
Given markdown;
# a
## Foo Level 2
### Foo Level 3
#### Foo Level 4
Bar Level 2
-----------
### Bar Level 3
Execute (InsertToc format):
:2
:call append('.', '')
:InsertToc
Expect (format):
# a
* [Foo Level 2](#foo-level-2)
* [Foo Level 3](#foo-level-3)
* [Foo Level 4](#foo-level-4)
* [Bar Level 2](#bar-level-2)
* [Bar Level 3](#bar-level-3)
## Foo Level 2
### Foo Level 3
#### Foo Level 4
Bar Level 2
-----------
### Bar Level 3
Given markdown;
# a
## Foo Level 2
### Foo Level 3
#### Foo Level 4
Bar Level 2
-----------
### Bar Level 3
Execute (InsertToc only h2 headers):
:2
:call append('.', '')
:InsertToc 2
Expect (only h2 headers):
# a
* [Foo Level 2](#foo-level-2)
* [Bar Level 2](#bar-level-2)
## Foo Level 2
### Foo Level 3
#### Foo Level 4
Bar Level 2
-----------
### Bar Level 3
Given markdown;
# a
## Foo Level 2
### Foo Level 3
#### Foo Level 4
Bar Level 2
-----------
## Baz Level 2
## Foobar Level 2
## Foobaz Level 2
## Barfoo Level 2
## Barbaz Level 2
## Bazfoo Level 2
## Bazbar Level 2
## Foobarbaz Level 2
Execute (InsertNToc format, and up to h3 headers):
:2
:call append('.', '')
:InsertNToc 3
Expect (format, and up to h3 headers):
# a
1. [Foo Level 2](#foo-level-2)
* [Foo Level 3](#foo-level-3)
2. [Bar Level 2](#bar-level-2)
3. [Baz Level 2](#baz-level-2)
4. [Foobar Level 2](#foobar-level-2)
5. [Foobaz Level 2](#foobaz-level-2)
6. [Barfoo Level 2](#barfoo-level-2)
7. [Barbaz Level 2](#barbaz-level-2)
8. [Bazfoo Level 2](#bazfoo-level-2)
9. [Bazbar Level 2](#bazbar-level-2)
10. [Foobarbaz Level 2](#foobarbaz-level-2)
## Foo Level 2
### Foo Level 3
#### Foo Level 4
Bar Level 2
-----------
## Baz Level 2
## Foobar Level 2
## Foobaz Level 2
## Barfoo Level 2
## Barbaz Level 2
## Bazfoo Level 2
## Bazbar Level 2
## Foobarbaz Level 2
@@ -1,153 +0,0 @@
Given markdown;
a <http://b> c
Execute (gx autolink):
let b:url = 'http://b'
let b:line = getline(1)
let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition')
AssertEqual b:func(1, match(b:line, 'a') + 1), ''
AssertEqual b:func(1, match(b:line, '<') + 1), b:url
AssertEqual b:func(1, match(b:line, 'h') + 1), b:url
AssertEqual b:func(1, match(b:line, '>') + 1), b:url
AssertEqual b:func(1, match(b:line, 'c') + 1), ''
Given markdown;
a http://b.bb c
Execute (gx implicit autolink):
let b:url = 'http://b.bb'
let b:line = getline(1)
let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition')
AssertEqual b:func(1, match(b:line, 'a') + 1), ''
AssertEqual b:func(1, match(b:line, 'h') + 1), b:url
AssertEqual b:func(1, match(b:line, 'c') + 1), ''
Given markdown;
[a]: http://b "c"
Execute (gx link reference definition):
let b:url = 'http://b'
let b:line = getline(1)
let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition')
" TODO would be cool if all of the following gave the link.
AssertEqual b:func(1, match(b:line, 'a') + 1), ''
AssertEqual b:func(1, match(b:line, 'h') + 1), b:url
AssertEqual b:func(1, match(b:line, 'c') + 1), ''
Given markdown;
a [b](c) d
Execute (gx autolink):
let b:url = 'c'
let b:line = getline(1)
let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition')
AssertEqual b:func(1, match(b:line, 'a') + 1), ''
AssertEqual b:func(1, match(b:line, '[') + 1), b:url
AssertEqual b:func(1, match(b:line, 'b') + 1), b:url
AssertEqual b:func(1, match(b:line, ']') + 1), b:url
AssertEqual b:func(1, match(b:line, '(') + 1), b:url
AssertEqual b:func(1, match(b:line, 'c') + 1), b:url
AssertEqual b:func(1, match(b:line, ')') + 1), b:url
AssertEqual b:func(1, match(b:line, 'd') + 1), ''
Given markdown;
[ge_test.md](ge_test.md)
Execute (ge opens file):
normal ge
AssertEqual @%, 'ge_test.md'
AssertEqual getline(1), 'ge test'
Given markdown;
[ge_test](ge_test)
Execute (ge opens file without .md extensions):
let g:vim_markdown_no_extensions_in_markdown = 1
normal ge
AssertEqual @%, 'ge_test.md'
AssertEqual getline(1), 'ge test'
unlet g:vim_markdown_no_extensions_in_markdown
Given markdown;
[ge_test.md](ge_test.md)
Execute (ge does not write before opening file):
normal ia
normal l
normal ge
AssertEqual @%, 'ge_test.md'
AssertEqual getline(1), 'ge test'
Given markdown;
[ge_test.md](ge_test.md)
Execute (ge auto-write before opening file):
let g:vim_markdown_autowrite = 1
normal ia
normal l
AssertThrows normal ge
AssertEqual g:vader_exception, 'Vim(write):E382: Cannot write, ''buftype'' option is set'
unlet g:vim_markdown_autowrite
Given markdown;
# a
b
# c
d
Execute (]] same level):
AssertEqual line('.'), 1
normal ]]
AssertEqual line('.'), 5
normal [[
AssertEqual line('.'), 1
Given markdown;
# a
b
## c
d
Execute (]] different levels level):
AssertEqual line('.'), 1
normal ]]
AssertEqual line('.'), 5
normal [[
AssertEqual line('.'), 1
Given markdown;
# a
b
## c
d
# e
f
Execute (][ different levels level):
AssertEqual line('.'), 1
normal ][
AssertEqual line('.'), 9
normal []
AssertEqual line('.'), 1
Given markdown;
# a
b
Execute (]h):
normal! 3G
AssertEqual line('.'), 3
normal ]h
AssertEqual line('.'), 1
@@ -1,84 +0,0 @@
Before:
let g:vim_markdown_folding_style_pythonic = 1
source ../after/ftplugin/markdown.vim
After:
setlocal foldexpr=0
setlocal foldmethod=manual
Given markdown;
# Title
## Chapter 1
```
This is code block
# This is just a comment
```
## Chapter 2
foobar
Execute (fold level # in code block):
AssertEqual foldlevel(1), 1, '# Title'
AssertEqual foldlevel(3), 2, '## Chapter 1'
AssertEqual foldlevel(7), 2, '# This is just a comment'
AssertEqual foldlevel(8), 2, '```'
AssertEqual foldlevel(10), 2, '## Chapter 2'
AssertEqual foldlevel(12), 2, 'foobar'
Execute (fold text of chapters):
let b:width = winwidth(0)
let b:hyphen = repeat('-', b:width - 18 > 2 ? b:width - 18 : b:width - 9 > 0 ? 3 : 2)
AssertEqual foldtextresult(10), strpart('## Chapter 2', 0, b:width - 9) . ' ' . b:hyphen . ' 2'
Given markdown;
Fold text 1
===========
Fold text 2
-----------
Execute (fold level ==, --):
AssertEqual foldlevel(2), 0, '=='
AssertEqual foldlevel(4), 1, '--'
Execute (fold text of ==, --):
let b:width = winwidth(0)
let b:hyphen = repeat('-', b:width - 17 > 2 ? b:width - 17 : b:width - 9 > 0 ? 3 : 2)
AssertEqual foldtextresult(3), strpart('Fold text 2', 0, b:width - 9) . ' ' . b:hyphen . ' 1'
Given markdown;
Headline
foobar
# Title
Execute (fold any preamble):
AssertEqual foldlevel(1), 1, 'Headline'
AssertEqual foldlevel(3), 1, 'foobar'
AssertEqual foldlevel(5), 1, '# Title'
Given markdown;
---
layout: article
title: A test of the heading folding when there is YAML frontmatter
tags: markdown yaml vim-markdown
---
body
heading
-------
Execute (fold level of yaml front matter):
let g:vim_markdown_frontmatter = 1
source ../after/ftplugin/markdown.vim
AssertEqual foldlevel(1), 1, '---'
AssertEqual foldlevel(2), 1, 'layout: article'
AssertEqual foldlevel(4), 1, 'tags: markdown yaml vim-markdown'
AssertEqual foldlevel(5), 1, '---'
AssertEqual foldlevel(6), 1, 'body'
AssertEqual foldlevel(8), 1, 'heading'
AssertEqual foldlevel(9), 1, '-------'
unlet g:vim_markdown_frontmatter
@@ -1,16 +0,0 @@
#!/usr/bin/env bash
# Exit on error.
set -e
cd "$( dirname "${BASH_SOURCE[0]}" )"
for dep in ../build/tabular ../build/vim-toml ../build/vim-json ../build/vader.vim; do
if [[ ! -d $dep ]]; then
echo "Missing dependency: $dep"
echo "You may just want to use 'make test'."
exit 1
fi
done
vim -Nu vimrc -c 'Vader! *' > /dev/null
@@ -1,48 +0,0 @@
Given markdown;
# a
a
=
## b
b
-
Execute (SetexToAtx):
:SetexToAtx
Expect (convert setex-style headings to atx):
# a
# a
## b
## b
Given markdown;
a
=
b
=
c
-
d
-
Execute (SetexToAtx with range):
:1,8SetexToAtx
Expect (only convert setex headings in original range):
# a
# b
## c
d
-
@@ -1,41 +0,0 @@
Before:
let g:vim_markdown_strikethrough = 1
syn off | syn on
After:
unlet! g:vim_markdown_strikethrough
Given markdown;
a ~~b~~ c
Execute (strikethrough):
AssertNotEqual SyntaxOf('a'), 'mkdStrike'
AssertEqual SyntaxOf('b'), 'mkdStrike'
AssertNotEqual SyntaxOf('c'), 'mkdStrike'
Given markdown;
# ~~h1~~
## ~~h2~~
### ~~h3~~
#### ~~h4~~
##### ~~h5~~
###### ~~h6~~
Execute (strikethrough in atx headings):
AssertEqual SyntaxOf('h1'), 'mkdStrike'
AssertEqual SyntaxOf('h2'), 'mkdStrike'
AssertEqual SyntaxOf('h3'), 'mkdStrike'
AssertEqual SyntaxOf('h4'), 'mkdStrike'
AssertEqual SyntaxOf('h5'), 'mkdStrike'
AssertEqual SyntaxOf('h6'), 'mkdStrike'
Given markdown;
~~h1~~
=
~~h2~~
-
Execute (strikethrough in setext headings):
AssertEqual SyntaxOf('h1'), 'mkdStrike'
AssertEqual SyntaxOf('h2'), 'mkdStrike'
@@ -1,158 +0,0 @@
Before:
let g:vim_markdown_emphasis_multiline = 0
syn off | syn on
After:
let g:vim_markdown_emphasis_multiline = 1
syn off | syn on
Given markdown;
a **b** c
Execute (bold):
AssertNotEqual SyntaxOf('a'), 'htmlBold'
AssertEqual SyntaxOf('b'), 'htmlBold'
AssertNotEqual SyntaxOf('c'), 'htmlBold'
Given markdown;
a __b__ c
Execute (bold):
AssertNotEqual SyntaxOf('a'), 'htmlBold'
AssertEqual SyntaxOf('b'), 'htmlBold'
AssertNotEqual SyntaxOf('c'), 'htmlBold'
Given markdown;
a *b* c
Execute (italic):
AssertNotEqual SyntaxOf('a'), 'htmlItalic'
AssertEqual SyntaxOf('b'), 'htmlItalic'
AssertNotEqual SyntaxOf('c'), 'htmlItalic'
Given markdown;
a _b_ c
Execute (italic):
AssertNotEqual SyntaxOf('a'), 'htmlItalic'
AssertEqual SyntaxOf('b'), 'htmlItalic'
AssertNotEqual SyntaxOf('c'), 'htmlItalic'
Given markdown;
_a_b_
Execute (italic text has underscores):
AssertEqual SyntaxOf('a'), 'htmlItalic'
AssertEqual SyntaxOf('b'), 'htmlItalic'
Given markdown;
a \*b\* c
Execute (not italic with escaped asterisks):
AssertNotEqual SyntaxOf('a'), 'htmlItalic'
AssertNotEqual SyntaxOf('b'), 'htmlItalic'
AssertNotEqual SyntaxOf('c'), 'htmlItalic'
Given markdown;
a \_b\_ c
Execute (not italic with escaped underscores):
AssertNotEqual SyntaxOf('a'), 'htmlItalic'
AssertNotEqual SyntaxOf('b'), 'htmlItalic'
AssertNotEqual SyntaxOf('c'), 'htmlItalic'
Given markdown;
a _b\_c_ d
Execute (italic with escaped underscores):
AssertNotEqual SyntaxOf('a'), 'htmlItalic'
AssertEqual SyntaxOf('b'), 'htmlItalic'
AssertEqual SyntaxOf('c'), 'htmlItalic'
AssertNotEqual SyntaxOf('d'), 'htmlItalic'
Given markdown;
a_b_c
Execute (not italic underscores within text):
AssertNotEqual SyntaxOf('a'), 'htmlItalic'
AssertNotEqual SyntaxOf('b'), 'htmlItalic'
AssertNotEqual SyntaxOf('c'), 'htmlItalic'
Given markdown;
a *b\*c* d
Execute (italic with escaped asterisks):
AssertNotEqual SyntaxOf('a'), 'htmlItalic'
AssertEqual SyntaxOf('b'), 'htmlItalic'
AssertEqual SyntaxOf('c'), 'htmlItalic'
AssertNotEqual SyntaxOf('d'), 'htmlItalic'
Given markdown;
a __b\_\_c__ d
Execute (bold with escaped underscores):
AssertNotEqual SyntaxOf('a'), 'htmlBold'
AssertEqual SyntaxOf('b'), 'htmlBold'
AssertEqual SyntaxOf('c'), 'htmlBold'
AssertNotEqual SyntaxOf('d'), 'htmlBold'
Given markdown;
_a b
c_ d
Execute (italic with underscores in multiple lines):
AssertNotEqual SyntaxOf('a'), 'htmlItalic'
AssertNotEqual SyntaxOf('b'), 'htmlItalic'
AssertNotEqual SyntaxOf('c'), 'htmlItalic'
AssertNotEqual SyntaxOf('d'), 'htmlItalic'
Given markdown;
__a b
c__ d
Execute (bold with underscores in multiple lines):
AssertNotEqual SyntaxOf('a'), 'htmlBold'
AssertNotEqual SyntaxOf('b'), 'htmlBold'
AssertNotEqual SyntaxOf('c'), 'htmlBold'
AssertNotEqual SyntaxOf('d'), 'htmlBold'
Given markdown;
___a b
c___ d
Execute (bold italic with underscores in multiple lines):
AssertNotEqual SyntaxOf('a'), 'htmlBoldItalic'
AssertNotEqual SyntaxOf('b'), 'htmlBoldItalic'
AssertNotEqual SyntaxOf('c'), 'htmlBoldItalic'
AssertNotEqual SyntaxOf('d'), 'htmlBoldItalic'
Given markdown;
*a b
c* d
Execute (italic with asterisks in multiple lines):
AssertNotEqual SyntaxOf('a'), 'htmlItalic'
AssertNotEqual SyntaxOf('b'), 'htmlItalic'
AssertNotEqual SyntaxOf('c'), 'htmlItalic'
AssertNotEqual SyntaxOf('d'), 'htmlItalic'
Given markdown;
**a b
c** d
Execute (bold with asterisks in multiple lines):
AssertNotEqual SyntaxOf('a'), 'htmlBold'
AssertNotEqual SyntaxOf('b'), 'htmlBold'
AssertNotEqual SyntaxOf('c'), 'htmlBold'
AssertNotEqual SyntaxOf('d'), 'htmlBold'
Given markdown;
***a b
c*** d
Execute (bold italic with asterisks in multiple lines):
AssertNotEqual SyntaxOf('a'), 'htmlBoldItalic'
AssertNotEqual SyntaxOf('b'), 'htmlBoldItalic'
AssertNotEqual SyntaxOf('c'), 'htmlBoldItalic'
AssertNotEqual SyntaxOf('d'), 'htmlBoldItalic'
@@ -1,89 +0,0 @@
# Fenced code living in an indented environment is correctly highlighted
1. run this command to do this:
```
some command
```
2. Subsequent list items are correctly highlighted.
Fenced code block with language:
```ruby
def f
0
end
```
# Links
[a](b "c")
[a]()
[good spell](a)
[badd spell](a)
[a](b "c")
[a]( b
"c" )
a (`a`) b. Fix: <https://github.com/preservim/vim-markdown/issues/113>
Escaped:
\[a](b)
[a\]b](c)
## Known failures
Escape does not work:
[a\](b)
Should not be links because of whitespace:
[a] (b)
[a](a
b)
[a](a b)
# Reference links
Single links:
[a][b]
[good spell][a]
[badd spell][a]
[a][]
[a] []
[a][b] c [d][e]
Reference link followed by inline link:
[a] [b](c)
## Known failures
Should be shortcut reference links:
[a]
[a] b [c]
Should be a single link:
[a] [b]
[a] b [c](d)
File diff suppressed because it is too large Load Diff
@@ -1,85 +0,0 @@
Before:
let &gdefault = 1
After:
let &gdefault = 0
Given markdown;
| normal |no space| 2 spaces ||
| - |-| --- ||
| normal |no space| 2 spaces ||
Execute (format unformatted table):
TableFormat
Expect (table is formatted):
| normal | no space | 2 spaces | |
|--------|----------|----------|--|
| normal | no space | 2 spaces | |
Given markdown;
| a | b |
|---|---|
| c | d |
Execute (format well formatted table):
TableFormat
Expect (table is not modified):
| a | b |
|---|---|
| c | d |
Given markdown (indented table);
| a | b |
|---|---|
| c | d |
Execute (format well formatted, indented table):
TableFormat
Expect (table is not modified):
| a | b |
|---|---|
| c | d |
Given markdown;
| left |right| center ||
| :- | --: |:---:|:|
| left |right| center ||
Execute (format table with colons):
TableFormat
Expect (preserve colons to align text):
| left | right | center | |
|:-----|------:|:------:|:--|
| left | right | center | |
Given markdown (indented table with colons);
| left |right| center ||
| :- | --: |:---:|:|
| left |right| center ||
Execute (format indented table with colons):
TableFormat
Expect (preserve colons to align text):
| left | right | center | |
|:-----|------:|:------:|:--|
| left | right | center | |
Given markdown (borderless table);
left |right| center
:- | --: |:---:
left |right| center
Execute (format borderless table):
let g:vim_markdown_borderless_table = 1
TableFormat
unlet g:vim_markdown_borderless_table
Expect (table with borders):
| left | right | center |
|:-----|------:|:------:|
| left | right | center |
@@ -1,53 +0,0 @@
" Tests toc window auto-fit to longest header, but without exceeding half screen.
Given markdown;
# chap 1
# chap 2
# chap 3
# chap 4
# chap 5
# chap 6
# chap 7
# chap 8
# chap 9
# chap 10
# chap 11
# chap 12
## chap 12.1
### chap 12.1.1
#### chap 12.1.1.1
##### chap 12.1.1.1.1
###### chap 12.1.1.1.1.1
# chap 13
Execute (toc window autofit width):
set number
let g:vim_markdown_toc_autofit = 1
let line = '###### chap 12.1.1.1.1.1'
AssertEqual getline('33'), line
:Toc
let real_width = winwidth(0)
:lclose
let expected_width = len(line) + 2*5 + 1 + 3 - 7
AssertEqual real_width, expected_width
set nonumber
" 2 spaces * 5 additional header levels + 1 space for first header +
" 3 spaces for line numbers - 7 chars ('###### ') that don't show up on the TOC
@@ -1,181 +0,0 @@
Given markdown;
# a
Execute (Toc does not set nomodifiable on other files):
" Sanity check.
Assert &modifiable
:Toc
:lclose
:edit a
Assert &modifiable
Given markdown;
header 1
========
test
header 2
--------
test
### header 3
test
Execute (Toc setex headers):
:Toc
Expect (setex headers):
header 1
header 2
header 3
Given markdown;
# header 1
test
## header 2
test
### header 3
test
Execute (Toc atx headers):
:Toc
Expect (atx headers):
header 1
header 2
header 3
Given markdown;
ATX tests.
# h1 space
#h1 nospace
# h1 2 spaces
# h1 trailing hash #
## h2 space
##h2 nospace
## h2 trailing hash ##
### h3 space
###h3 nospace
### h3 trailing hash ###
#### h4
##### h5
###### h6
---
Relative positions.
# h1 before h2
## h2 between h1s
# h1 after h2
---
Setex tests.
setex h1
========
setex h2
--------
setex h1 single punctuation
=
setex h1 punctuation longer than header
================================
Prevent list vs Setex confusion:
- not Setex
- because list
---
Mixed tests.
setex h1 before atx
===================
## atx h2
### atx h3
# atx h1
setex h2
------------------
### atx h3 2
Execute (Toc multiple headers):
:Toc
Expect (multiple headers):
h1 space
h1 nospace
h1 2 spaces
h1 trailing hash
h2 space
h2 nospace
h2 trailing hash
h3 space
h3 nospace
h3 trailing hash
h4
h5
h6
h1 before h2
h2 between h1s
h1 after h2
setex h1
setex h2
setex h1 single punctuation
setex h1 punctuation longer than header
setex h1 before atx
atx h2
atx h3
atx h1
setex h2
atx h3 2
Execute:
:lclose
Given markdown;
# header 1
## header 2
### header 3
Execute (Toc cursor on the current header):
normal! G
:Toc
AssertEqual line('.'), 3
:lclose
@@ -1,31 +0,0 @@
set nocompatible
let $LANG='en_US'
filetype off
set runtimepath+=../
set runtimepath+=../build/tabular/
set runtimepath+=../build/vim-toml/
set runtimepath+=../build/vim-json/
set runtimepath+=../build/vader.vim/
filetype on
filetype plugin indent on
syntax enable
function! Markdown_GetScriptID(fname) abort
let l:snlist = ''
redir => l:snlist
silent! scriptnames
redir END
let l:mx = '^\s*\(\d\+\):\s*\(.*\)$'
for l:line in split(l:snlist, "\n")
if stridx(substitute(l:line, '\\', '/', 'g'), a:fname) >= 0
return substitute(l:line, l:mx, '\1', '')
endif
endfor
endfunction
function! Markdown_GetFunc(fname, funcname) abort
return function('<SNR>' . Markdown_GetScriptID(a:fname) . '_' . a:funcname)
endfunction