Markdown syntax script using the new conceal feature

504 views
Skip to first unread message

Peter Odding

unread,
Jul 21, 2010, 11:53:44 PM7/21/10
to vim_dev
Hi list,

Last night I switched to Vim 7.3 and one of the first things I wanted to
try was the new conceal feature. A perfect test subject for me was
Markdown text formatting because its goal is to be very readable but its
syntax rules kind of get in the way of readability :-) (IMHO).

After some late night hacking I now have a ~/.vim/syntax/mkd.vim script
which can conceal most of the extra syntax in Markdown texts and I
really like it so far. Thanks to everyone who made this possible!

I don't know how far the conceal feature is supposed to be pushed (e.g.
my syntax script hides full URLs which can more or less span a whole
screen line...) but during testing I found that it's not really
compatible with the 'wrap' option, at least not unless you like very
jagged paragraphs :-(

I've attached the syntax script and a test case (a README from one of my
Vim plug-ins with a lot of inline hyper links that make the text hard to
follow without the conceal feature) for anyone who's interested. These
two files could make a good test case for the line wrapping bug, if
indeed it is considered a bug and can be fixed with reasonable effort (I
suppose if concealing can make full screen lines disappear that might
complicate Vim's drawing code significantly...)

- Peter Odding

mkd.vim
README.md

Adam Monsen

unread,
Oct 28, 2011, 6:36:39 PM10/28/11
to vim...@googlegroups.com
Awesome, Peter!

Did this ever make it upstream? I've been a big fan of conceal with other languages (HTML, LaTeX), it would be great to get this patched into Vim proper.

Peter Odding

unread,
Nov 25, 2011, 10:55:14 PM11/25/11
to vim...@googlegroups.com
Hi Adam,

Sorry for taking a while to respond. No I never specifically submitted
the syntax script for inclusion anywhere, because there was already a
Markdown syntax script in the Vim runtime files and back then I didn't
start with that script, I wrote my own.

However I've now created a fork of the official Markdown syntax script
and applied the needed changes to that script. The fork is available at
https://github.com/xolox/vim-markdown and I've submitted a pull request
at https://github.com/tpope/vim-markdown/pull/9 so that the changes may
eventually make it upstream.

However I'm not sure if Tim Pope will like my changes because I tried to
preserve compatibility with Vim 7.2 (without the conceal feature) and
this results in a lot of code duplication.

- Peter

Reply all
Reply to author
Forward
0 new messages