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

Mermaid and Katex not rendered #5

Open
rhinenoir opened this issue Mar 22, 2018 · 4 comments
Open

Mermaid and Katex not rendered #5

rhinenoir opened this issue Mar 22, 2018 · 4 comments
Labels
bug Something isn't working

Comments

@rhinenoir
Copy link

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
@benweet benweet added the bug Something isn't working label Mar 22, 2018
@rhinenoir
Copy link
Author

any plan to fix the bug?

@para2402
Copy link

para2402 commented Apr 26, 2018

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

@para2402
Copy link

para2402 commented Apr 27, 2018

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.

@benweet benweet changed the title support mermaid render now? Mermaid and Katex not rendered May 29, 2018
@rhinenoir
Copy link
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
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants