Skip to content

syntax-tree/hast-util-to-mdast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hast-util-to-mdast Build Status Coverage Status

Transform HAST (HTML) to MDAST (markdown).

This is stable in versioning now, but may change a bit in the future.

See GH-3 for progress.

Installation

npm:

npm install hast-util-to-mdast

Usage

var rehype = require('rehype');
var remark = require('remark');
var toMDAST = require('hast-util-to-mdast');

var hast = rehype().parse('<h2>Hello <strong>world!</strong></h2>');
var doc = remark().stringify(toMDAST(hast));
console.log(doc);

Yields:

## Hello **world!**

API

toMDAST(node[, options])

Transform the given HAST tree to an MDAST tree.

options.handlers
  • Object mapping tag-names to functions handling those elements. Take a look at handlers/ for examples.

Related

License

MIT © Titus Wormer

About

utility to transform hast (HTML) to mdast (markdown)

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors 12