diff options
| author | Tong Sun <[email protected]> | 2023-05-02 23:43:14 -0400 |
|---|---|---|
| committer | Tong Sun <[email protected]> | 2023-05-02 23:43:14 -0400 |
| commit | fbd899d43983e7e4a8aa49f95d15ccf6c906a552 (patch) | |
| tree | a83dc2472f6c6d67c047da2411cb6c48290a8fe8 /README.md | |
| parent | - [+] add all-contributors initial settings & separated READMEs (diff) | |
| download | html2md-fbd899d43983e7e4a8aa49f95d15ccf6c906a552.tar.xz html2md-fbd899d43983e7e4a8aa49f95d15ccf6c906a552.zip | |
- [#] update README
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 154 |
1 files changed, 108 insertions, 46 deletions
@@ -1,28 +1,30 @@ +# html2md +<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> +[](#contributors-) +<!-- ALL-CONTRIBUTORS-BADGE:END --> [](LICENSE) [](http://godoc.org/github.com/suntong/html2md) [](https://goreportcard.com/report/github.com/suntong/html2md) -[](https://travis-ci.org/suntong/html2md) -[](http://godoc.org/github.com/go-easygen/wireframe) +[](https://github.com/suntong/html2md/actions/workflows/go-release-build.yml) +[](http://godoc.org/github.com/go-easygen/wireframe) -# TOC + + +## 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) + - [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) -- [Download/Install](#downloadinstall) - - [Download binaries](#download-binaries) - - [Install Source](#install-source) -- [Credits & Authors](#credits-&-authors) + - [Testing the new table plugins](#testing-the-new-table-plugins) - [Credits](#credits) - - [Similar Projects](#similar-projects) - - [Author(s) & Contributor(s)](#author(s)-&-contributor(s)) + - [Credits](#credits-1) + - [Similar Projects](#similar-projects) -# html2md - HTML to Markdown converter +## 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. @@ -30,13 +32,13 @@ to convert HTML into Markdown, which is using an [HTML Parser](https://github.co  -# Usage +## Usage ### $ html2md ```sh HTML to Markdown -Version 0.2.01 built on 2020-08-08 -Copyright (C) 2020, Tong Sun +Version 1.0.0 built on 2023-05-02 +Copyright (C) 2020-2023, Tong Sun HTML to Markdown converter on command line @@ -60,6 +62,7 @@ Options: --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 @@ -73,9 +76,9 @@ Options: -Y, --plugin-youtube Plugin YoutubeEmbed ``` -# Examples +### Examples -## Simplest form +#### Simplest form ```md $ html2md -i https://github.com/suntong/html2md | head -3 @@ -84,7 +87,7 @@ $ html2md -i https://github.com/suntong/html2md | head -3 [Homepage](https://github.com/) ``` -## Using goquery +#### 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. @@ -93,7 +96,7 @@ $ html2md -i https://github.com/JohannesKaufmann/html-to-markdown -s "div.Border ``` -## The options and plugins +### The options and plugins Works as expected: @@ -113,7 +116,7 @@ $ echo 'Only <del>blue ones</del> <s> left</s>' | html2md -i --plugin-strikethro Only ~blue ones~ ~left~ ``` -## Testing the new table plugins +#### Testing the new table plugins ```sh $ cat $GOPATH/src/github.com/JohannesKaufmann/html-to-markdown/testdata/TestPlugins/table/input.html | html2md -i -T | head -6 @@ -146,47 +149,106 @@ $ cat $GOPATH/src/github.com/JohannesKaufmann/html-to-markdown/testdata/TestPlug + ``` -# Download/Install - +## Credits -## Download binaries -- The latest binary executables are available right under the github release page -https://github.com/suntong/html2md/releases -as the result of the Continuous-Integration process. -- I.e., they are built during every git tagged push, automatically by [GitHub Actions](https://github.com/features/actions), right from the source code, truely WYSIWYG. -- The `.deb`, `.rpm` and `.apk` packages are readily available, as well as the executables for other Linux and Windows as well. -- Pick & choose the binary executable that suits your OS and its architecture. E.g., for Linux, it would most probably be the `html2md_ver_linux_amd64.tar.gz` file. -- Unzip it and put the executable somewhere in the PATH, after downloading it. +### Credits +- [Johannes Kaufmann's html-to-markdown](https://github.com/JohannesKaufmann/html-to-markdown) that does the heavy lifting behind the scene. -## Install Source +### Similar Projects -To install the source code instead: +- [turndown (js)](https://github.com/domchristie/turndown), a very good library written in javascript. +- [lunny/html2md](https://github.com/lunny/html2md), which is using [regex instead of goquery](https://stackoverflow.com/a/1732454), which exhibits a few edge cases which prompted `github.com/JohannesKaufmann/html-to-markdown` +- [jaytaylor/html2text](https://github.com/jaytaylor/html2text), which is not converting to markdown but plain text. -``` -go install github.com/suntong/html2md@latest +## Download/install binaries + +- The latest binary executables are available +as the result of the Continuous-Integration (CI) process. +- I.e., they are built automatically right from the source code at every git release by [GitHub Actions](https://docs.github.com/en/actions). +- There are two ways to get/install such binary executables + * Using the **binary executables** directly, or + * Using **packages** for your distro + +### The binary executables + +- The latest binary executables are directly available under +https://github.com/suntong/html2md/releases/latest +- Pick & choose the one that suits your OS and its architecture. E.g., for Linux, it would be the `html2md_verxx_linux_amd64.tar.gz` file. +- Available OS for binary executables are + * Linux + * Mac OS (darwin) + * Windows +- If your OS and its architecture is not available in the download list, please let me know and I'll add it. +- The manual installation is just to unpack it and move/copy the binary executable to somewhere in `PATH`. For example, + +``` sh +tar -xvf html2md_*_linux_amd64.tar.gz +sudo mv -v html2md_*_linux_amd64/html2md /usr/local/bin/ +rmdir -v html2md_*_linux_amd64 ``` -# Credits & Authors +### Distro package -## Credits +- [Packages available for Linux distros](https://cloudsmith.io/~suntong/repos/repo/packages/) are + * [Alpine Linux](https://cloudsmith.io/~suntong/repos/repo/setup/#formats-alpine) + * [Debian](https://cloudsmith.io/~suntong/repos/repo/setup/#formats-deb) + * [RedHat](https://cloudsmith.io/~suntong/repos/repo/setup/#formats-rpm) -- [Johannes Kaufmann's html-to-markdown](github.com/JohannesKaufmann/html-to-markdown) that does the heavy lifting behind the scene. +The repo setup instruction url has been given above. +For example, for [Debian](https://cloudsmith.io/~suntong/repos/repo/setup/#formats-deb) -- -## Similar Projects +### Debian package -- [turndown (js)](https://github.com/domchristie/turndown), a very good library written in javascript. -- [lunny/html2md](https://github.com/lunny/html2md), which is using [regex instead of goquery](https://stackoverflow.com/a/1732454), which exhibits a few edge cases which prompted `github.com/JohannesKaufmann/html-to-markdown` -- [jaytaylor/html2text](https://github.com/jaytaylor/html2text), which is not converting to markdown but plain text. -## Author(s) & Contributor(s) +```sh +curl -1sLf \ + 'https://dl.cloudsmith.io/public/suntong/repo/setup.deb.sh' \ + | sudo -E bash + +# That's it. You then can do your normal operations, like + +sudo apt-get update +apt-cache policy html2md + +sudo apt-get install -y html2md +``` + +## Install Source + +To install the source code instead: + +``` +go install github.com/suntong/html2md +``` + +## Author Tong SUN  +_Powered by_ [**WireFrame**](https://github.com/go-easygen/wireframe) [](http://godoc.org/github.com/go-easygen/wireframe) -_Powered by_ [**WireFrame**](https://github.com/go-easygen/wireframe), the _one-stop wire-framing solution_ for Go cli based projects, from start to deploy. +the _one-stop wire-framing solution_ for Go cli based projects, from _init_ to _deploy_. + +## Contributors ✨ + +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + +<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> +<!-- prettier-ignore-start --> +<!-- markdownlint-disable --> +<table> + <tr> + <td align="center"><a href="https://github.com/suntong"><img src="https://avatars.githubusercontent.com/u/422244?v=4?s=100" width="100px;" alt=""/><br /><sub><b>suntong</b></sub></a><br /><a href="https://github.com/go-cc/cc2py2/commits?author=suntong" title="Code">💻</a> <a href="#ideas-suntong" title="Ideas, Planning, & Feedback">🤔</a> <a href="#design-suntong" title="Design">🎨</a> <a href="#data-suntong" title="Data">🔣</a> <a href="https://github.com/go-cc/cc2py2/commits?author=suntong" title="Tests">⚠️</a> <a href="https://github.com/go-cc/cc2py2/issues?q=author%3Asuntong" title="Bug reports">🐛</a> <a href="https://github.com/go-cc/cc2py2/commits?author=suntong" title="Documentation">📖</a> <a href="#blog-suntong" title="Blogposts">📝</a> <a href="#example-suntong" title="Examples">💡</a> <a href="#tutorial-suntong" title="Tutorials">✅</a> <a href="#tool-suntong" title="Tools">🔧</a> <a href="#platform-suntong" title="Packaging/porting to new platform">📦</a> <a href="https://github.com/go-cc/cc2py2/pulls?q=is%3Apr+reviewed-by%3Asuntong" title="Reviewed Pull Requests">👀</a> <a href="#question-suntong" title="Answering Questions">💬</a> <a href="#maintenance-suntong" title="Maintenance">🚧</a> <a href="#infra-suntong" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td> + </tr> +</table> + +<!-- markdownlint-restore --> +<!-- prettier-ignore-end --> + +<!-- ALL-CONTRIBUTORS-LIST:END --> -All patches welcome. +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! |