Skip to content

Commit

Permalink
Allow toggling of syntax concealing (#99)
Browse files Browse the repository at this point in the history
Add `let g:markdown_syntax_conceal = 0` to your vimrc
  • Loading branch information
robhurring authored and tpope committed May 8, 2016
1 parent 4260faa commit 5c21f16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ documents you can enable it in your `.vimrc` like so:

let g:markdown_fenced_languages = ['html', 'python', 'bash=sh']

To disable markdown syntax concealing add the following to your vimrc:

let g:markdown_syntax_conceal = 0

## License

Copyright © Tim Pope. Distributed under the same terms as Vim itself.
Expand Down
5 changes: 4 additions & 1 deletion syntax/markdown.vim
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" conta
syn region markdownId matchgroup=markdownIdDelimiter start="\[" end="\]" keepend contained
syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline

let s:concealends = has('conceal') ? ' concealends' : ''
let s:concealends = ''
if has('conceal') && get(g:, 'markdown_syntax_conceal', 1) == 1
let s:concealends = ' concealends'
endif
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart' . s:concealends
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart' . s:concealends
exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends
Expand Down

0 comments on commit 5c21f16

Please sign in to comment.