plain text extractor plugin for markdown-it markdown parser
npm install markdown-it-plain-text!GitHub
!GitHub Workflow Status

!GitHub file size in bytes

> plain text extractor for markdown-it
``shell`
npm install markdown-it-plain-text
`js
const MarkdownIt = require('markdown-it');
const plainText = require('markdown-it-plain-text');
const md = new MarkdownIt();
md.use(plainText);
md.render('your markdown content')
// Here are plain text result
md.plainText
`
If you load the script directly into the page without using a package system, the module will add itself globally with the name markdownItPlainTextPlugin. Init code will look a bit different in this case:
`js`
const md = window.markdownit().use(window.markdownItPlainTextPlugin);
ts
(md as any).plainText
`
or
`ts
// @ts-ignore
md.plainText
`
Generation rule
1. extract
text, fence, html_block, code_block,code_inline, html_inline, emoji content directly
2. add space` at closing tag to prevent words from sticking together