quilljs-markdown
quilljs-markdown copied to clipboard
Format markdown on `editor.setText('# hello world')`
How can I trigger text format if I set my editor's text from some external string containing markdown (essentially loaded from some GitHub repo's README.md)?
Pasting the same text # hello world formats it correctly (and I saw that format-at-paste is supported: https://github.com/cloverhearts/quilljs-markdown/issues/23), but when I just do editor.setText('# hello world') no formatting happens
Thanks :)
<html>
<body>
<head>
<link href="https://cdn.quilljs.com/1.3.7/quill.snow.css" rel="stylesheet" />
<script src="https://cdn.quilljs.com/1.3.7/quill.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/quilljs-markdown@latest/dist/quilljs-markdown-common-style.css" />
<script src="https://cdn.jsdelivr.net/npm/quilljs-markdown@latest/dist/quilljs-markdown.js"></script>
</head>
<div id="editor"></div>
<script>
const editor = new Quill('#editor', { theme: 'snow' });
const editor_markdown = new QuillMarkdown(editor);
editor.setText('# hello world\n hello');
</script>
</body>
</html>
I would like to throw in my support for this. Quill markdown understands my formatting needs, and trying to wedge it in with TurndownService and Markedjs is blowing my mind. I attempted a workaround by populating the Quill Editor with a pseudo paste, but I think browser security is beating me to the punch here.