# quilljs-markdown

> Markdown for Quill Editor

Latest version **1.2.0** (published 2022-07-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install quilljs-markdown
pnpm add quilljs-markdown
yarn add quilljs-markdown
bun add quilljs-markdown
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2022-07-21 |
| First published | 2018-12-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 272.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 205 |
| Author | cloverhearts |
| Maintainers | cloverhearts |
| Keywords | quill, quilljs, markdown, editor |

## Links

- npm: https://www.npmjs.com/package/quilljs-markdown
- Repository: https://github.com/cloverhearts/quilljs-markdown
- Homepage: https://cloverhearts.github.io/quilljs-markdown
- Issues: https://github.com/cloverhearts/quilljs-markdown/issues
- npm.io page: https://npm.io/package/quilljs-markdown

## Dependencies (2)

- [core-js](https://npm.io/package/core-js.md) ^3.23.5
- [regenerator-runtime](https://npm.io/package/regenerator-runtime.md) ^0.13.9

## Alternatives

- [ext-list](https://npm.io/package/ext-list.md) — 6.3M weekly downloads
- [@lexical/selection](https://npm.io/package/@lexical/selection.md) — 3.8M weekly downloads
- [@lexical/text](https://npm.io/package/@lexical/text.md) — 3.6M weekly downloads
- [@lexical/clipboard](https://npm.io/package/@lexical/clipboard.md) — 3.0M weekly downloads
- [@tiptap/extension-mention](https://npm.io/package/@tiptap/extension-mention.md) — 3.0M weekly downloads

## Recent versions

- 1.2.0 (latest) — 2022-07-21
- 1.1.11 — 2022-05-08
- 1.1.10 — 2021-12-12
- 1.1.9 — 2021-12-02
- 1.1.8 — 2021-11-19
- 1.1.7 — 2021-10-27
- 1.1.6 — 2021-09-18
- 1.1.5 — 2021-05-21
- 1.1.4 — 2021-03-20
- 1.1.3 — 2021-03-01
- 1.1.2 — 2021-02-26
- 1.1.1 — 2021-02-03
- 1.1.0 — 2021-01-28
- 1.0.3 — 2020-11-23
- 1.0.2 — 2020-11-12
- … 10 more at https://npm.io/package/quilljs-markdown/versions

## README

# Markdown for Quill Editor
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

QuillJS Markdown shortcut Extension.

[NPM](https://www.npmjs.com/package/quilljs-markdown)

[DEMO](https://cloverhearts.github.io/quilljs-markdown/)

Wrote Library with ES6 and Standard Javascript Codestyle.

## How to install
### NPM 
```
npm i quilljs-markdown
```

or 

### CDN
```
<script src="https://cdn.jsdelivr.net/npm/quilljs-markdown@latest/dist/quilljs-markdown.js"></script>
```


## How to use
```javascript
import Quill from 'quill'
import QuillMarkdown from 'quilljs-markdown'
import 'quilljs-markdown/dist/quilljs-markdown-common-style.css' // recommend import css, @option improve common style

const options = {
  theme: 'snow'
}

document.addEventListener('DOMContentLoaded', () => {
  const editor = new Quill('#editor', options)
  const markdownOptions = {
    /**
     ignoreTags: [ 'pre', 'strikethrough'], // @option - if you need to ignore some tags.
     
     tags: { // @option if you need to change for trigger pattern for some tags. 
      blockquote: {
        pattern: /^(\|){1,6}\s/g,
      },
      bold: {
        pattern:  /^(\|){1,6}\s/g,
      },
      italic: {
        pattern: /(\_){1}(.+?)(?:\1){1}/g,
      },
    },
    */
  };
  
  // markdown is enabled
  const quillMarkdown = new QuillMarkdown(editor, markdownOptions)
  
  // markdown is now disabled  
  // quillMarkdown.destroy()
  
})


```

Javascript 2 (Enable to Standard style for Quilljs)

```javascript
import Quill from 'quill'
import QuillMarkdown from '../src/app'

const toolbarOptions = [
  ['bold', 'italic', 'underline', 'strike'],
  [ 'link', 'image'],          // add's image support
];

const options = {
  theme: 'snow',
  modules: {
    toolbar: toolbarOptions,
    QuillMarkdown: {
       ignoreTags: [ 'pre', 'strikethrough'], // @option - if you need to ignore some tags.
       
       tags: { // @option if you need to change for trigger pattern for some tags. 
        blockquote: {
          pattern: /^(\|){1,6}\s/g,
        },
        bold: {
          pattern:  /^(\|){1,6}\s/g,
        },
        italic: {
          pattern: /(\_){1}(.+?)(?:\1){1}/g,
        },
      },
    }
  }
}

document.addEventListener('DOMContentLoaded', () => {
  console.log('HOHO')

  Quill.register('modules/QuillMarkdown', QuillMarkdown, true)

  new Quill('#editor', options)
})

```



HTML

```html

<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<script src="https://cdn.jsdelivr.net/npm/quilljs-markdown@latest/dist/quilljs-markdown.js"><script>
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/quilljs-markdown@latest/dist/quilljs-markdown-common-style.css" rel="stylesheet" >

<script>
    document.addEventListener('DOMContentLoaded', () => {
      var quill = new Quill('#editor', {
        theme: 'snow'
      });
      var markdownOptions = {
        ignoreTags: [ 'strikethrough'], // @option - if you need to ignore some tags.
    
        tags: { // @option if you need to change for trigger pattern for some tags. 
        blockquote: {
          pattern: /^(\|){1,6}\s/g,
        },
        bold: {
          pattern:  /^(\|){1,6}\s/g,
        },
        italic: {
          pattern: /(\_){1}(.+?)(?:\1){1}/g,
        },
      },
    };
      new QuillMarkdown(editor, markdownOptions)
    })
<script>

```

## destroy
Call `destroy()` to remove the event listener and disable markdown support:

```
const quillMarkdown = new QuillMarkdown(editor, markdownOptions)
// markdown is enabled

quillMarkdown.destroy()
// markdown is now disabled

```

To re-enable support, create a new instance.


### Paste support for Markdown format.
Pasting the Markdown form,

Shows the corresponding Markdown result.

### Heading (tagname : h1, h2, h3 ,h4, h5, h6, header(all))
```markdown
# MyTitle
## MyTitle
### MyTitle
#### MyTitle
##### MyTitle
```

### Blockquote (tagname : blockquote)
```markdown
> blockquote text
```

### bold (tagname : bold)
```markdown
**Bold Text**
__Bold Text__
```

### Italic (tagname : italic)
```markdown
*Italics Text*
_Italics Text_
```

### Link (tagname : link)
```markdown
[link text](https://link_url)
```

### inline code  (tagname : code)
```markdown
`inline code block`
```


### Code block  (tagname : pre)

&#96;&#96;&#96;<br>
code block<br>
&#96;&#96;&#96;<br>

### List  (tagname : ol, ul)

```markdown
1. one
2. two
3. three

* one
* two
* three
```

### Strikethrough  (tagname : strikethrough)

```markdown
~~Strikethrough~~
```

### Checkbox  (tagname : checkbox)

```markdown
[ ] checkbox
[x] checked
```

---
_Source: https://npm.io/package/quilljs-markdown · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
