News archive 2019 site home


The new MarkMarkup.vim plugin is a great companion to the popular Mark.vim plugin. With it, you can render the highlightings as HTML (or any other markup), and therefore "export" them into a commonplace format. This paragraph has been marked with the following highlightings (which have been extracted via :MarkYankDefinitions):

1Mark! /\<MarkMarkup\>/
2Mark! /Mark/
3Mark! /\<Mark/
6Mark! /\<popular\>/
7Mark! /\<markup\>\|\<format\>\|\<HTML\>/
13Mark! /\<highlightings\>/
14Mark! /lighting/
15Mark! /light/
16Mark! /igh/
21Mark! /\<great\>/

Then, we used the :MarkMarkup css command MarkMarkup.vim to surround each highlighted string with <span> tags that reference CSS classes. (We could have skipped the indirection via CSS classes and gone for direct style acodeributes via :MarkMarkup html.) The CSS definitions were then inserted into the page via :PutMarkLookup css.

.MarkMarkup css
0PutMarkLookup css

I often highlight interesting keywords and errors in log files (or functions in source code; see here for a simple example). Often, the analysis results have to be published in an email, or Wiki page, or JavaDoc. As all of those support HTML, I can now simply convert my Mark.vim highlightings to markup, and I'm done. (Previously, I had duplicated a few color definitions in custom surround with span tag mappings for HTML, and used them on the search result or visual selections. It's much more comfortable and less error-prone now.)

To try this out, you need Vim as your editor, and the following plugins: