Socket
Socket
Sign inDemoInstall

mdast-util-to-hast

Package Overview
Dependencies
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdast-util-to-hast

mdast utility to transform to hast


Version published
Weekly downloads
6.4M
increased by7.33%
Maintainers
2
Weekly downloads
 
Created

What is mdast-util-to-hast?

The mdast-util-to-hast package is a utility that allows for the transformation of MDAST (Markdown Abstract Syntax Tree) to HAST (Hypertext Abstract Syntax Tree). This is particularly useful for applications that need to convert markdown content into HTML or other formats that can be more easily manipulated or displayed in web environments.

What are mdast-util-to-hast's main functionalities?

Convert MDAST to HAST

This feature allows for the conversion of a markdown document represented as an MDAST into a HAST. The code sample demonstrates how to use unified with the remark-parse plugin to parse markdown into MDAST, and then convert that MDAST into HAST using mdast-util-to-hast.

const unified = require('unified')
const markdown = require('remark-parse')
const toHAST = require('mdast-util-to-hast')

unified()
  .use(markdown)
  .use(() => tree => toHAST(tree))
  .process('# Hello world!', function (err, file) {
    if (err) throw err
    console.log(file)
  })

Other packages similar to mdast-util-to-hast

Keywords

FAQs

Package last updated on 07 Jun 2024

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