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

@such-n-such/tangent-html-to-markdown

v0.1.1

Published

A utility for converting html (especially pasted markdown) to markdown suitable for consumption by Tangent.

Downloads

4

Readme

Tangent's HTML to Markdown

This package converts an HTML string to the specific needs and desires of Tangent's flavor of markdown. This is currently used as the converter when copy/pasting text from the web or other rich text sources that provide text/html data when copied.

The current implementation wraps Turndown with many custom rules and pre/post-processing to get the desired result.

Design Goals

The overarching goal is that when you copy/paste text from the web or other source, pasting it into Tangent should result in something as close as possible to the source given the restrictions of Markdown.

This includes basics like bold and italic text or links, but this package also makes some attempts to make apparent line spacing match in a reasonable fashion. How this is achieved will be heavily dependent on the source.

Bug Reports

Is Tangent not handling a copy/paste in the way you expect? Open an issue describing the problem!

The most helpful bug reports will have the source html in the clipboard. When you paste a clipboard containing text/html data into Tangent, Tangent prints out the content of that data to the window's developer console (open with Ctrl+Shift-i or Cmd+Opt+i). Including this in a bug report along with the output you're seeing and the output you expect will help a lot when fixing problems.

Contributing & Bug Reports

This package is published so that enterprising Tangent users can provide new test cases and new updates to those test cases. See the tests/ and tests/compare-files.test.ts for existing tests.

The source text/html data logged to the Tangent developer console can be used as the source for a test (e.g. my-pasted-problem.html). An accompanying .md file (my-pasted-problem.md) is then used as the expected output that the actual parser will be compared against. A small update to compare-files.test.ts (which should be essentially self-explanatory given the existing examples) adds the input/output pair to the test suite.

The ideal pull request includes both the input and expected output files as well as any necessary updates to the parsing system that solve the parsing problem.

Pull requests that just add input/output pairs are also great! Those branches can be used as the basis for PRs that include the solution to whatever problem exists.