Flavored markdown
Command line tool that output HTML from a github flavored markdown file.
Installation:
npm install -g flavored-markdown
Or
npm install flavored-markdown
Global Usage:
flavored-markdown < markdown.md > markdown.html
Or for better file escaping text
flavored-markdown "$(< markdown.md)" > markdown.html
Or
flavored-markdown "Some *markdown*" > markdown.html
Library usage:
import Markdown from 'flavored-markdown'
const markdown = new Markdown()
markdown.html("some *markdown*").then(html => console.log(html))
If you want a full html with html tag and css in the header:
import Markdown from 'flavored-markdown'
const markdown = new Markdown(true)
markdown.html("some *markdown*").then(html => console.log(html))
Contribute
You can find this project at this GitHub repository
How to use with VIM
In your vimrc or gvimrc:
"Convert to html when save .md files
autocmd BufWritePost *.md :silent !flavored-markdown < '%:p' > /var/tmp/markdown.html
"Show the results with F9 key
autocmd BufNewFile,Bufread *.md imap <F9> <esc>:!google-chrome /var/tmp/markdown.html<cr>i
autocmd BufNewFile,Bufread *.md map <F9> :!google-chrome /var/tmp/markdown.html<cr>
"put a marker in char 80
autocmd BufNewFile,Bufread *.md set cc=80
This automatically create a temporary file /var/tmp/markdown.html when you save your .md files.
Syntax highlighting
If you are a VIM user and you want syntax highlighting or matching rules for Markdowns, look at this project.