1.1.1 • Published 5 months ago

rich-editor-to-markdown-parser v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

rich-editor-to-markdown-parser

Convert microCMS Rich Editor response to Markdown.

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

HTMLDescription
Heading
Bold
Italic
UnderlineParsed with HTML tags
Strike
Code
TextAlignNot supported
Horizontal Rule
Blockquote
CodeBlock
Table
ListBullet
ListOrdered
Link
Image
EmbedNot supported
Custom classParsed with HTML tags

Options

OptionDescriptionDefualt
image.sizeContain width and height image size. ex) ?w=1200&h=630true
image.queryAdd image query in markdown. ex) ?format=webp''
markStyle.strong** or __**
markStyle.em* or _*
markStyle.li* or - or +*
markStyle.hr--- or *** or ___---
markStyle.preor ~~~ |
1.1.1

5 months ago

1.1.0

5 months ago

1.0.0

5 months ago

0.0.5

5 months ago

0.0.3

5 months ago

0.0.2

5 months ago

0.0.1

5 months ago