# html2md [](#contributors-) [](LICENSE) [](http://godoc.org/github.com/suntong/html2md) [](https://goreportcard.com/report/github.com/suntong/html2md) [](https://github.com/suntong/html2md/actions/workflows/go-release-build.yml) [](http://godoc.org/github.com/go-easygen/wireframe) ## TOC - [html2md - HTML to Markdown converter](#html2md---html-to-markdown-converter) - [Usage](#usage) - [$ html2md](#-html2md) - [Examples](#examples) - [Simplest form](#simplest-form) - [Using goquery](#using-goquery) - [The options and plugins](#the-options-and-plugins) - [Testing the new table plugins](#testing-the-new-table-plugins) - [Credits](#credits) - [Credits](#credits-1) - [Similar Projects](#similar-projects) - [Install Debian/Ubuntu package](#install-debianubuntu-package) - [Download/install binaries](#downloadinstall-binaries) - [The binary executables](#the-binary-executables) - [Distro package](#distro-package) - [Debian package](#debian-package) - [Install Source](#install-source) - [Author](#author) - [Contributors](#contributors-) ## html2md - HTML to Markdown converter The `html2md` makes use of `github.com/JohannesKaufmann/html-to-markdown` to convert HTML into Markdown, which is using an [HTML Parser](https://github.com/PuerkitoBio/goquery) to avoid the use of `regexp` as much as possible, which can prevent some [weird cases](https://stackoverflow.com/a/1732454) and allows it to be used for cases where the input is totally unknown.  ## Usage ### $ html2md ```sh HTML to Markdown Version 1.1.0 built on 2023-05-03 Copyright (C) 2020-2023, Tong Sun HTML to Markdown converter on command line Usage: html2md [Options...] Options: -h, --help display help information -i, --in *The html/xml file to read from (or stdin) -d, --domain Domain of the web page, needed for links when --in is not url -s, --sel CSS/goquery selectors [=body] -x, --excl Excluding CSS/goquery selectors --xc Excluding all children nodes -v, --verbose Verbose mode (Multiple -v options increase the verbosity.) --opt-heading-style Option HeadingStyle --opt-horizontal-rule Option HorizontalRule --opt-bullet-list-marker Option BulletListMarker --opt-code-block-style Option CodeBlockStyle --opt-fence Option Fence --opt-em-delimiter Option EmDelimiter --opt-strong-delimiter Option StrongDelimiter --opt-link-style Option LinkStyle --opt-link-reference-style Option LinkReferenceStyle --opt-escape-mode Option EscapeMode -A, --plugin-conf-attachment Plugin ConfluenceAttachments -C, --plugin-conf-code Plugin ConfluenceCodeBlock -F, --plugin-frontmatter Plugin FrontMatter -G, --plugin-gfm Plugin GitHubFlavored -S, --plugin-strikethrough Plugin Strikethrough -T, --plugin-table Plugin Table --plugin-table-compat Plugin TableCompat -L, --plugin-task-list Plugin TaskListItems -V, --plugin-vimeo Plugin VimeoEmbed -Y, --plugin-youtube Plugin YoutubeEmbed ``` ### Examples #### Simplest form ```md $ html2md -i https://github.com/suntong/html2md | head -3 [Skip to content](#start-of-content) [Homepage](https://github.com/) ``` #### Using goquery The most useful feature is to use and pass a [goquery](https://github.com/PuerkitoBio/goquery) selection to filter for the content you want. ```md $ html2md -i https://github.com/JohannesKaufmann/html-to-markdown -s "div.my-3" [go](http://github.com/topics/go "Topic: go") [html](http://github.com/topics/html "Topic: html") [markdown](http://github.com/topics/markdown "Topic: markdown") [golang](http://github.com/topics/golang "Topic: golang") [converter](http://github.com/topics/converter "Topic: converter") [html-to-markdown](http://github.com/topics/html-to-markdown "Topic: html-to-markdown") [goquery](http://github.com/topics/goquery "Topic: goquery") ``` ### The options and plugins Works as expected: ```sh $ echo 'Bold Text' | html2md -i **Bold Text** $ echo 'Bold Text' | html2md -i --opt-strong-delimiter="__" __Bold Text__ $ echo '
suntong 💻 🤔 🎨 🔣 ⚠️ 🐛 📖 📝 💡 ✅ 🔧 📦 👀 💬 🚧 🚇 |
VPanteleev-S7 💻 🐛 📓 |
itdoginfo 🐛 📓 |
somename123 🐛 🤔 📓 |
vivook 🐛 📓 |
097115 🐛 🤔 📓 |
James Reynolds 👀 📢 📓 |
ImportTaste 💻 🐛 📓 |