Package Exports
- turndown
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (turndown) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Turndown
Convert HTML into Markdown with JavaScript.
Note this is currently a work-in-progress to replace https://github.com/domchristie/to-markdown. It is pre-release software. API changes are likely.
Installation
npm:
npm install turndown
Browser:
<script src="https://unpkg.com/turndown/dist/turndown.js"></script>
Usage
// For Node.js
var TurndownService = require('turndown')
var turndownService = new TurndownService()
var markdown = turndownService.turndown('<h1>Hello world!</h1>')
Options
Options can be passed in to the constructor on instantiation.
Option | Valid values | Default |
---|---|---|
headingStyle |
setext or atx |
setext |
hr |
Any Thematic break | * * * |
bulletListMarker |
- , + , or * |
* |
codeBlockStyle |
indented or fenced |
indented |
fence |
``` or ~~~ |
``` |
emDelimiter |
_ or * |
_ |
strongDelimiter |
** or __ |
** |
linkStyle |
inlined or referenced |
inlined |
linkReferenceStyle |
full , collapsed , or shortcut |
full |
License
turndown is copyright © 2017+ Dom Christie and released under the MIT license.