@etu/simditor-markdown
v2.0.2
Published
Add markdown editing mode for simditor.
Downloads
4
Readme
simditor-markdown
Add a markdown editing button for Simditor. Use markdown-it as markdown parser and upndown as HTML to markdown converter.
This fork fixed XSS issue in unmaintained package marked, install failed issue with old to-markdown package
Usage
Reference button and dependency script on your page with Simditor:
<script type="text/javascript" src="https://unpkg.com/[email protected]/dist/markdown-it.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/[email protected]/lib/upndown.bundle.min.js"></script>
<script type="text/javascript" src="[path]/simditor-markdown.js"></script>
<link rel="stylesheet" href="[path]/simditor-markdown.css" media="screen" charset="utf-8" />
Add markdown button config when you initialize Simditor:
var editor = new Simditor({
textarea: $('#txt-editor'),
toolbar: ['bold', 'italic', 'underline', 'color', '|', 'ol', 'ul', '|', 'markdown']
});
Options
If you want to switch to markdown mode right after Simditor initialized, pass markdown: true
to Simditor init options:
var editor = new Simditor({
textarea: $('#txt-editor'),
markdown: true,
toolbar: ['bold', 'italic', 'underline', 'color', '|', 'ol', 'ul', '|', 'markdown']
});