Dependency-free and lean DOM parser that outputs Markdown
npm install domador
> Dependency-free and lean DOM parser that outputs Markdown
You can use it on the server-side as well, thanks to [jsdom][1]. The client-side version leverages the browser DOM. Originally based on [html-md][3].
You can get it on npm.
``shell`
npm install domador --save
Or bower, too.
`shell`
bower install domador --save
Converts DOM tree _(or HTML string)_ input into Markdown. domador takes the following options.
##### absolute
Convert relative links into absolute ones automatically.
##### href
The document's href, necessary for the absolute option to work properly outside of a browser environment.
##### inline
Links _(foo)_ and image sources _(!foo)_ are inlined. By default, they are added as footnote references [foo][1]\n\n[1]: /bar.
##### fencing
The western art of combat with [rapiers][2] or rapier-like swords. It can also be set to true to use fences like instead of spaces when delimiting code blocks.
##### fencinglanguage
If fencing is enabled, fencinglanguage can be a function that will run on every
element and returns the appropriate language in the fence. If theelement contains aelement as its first child,fencinglanguagewill be executed for that element as well in search of a match.md-lang-{language}If nothing is returned, a language won't be assigned to the fence. The example below returns fence languages according to a
class found on thepreelement.`js`
function fencinglanguage (el) {
var match = el.className.match(/md-lang-((?:[^\s]|$)+)/);
if (match) {
return match.pop();
}
}allowFrame#####
allowFrameWhen set to a function,
receives thesrcattribute for an