-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Inline css by "mermaid" #157
Comments
Forget about this... The styles above are added by |
Minimal failing example: Please save the HTML-file to your disk and open it with a browser. I tested the file with Firefox 37.0.1, Chromium 41, Internet Explorer 11 and it's always the same. The first one will show "This is a H1 headline" with a font size of "5rem". The second one only with "1rem". There's only one difference between the files: The later makes use of some embedded stylesheet.
|
@knsv Do see any chance to make |
What about adding such an interface to
|
Good idea! Lets add it to the list. |
Wonderful! 👍 Maybe this is helpful https://github.com/hakimel/reveal.js/blob/master/js/reveal.js. Reveal.js uses the same interface. Maybe you can "borrow" the factory-function from there. |
Maybe anouther use case for such an interface hakimel/reveal.js#1082 |
A fix for this has been released in version 0.5.0 |
Great! Thanks a lot! 😄 Will integrate |
@knsv so I tried this fix (using latest mermaid.js in dist/ from a few days ago, or using mermaid.min.js 0.5.1), and it doesn't seem to work for me. When I set
When I set To reproduce:
Mermaid integration: Any help would be greatly appreciated, thanks. |
Changing the initialization solved the first startup issue:
There is a subsequent syntax error when trying to render the next graph so I suspect then reveal is doing stuff with the DOM during the presentation. Perhaps the more advanced integration path using the mermaid render function would be a better fit for the plugin. See example below:
I hope that helped. /Knut |
Thanks. Changing the init got rid of the errors, but the svg element no longer shows up…. Would you be able to help a bit with the mermaidAPI.render and how it would integrate? I tried entering this into the Firefox JS console: mermaidAPI.render('id1','graph TB;\na-->b',function(){console.log('done');}) and it returned “undefined”. Sorry I’m not really a JS developer… thanks again!
|
also shouldn’t the config have the mermaid: in it? e.g.
|
1st, make sure you are using a later version of mermaid. The one in you repos was 0.5.1 use 0.5.8 instead. If you don't it will not work in recent Chrome browsers. And, no intialization should not be with in the mermaid section. More info here: Glad to help! |
Sorry, could you please explain the mermaidAPI.render() call a bit?
Is this supposed to return DOM, HTML text, or what? Or does it automagically insert into the DOM element ‘id1’, which must exist already? Any examples would be great, thanks.
|
He he! I can see how this can be unclear. Dont heistate to add a better description in the docs md files when it works (if you feel inspired) :)
In the example above the code in the $(function, function is run after the page has been loaded. Then the render function is called with a unique id, hardcoded graph string and a callback function. The id is used for graph generation, the hardcoded graph should be replaced with the graph you want to render and the callback is called after the graph rendering is done with the svg code as as string. This string is also returned from the function. The reason for the callback is that is required when attaching events like click/on hover to the generated graph. If you are not interested in that you can just as well use the returned string. Hop that sheds light on thins. Good luck. |
Thanks for the explanation! So I integrated the mermaidAPI.render as you suggested, in line 30. Something now renders, but it seems the styles are messed up such that you can’t read it. Any ideas? https://github.com/velvia/presentations/blob/mermaid-0.5.1/reveal/plugin/markdown/markdown.js https://github.com/velvia/presentations/blob/mermaid-0.5.1/reveal/plugin/markdown/markdown.js Not sure if I can paste the rendering jpg here…. thanks again
|
Hi there,
I'm trying to integrate
mermaid
intomiddleman-presentation
- a gem which wrapsreveal.js
.I'm installed
mermaid
viabower
. Everytime I added themermaid/dist/mermaid.full.js
file to a presentation, the following inline css-styles appear:The last line of the inline css is a problem for me, because it overwrites my styles for H1, H2 etc.
I'm not sure if this done by
mermaid
, so maybe you @knsv can help with that? If it ismermaid
which adds the line given above, what can I do to prevent that?Thanks a lot.
The text was updated successfully, but these errors were encountered: