New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-html-markdown

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-html-markdown

Fast HTML to markdown cross-compiler, compatible with both node and the browser

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
98K
decreased by-29.91%
Maintainers
1
Weekly downloads
 
Created

What is node-html-markdown?

The node-html-markdown package is a tool for converting HTML content into Markdown format. It is useful for developers who need to transform HTML documents into a more readable and lightweight Markdown format, which is often used for documentation, blogging, and other text-based content.

What are node-html-markdown's main functionalities?

Basic HTML to Markdown Conversion

This feature allows you to convert basic HTML elements like headings and paragraphs into Markdown. The code sample demonstrates how to use the NodeHtmlMarkdown class to translate a simple HTML string into Markdown.

const { NodeHtmlMarkdown } = require('node-html-markdown');
const html = '<h1>Hello World</h1><p>This is a paragraph.</p>';
const markdown = NodeHtmlMarkdown.translate(html);
console.log(markdown);

Customizing Conversion Options

This feature allows you to customize the conversion process by providing options. In the code sample, the strong delimiter is customized to use double underscores instead of the default asterisks.

const { NodeHtmlMarkdown } = require('node-html-markdown');
const html = '<h1>Hello World</h1><p>This is a paragraph.</p>';
const options = { strongDelimiter: '__' };
const markdown = NodeHtmlMarkdown.translate(html, options);
console.log(markdown);

Handling Complex HTML Structures

This feature demonstrates the package's ability to handle more complex HTML structures, such as lists and nested elements. The code sample shows how a div containing a heading and an unordered list is converted into Markdown.

const { NodeHtmlMarkdown } = require('node-html-markdown');
const html = '<div><h1>Title</h1><ul><li>Item 1</li><li>Item 2</li></ul></div>';
const markdown = NodeHtmlMarkdown.translate(html);
console.log(markdown);

Other packages similar to node-html-markdown

Keywords

FAQs

Package last updated on 13 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc