Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8
Command line tool that converts HTML to markdown.
License
jaywcjlove/html-to-markdown-cli
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
HTML conversion tool to markdown. Command line tool =>@wcj/html-to-markdown-cli.
This package isESM only: Node 14+ is needed to use it and it must be import instead of require.
npm i @wcj/html-to-markdown
Command line tool
$ npx @wcj/html-to-markdown-cli ./html/index.html# 🌐 Request: /Users/xxx/index.html# 🎉 Compliled successfully!# ╰┈ Output: /Users/xxx/dist/index.md$ npx @wcj/html-to-markdown-cli https://jaywcjlove.github.io/idoc/# 🌐 Request: https://jaywcjlove.github.io/idoc/# 🎉 Compliled successfully!# ╰┈ Output: /Users/xxx/dist/idoc.md# Or$ sudo npm i @wcj/html-to-markdown-cli -g$ html-to-markdown ./html/index.html# 🌐 Request: /Users/xxx/html/index.html# 🎉 Compliled successfully!# ╰┈ Output: /Users/xxx/html/dist/index.md$ html-to-markdown https://jaywcjlove.github.io/idoc/# 🌐 Request: https://jaywcjlove.github.io/idoc/# 🎉 Compliled successfully!# ╰┈ Output: /Users/xxx/dist/idoc.md
Command Help
Usage: html-to-markdown<URL|file path|-> [options] [--help|h] [--version|v]Passing"-" as the first arg will take input from STDINOptions: -v, --version, Show version number -h, --help, Displayshelp information. -o, --output<dir-path>, Output directory. defalut(dist) -s, --stdout, Output to stdoutExample: html-to-markdown ./html/index.html html-to-markdown https://jaywcjlove.github.io/idoc/ html-to-markdown --output="dist"echo"<h1>hello world</h1>"| html-to-markdown - --stdout
Support Config
In the project's root directory, add a.htm2mdrc.js file with the following configuration to enable therehype andremark plugins.
/** *@typedef {import("@wcj/html-to-markdown").Options} Options *@type {Options} **/exportdefault{rehypeParseOption:{},rehypePlugins:[],remarkPlugins:[],};
importhtmlToMarkdownfrom'@wcj/html-to-markdown';htmlToMarkdown({html:'<h1>Markdown String</h1>'});// => # Markdown String
import{PluggableList}from'unified';import{OptionsasRehypeParseOptions}from'rehype-parse';declaretypeOptions={html?:string;url?:string;rehypeParseOption?:RehypeParseOptions;/** * List of [remark plugins](https://github.com/remarkjs/remark/blob/main/doc/plugins.md#list-of-plugins) to use. * See the next section for examples on how to pass options */remarkPlugins?:PluggableList;/** * List of [rehype plugins](https://github.com/rehypejs/rehype/blob/main/doc/plugins.md#list-of-plugins) to use. * See the next section for examples on how to pass options */rehypePlugins?:PluggableList;};exportdefaultfunctionhtmlToMarkdown(options?:Options):Promise<string>;
$ npm i$ npm install --workspaces$ npm run build$ npm run build:cli
- markdown-to-html-cli Command line tool that converts markdown to HTML.
As always, thanks to our amazing contributors!
Made withcontributors.
Licensed under theMIT License.
About
Command line tool that converts HTML to markdown.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.