npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

to-markdown-cli

v2.0.0

Published

a little cli to turn html to markdown

Downloads

649

Readme

to-markdown-cli

All Contributors Node CI npm GitHub last commit FOSSA Status

Installation

npm install -g to-markdown-cli

Usage

Usage: html2md [options]

Options:
  -V, --version          output the version number
  -i, --input <input>    path to the input file (if input is stdin) it will be ignored
  -o, --output <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 inputs

    Examples:
        $ 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 "<h1>foo</h1>" | html2md # will output to stdout

    Acknowledgments:
        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:

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):

This project follows the all-contributors specification. Contributions of any kind welcome!

Test

npm run test

Acknowledgements

Build on these great modules:

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