let g:vim_markdown_conceal = 0
```
+To disable math conceal with LaTeX math syntax enabled, add the following to your `.vimrc`:
+
+```vim
+let g:tex_conceal = ""
+let g:vim_markdown_math = 1
+```
+
### Fenced code block languages
You can use filetype name as fenced code block languages for syntax highlighting.
### Do not require .md extensions for Markdown links
-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:
+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:
```vim
let g:vim_markdown_no_extensions_in_markdown = 1
### Auto-write when following link
-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:
+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:
```vim
let g:vim_markdown_autowrite = 1
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
- return -1
+ if a:lnum == line('$')
+ return matchend(l1, '^#\+') - 1
+ else
+ return -1
+ endif
else
" headers are not folded
return 0
endif
if l0 =~ '^#' && !s:is_mkdCode(a:lnum-1)
- " current line starts with hashes
+ " previous line starts with hashes
return '>'.matchend(l0, '^#\+')
else
" keep previous foldlevel
3. TOML Front Matter |vim-markdown-toml-front-matter|
4. JSON Front Matter |vim-markdown-json-front-matter|
10. Adjust new list item indent |vim-markdown-adjust-new-list-item-indent|
+ 11. Do not require .md extensions for Markdown links
+ |vim-markdown-do-not-require-.md-extensions-for-markdown-links|
+ 12. Auto-write when following link
+ |vim-markdown-auto-write-when-following-link|
4. Mappings |vim-markdown-mappings|
5. Commands |vim-markdown-commands|
6. Credits |vim-markdown-credits|
Level 1 heading which is served as a document title is not folded.
'g:vim_markdown_folding_level' setting is not active with this fold style.
-To prevent foldtext from being overridden, add the following to your '.vimrc':
-
+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 ~
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 'bold', 'bold', 'italic bold', and 'italic bold' respectively.
+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.
>
>
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
+<
-------------------------------------------------------------------------------
*vim-markdown-fenced-code-block-languages*
Fenced code block languages ~
>
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 ~
+
+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 ~
+
+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-mappings*
Mappings ~
syn region mkdFootnotes matchgroup=mkdDelimiter start="\[^" end="\]"
execute 'syn region mkdID matchgroup=mkdDelimiter start="\[" end="\]" contained oneline' . s:conceal
execute 'syn region mkdURL matchgroup=mkdDelimiter start="(" end=")" contained oneline' . s:conceal
-execute 'syn region mkdLink matchgroup=mkdDelimiter start="\\\@<!!\?\[" end="\n\{-,1}[^]]\{-}\zs\]\ze[[(]" contains=@mkdNonListItem,@Spell nextgroup=mkdURL,mkdID skipwhite oneline' . s:concealends
+execute 'syn region mkdLink matchgroup=mkdDelimiter start="\\\@<!!\?\[\ze[^]\n]*\n\?[^]\n]*\][[(]" end="\]" contains=@mkdNonListItem,@Spell nextgroup=mkdURL,mkdID skipwhite' . s:concealends
" Autolink without angle brackets.
" mkd inline links: protocol optional user:pass@ sub/domain .com, .co.uk, etc optional port path/querystring/hash fragment
syn region mkdInlineURL matchgroup=mkdDelimiter start="\\\@<!<\ze[a-z][a-z0-9,.-]\{1,22}:\/\/[^> ]*>" end=">"
" Link definitions: [id]: URL (Optional Title)
-syn region mkdLinkDef matchgroup=mkdDelimiter start="^ \{,3}\zs\[" end="]:" oneline nextgroup=mkdLinkDefTarget skipwhite
+syn region mkdLinkDef matchgroup=mkdDelimiter start="^ \{,3}\zs\[\^\@!" end="]:" oneline nextgroup=mkdLinkDefTarget skipwhite
syn region mkdLinkDefTarget start="<\?\zs\S" excludenl end="\ze[>[:space:]\n]" contained nextgroup=mkdLinkTitle,mkdLinkDef skipwhite skipnl oneline
syn region mkdLinkTitle matchgroup=mkdDelimiter start=+"+ end=+"+ contained
syn region mkdLinkTitle matchgroup=mkdDelimiter start=+'+ end=+'+ contained
if get(g:, 'vim_markdown_math', 0)
syn include @tex syntax/tex.vim
- syn region mkdMath start="\\\@<!\$" end="\$" contains=@tex keepend
- syn region mkdMath start="\\\@<!\$\$" end="\$\$" contains=@tex keepend
+ syn region mkdMath start="\\\@<!\$" end="\$" skip="\\\$" contains=@tex keepend
+ syn region mkdMath start="\\\@<!\$\$" end="\$\$" skip="\\\$" contains=@tex keepend
endif
syn cluster mkdNonListItem contains=@htmlTop,htmlItalic,htmlBold,htmlBoldItalic,mkdFootnotes,mkdInlineURL,mkdLink,mkdLinkDef,mkdLineBreak,mkdBlockquote,mkdCode,mkdRule,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6,mkdMath
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'
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
AssertEqual SyntaxOf('b'), 'mkdLink'
AssertEqual SyntaxOf('c'), 'mkdURL'
+Given markdown;
+[a] b [c](d)
+
+Execute (link text with bracket sections):
+ AssertNotEqual SyntaxOf('a'), 'mkdLink'
+ AssertNotEqual SyntaxOf('b'), 'mkdLink'
+ AssertEqual SyntaxOf('c'), 'mkdLink'
+ AssertEqual SyntaxOf('d'), 'mkdURL'
+
+Given markdown;
+[^a]: b
+
+Execute (footnote is not link):
+ AssertNotEqual SyntaxOf('a'), 'mkdLinkDef'
+
Given markdown;
(a)