let g:vim_markdown_conceal = 0
```
+### Fenced code block 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:
+
+```vim
+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']`.
+
### Syntax extensions
The following options control which syntax extensions will be turned on. They are off by default.
6. Text emphasis restriction to single-lines
|vim-markdown-text-emphasis-restriction-to-single-lines|
7. Syntax Concealing |vim-markdown-syntax-concealing|
- 8. Syntax extensions |vim-markdown-syntax-extensions|
+ 8. Fenced code block languages |vim-markdown-fenced-code-block-languages|
+ 9. 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|
>
let g:vim_markdown_conceal = 0
<
+-------------------------------------------------------------------------------
+ *vim-markdown-fenced-code-block-languages*
+Fenced code block 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-syntax-extensions*
Syntax extensions ~
command! -buffer Toct call s:Toc('tab')
" Heavily based on vim-notes - http://peterodding.com/code/vim/notes/
-let s:filetype_dict = {
- \ 'c++': 'cpp',
- \ 'viml': 'vim',
- \ 'bash': 'sh',
- \ 'ini': 'dosini'
-\ }
+if exists('g:vim_markdown_fenced_languages')
+ let s:filetype_dict = {}
+ for s:filetype in g:vim_markdown_fenced_languages
+ let key = matchstr(s:filetype, "[^=]*")
+ let val = matchstr(s:filetype, "[^=]*$")
+ let s:filetype_dict[key] = val
+ endfor
+else
+ let s:filetype_dict = {
+ \ 'c++': 'cpp',
+ \ 'viml': 'vim',
+ \ 'bash': 'sh',
+ \ 'ini': 'dosini'
+ \ }
+endif
function! s:MarkdownHighlightSources(force)
" Syntax highlight source code embedded in notes.
AssertEqual SyntaxOf('g:a'), 'vimVar'
AssertEqual SyntaxOf('g:b'), 'vimVar'
+Given markdown;
+```csharp
+var s = "foo";
+```
+
+Execute (fenced code block languages setting):
+ let g:vim_markdown_fenced_languages = ['csharp=cs']
+ source ../ftplugin/markdown.vim
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
+ call b:func(0)
+ AssertEqual SyntaxOf('foo'), 'csString'
+ unlet g:vim_markdown_fenced_languages
+
Given markdown;
```a+b-
code