Skip to content

Mermaid and Katex not rendered #5

Open

Description

@rhinenoir

my code for replacing mermaid content:

    const mermaidNodes = document.getElementsByClassName('language-mermaid');
    const stackedit = new Stackedit();
    for(var node of mermaidNodes) {
        var fileName = Math.random().toString(36).substring(2, 10);
        var completeContent = '\`\`\`mermaid\n' + node.innerText + '\n\`\`\`';
        console.log(completeContent);
        stackedit.openFile({
            name: fileName,
            content: { 
                text: completeContent,
                properties: {
                    extensions: {
                        mermaid: {
                            enabled: true
                        }
                    }
                }
            }
        }, true);
        stackedit.on('fileChange', (file) => {
            console.log(file.content.html);
        });
    }
  • console.log(completeContent); got sth like:
graph LR
A --> B
Loading
graph TD
A --> C
Loading
  • console.log(file.content.html); got sth like:
<pre><code class="prism language-mermaid">graph TD&#10;A --&gt; C&#10;</code></pre>&#10;
  • expected result:
    complete mermaid svg code instead of original code style

Activity

  1. rhinenoir commented on Apr 12, 2018

    @rhinenoir
    Author

    any plan to fix the bug?

  2. para2402 commented on Apr 26, 2018

    @para2402

    Same problem.
    @garenfeather What does your code do?
    Were you successful getting SVG of the mermaid markdown with the above code?

  3. para2402 commented on Apr 27, 2018

    @para2402

    I found a workaround for the problem. I searched for all KaTeX and mermaid HTML elements, and rendered them using Katex and mermaid libraries.
    Code is here https://github.com/jaipara/StackeditJS-example.git

    Hope it helps.

  4. changed the title [-]support mermaid render now?[/-] [+]Mermaid and Katex not rendered[/+] on May 29, 2018
  5. rhinenoir commented on Jun 30, 2018

    @rhinenoir
    Author

    @benweet so any plan to fix the bugs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions