1.0.1 • Published 5 months ago

markdown-to-quill-delta v1.0.1

Weekly downloads
152
License
ISC
Repository
-
Last release
5 months ago

NPM
Build Status

Markdown to Quill Delta converter

Converts Markdown to Quill Delta using remark.

Status

FeatureStatus
Paragraphs
Headers
Text
Strong
Emphasis
Delete
Code blocks
Quote blocks
Lists
Checkboxes
Links✅¹
Images
Custom Extension

¹: reference-style links are not yet supported

Usage

import markdownToDelta from 'markdown-to-quill-delta'
const ops = markdownToDelta(markdown)

Custom Extension:

import markdownToDelta from 'markdown-to-quill-delta'
const input = '---'
const ops = markdownToDelta(input, {
  handle: ({ node, ops }) => {
    if (node.type === 'thematicBreak') {
      ops.push(
        {
          attributes: {
            class: 'cut-off',
          },
          insert: {
            'cut-off': {
              type: '0',
              url: 'https://i0.hdslb.com/bfs/article/0117cbba35e51b0bce5f8c2f6a838e8a087e8ee7.png',
            },
          },
        },
        {
          insert: '\n',
        },
      )
      return true
    }
  },
})

What about Delta to Markdown?

See here.

License

Developed by Sebastian Frysztak.
Licensed under ISC License.