h2m
Tool for converting HTML to Markdown, like html2markdown.
online converter: http://island205.github.io/h2m/
Install
$npm install h2m
How to use
h2m(html[, options])
example
var h2m = var md = // md = '# Hello World'
options
converter
: the converter you can choose. now supportCommonMark
(default) andMarkdownExtra
overides
: custom converter behavior:
Command Line Tool
install
$ npm install h2m -g
usage
$h2m -h
Options:
-V, --version output the version number
-f, --file <file> HTML file path or an url adress (default: )
-c, --clipboard read HTML from clipboard
-h, --help output usage information
Convert a local file:
$ h2m -f index.html converting HTML to Markdown made by [@island205] Can't be convert? welcome to submit an [issue](https://github.com/island205/h2m/issues/new).
Convert an online url:
$ h2m -f https://baidu.com
Convert from clipboard:
$ h2m -c
Save result:
$ h2m -f https://google.com > google.md
Support
h2m
supports standard Markdown sytax: CommonMark now and Markdown Extra.
CommonMark
- ✅ br
- ✅ em
- ✅ strong
- ✅ code
- ✅ a
- ✅ img
- ✅ hr
- ✅ ul, ol
- ✅ pre
- ✅ div
- ✅ p
- ✅ blockquote
- ✅ h1 ~ h6
Markdown Extra
- ✅ Special Attributes for headers link and image
- ✅ Fenced Code Blocks
- ✅ dl, dt, dd Definition Lists
- ✅ abbr Abbreviations
- ✅ table (tks @天凉's PR')
Contribution
PRs are welcome to implement other extend Markdown language, like Markdown Extra, GFM and so on.