Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ff6347/to-markdown-cli
a command line tool for turning html to markdown
https://github.com/ff6347/to-markdown-cli
cli converter html markdown
Last synced: 5 days ago
JSON representation
a command line tool for turning html to markdown
- Host: GitHub
- URL: https://github.com/ff6347/to-markdown-cli
- Owner: ff6347
- License: mit
- Created: 2017-04-05T08:13:59.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-10-29T17:08:37.000Z (3 months ago)
- Last Synced: 2024-10-29T18:37:34.360Z (3 months ago)
- Topics: cli, converter, html, markdown
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/to-markdown-cli
- Size: 1.73 MB
- Stars: 32
- Watchers: 1
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# to-markdown-cli
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg)](#contributors) ![Node CI](https://github.com/ff6347/to-markdown-cli/workflows/Node%20CI/badge.svg) ![npm](https://img.shields.io/npm/v/to-markdown-cli?color=green) ![GitHub last commit](https://img.shields.io/github/last-commit/ff6347/to-markdown-cli)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fff6347%2Fto-markdown-cli.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fff6347%2Fto-markdown-cli?ref=badge_shield)## Installation
npm install -g to-markdown-cli
## Usage
```plain
Usage: html2md [options]Options:
-V, --version output the version number
-i, --input path to the input file (if input is stdin) it will be ignored
-o, --output path to the output file
-c, --clipboard use only the clipboard for input and output
-g, --gfm use GitHub Flavored Markdown
-h, --help output usage information_ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \
( h | t | m | l | 2 | m | d )
\_/ \_/ \_/ \_/ \_/ \_/ \_/html2md turns html into markdown
- if no input file is given it ueses the clipboard content
- if no output file is given it logs the result to stdout
- if there is input from stdin clipboard will be ignored for inputsExamples:
$ html2md -i ./foo.html # output to stdout
$ html2md -i ./foo.html -o out.md # output to out.md
$ html2md -o out.md # clipboard to out.md
$ html2md -c # clipboard to clipboard
$ html2md # clipboard to stdout
$ html2md -g # clipboard to stdout using GitHub flavored markdown
$ echo "foo
" | html2md # will output to stdoutAcknowledgments:
Build on these great modules:
- https://github.com/domchristie/turndown
- https://github.com/sindresorhus/clipboardy
- https://github.com/tj/commander.js
```## Troubleshooting
The following error indicates that `$DISPLAY` is not set to a valid display: `Error: Both xsel and fallback failed`
**html2md** relies on a valid `$DISPLAY` because it uses clipboard via **xsel**.
In some environments (for example, **tmux**) you may need to run the command as follows:```plain
DISPLAY=:0 html2md ... # or whatever your display id is.
```Fully headless systems may not be able to use **html2md**.
## Contributors
Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
roose
π»
Fabian MorΓ³n Zirfas
π»
cayhorstmann
π
akomakom
π π
thenbe
π€
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
## Test
```bash
npm run test
```## Acknowledgements
Build on these great modules:
- [domchristie/turndown: An HTML to Markdown converter written in JavaScript](https://github.com/domchristie/turndown)
- [sindresorhus/clipboardy: Access the system clipboard (copy/paste)](https://github.com/sindresorhus/clipboardy)
- [tj/commander.js: node.js command-line interfaces made easy](https://github.com/tj/commander.js)## Related Projects
- suntong/html2md: HTML to Markdown converter https://github.com/suntong/html2md
- JohannesKaufmann/html-to-markdown: βοΈ Convert HTML to Markdown. Even works with entire websites and can be extended through rules. https://github.com/JohannesKaufmann/html-to-markdown
- thebigbone/markhtml: a fast CLI tool for converting markdown to html https://github.com/thebigbone/markhtml
- letmutex/htmd: A turndown.js inspired HTML to Markdown converter for Rust https://github.com/letmutex/htmd
- romansky/dom-to-semantic-markdown: DOM to Semantic-Markdown for use in LLMs https://github.com/romansky/dom-to-semantic-markdown