Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format markdown on editor.setText('# hello world') #75

Open
vadimkantorov opened this issue Dec 12, 2023 · 1 comment
Open

Format markdown on editor.setText('# hello world') #75

vadimkantorov opened this issue Dec 12, 2023 · 1 comment

Comments

@vadimkantorov
Copy link

vadimkantorov commented Dec 12, 2023

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: #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>
image
@vadimkantorov vadimkantorov changed the title Format markdown on `editor.setText('# hello world') Format markdown on editor.setText('# hello world') Dec 12, 2023
@doods-irl
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants