Convert markdown to plain text
npm install markdown-to-txtConverts markdown to plain text. Uses marked to correctly parse and produce a clean version of the text. This correctly handles markdown elements like code blocks, unlike similar libraries. TypeScript declarations are provided out of the box.
To install
```
npm install markdown-to-txt
markdown-to-txt exports a single function for conversion. Call it like so
`js
const { markdownToTxt } = require('markdown-to-txt');
markdownToTxt('Some quoted code'); // "Some quoted code"`
Or in TypeScript/ES modules
`ts
import markdownToTxt from 'markdown-to-txt';
markdownToTxt('Some quoted code'); // "Some quoted code"`
markdownToTxt accepts MarkedOptions
as its second argument.
NOTE: The output of markdownToTxt is not sanitized. The output may contain
valid HTML, JavaScript, etc. Be sure to sanitize if the output is intended for
web use.
- 2.0.0
- Options argument for markdownToTxt changed to align with latest version of marked.escapeHtml` option removed
-
Feel free to send be bug reports or feature requests. If you are interested in my other work, checkout my website.
Email root@ejrbuss.net