Search code examples
htmlvimsyntaxmarkdownremarks

How can I make vim use html and markdown syntax highlighting on the same file?


I use remark to make html slides from markdown code in vim.

Remark requires to use an html template containing both html and markdown code in it.

How can I make vim use both html and markdown syntax highlighting on the same html file?


Solution

  • The default Markdown syntax plugin (by Tim Pope) that ships with Vim already includes HTML syntax. From $VIMRUNTIME/syntax/markdown.vim:

    " Vim syntax file
    " Language:     Markdown
    " Maintainer:   Tim Pope <[email protected]>
    " Filenames:    *.markdown
    " Last Change:  2013 May 30
    
    [7 lines deleted]
    
    runtime! syntax/html.vim
    unlet! b:current_syntax