rich-editor-to-markdown-parser
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

rich-editor-to-markdown-parser

Convert microCMS Rich Editor response to Markdown.

スクリーンショット 0005-12-09 14 26 25

Installation

npm install rich-editor-to-markdown-parser

Usage

import parse from 'rich-editor-to-markdown-parser';

const html = '<h1>Hello World!</h1><p>This <strong>html</strong> string is <s>convert</s>into <a href="https://exampe.com">markdown.</a></p>'

parse(html); // # Hello World!\n\nThis **html** string is ~~convert~~ into [markdown.](https://exampe.com)

※ Unsupported HTML tags are parsed as strings. When converting markdown to HTML, consider sanitizing it using DOMPurify or sanitize-html.

HTML list

HTML Description
Heading
Bold
Italic
Underline Parsed with HTML tags
Strike
Code
TextAlign Not supported
Horizontal Rule
Blockquote
CodeBlock
Table
ListBullet
ListOrdered
Link
Image
Embed Not supported
Custom class Parsed with HTML tags

Options

Option Description Defualt
image.size Contain width and height image size. ex) ?w=1200&h=630 true
image.query Add image query in markdown. ex) ?format=webp ''
markStyle.strong ** or __ **
markStyle.em * or _ *
markStyle.li * or - or + *
markStyle.hr --- or *** or ___ ---
markStyle.pre ``` or ~~~ ```

Readme

Keywords

Package Sidebar

Install

npm i rich-editor-to-markdown-parser

Weekly Downloads

8

Version

1.1.1

License

MIT

Unpacked Size

57.6 kB

Total Files

9

Last publish

Collaborators

  • hiro08