JSPM

markdown-to-txt

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 96932
  • Score
    100M100P100Q164256F
  • License MIT

Convert markdown to plain text

Package Exports

  • markdown-to-txt

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 (markdown-to-txt) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

markdown-to-txt

Converts 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.

Installation

To install

npm install markdown-to-txt

Usage

markdown-to-txt exports a single function for conversion. Call it like so

const { markdownToTxt } = require('markdown-to-txt');

markdownToTxt('Some *quoted* `*code*`'); // "Some quoted *code*"

Or in TypeScript/ES modules

import markdownToTxt from 'markdown-to-txt';

markdownToTxt('Some *quoted* `*code*`'); // "Some quoted *code*"

markdownToTxt allows for options object. to be passed as a second argument. The following options are available:

Option Default Description
escapeHtml true Escapes HTML in the final string
gfp true Uses GitHub flavour markdown (passed through to marked)
pedantic false Conform to markdown.pl (passed through to marked)

Contact

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