-
Notifications
You must be signed in to change notification settings - Fork 329
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
[WIP] Mermaid.js integration #2740
[WIP] Mermaid.js integration #2740
Conversation
…nto feature/mermaid-integration # Conflicts: # package-lock.json
const pageElem = global.document | ||
? global.document.querySelector('.page') | ||
: null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a big fan of adding a DOM selector here in the markdown.js
file, but we need this for:
A. Calculating and passing the correct width constraints to Mermaid (used here)
B. The container to add the graph to (optional, but improves graph size calculations)
Let me know if you know a better way of dealing with this. (I assume prop drilling?)
I know the last update on this PR was in March so it's maybe not surprising, but when I load the staged deployment and try the example text given, it doesn't seem to load the graphs. It just says "Loading graphs...", and I gave it a few minutes. Maybe it needs longer, but I suspect it's stuck? No console errors. |
In the html I can see the pre.mermaid:not([data-processed='true']) { visibility: hidden; } The "Loading graph.." message appears because of a similar css rule pre.mermaid:not([data-processed='true'])::before {
content: 'Loading graph...';
display: block;
visibility: visible;
} So .. something definitely has gone awry. |
I'm kinda weirded out that these are Hmm .. a normal unadorned code block renders as So .. that's seems deliberate of this PR. I would suggest it should render as btw, it's the .page pre code {
width: 100%;
display: inline-block;
border-style: solid;
border-width: 1px;
border-image: url(/assets/codeBorder.png) 26 stretch;
border-image-width: 10px;
border-image-outset: 2px;
border-radius: 12px;
margin-bottom: 2px;
padding: 0.15cm;
} |
@MichielDeMey How far is this PR from the finish line? |
I poked this with a stick today ( by cloning the changes into a fresh branch ) and slightly updating marked-mermaid and it worked except for the The other issue I ran into was that it is not possible to pull the mermaid version of 10 or later due to the require vs include dance that I am unable to solve according to the various "this is how you solve this!" instructions. It results in
Pinning it at 9.4.1, I was able to generate graphs that looked like the examples from the examples page on the mermaid site aside from the above mentioned. marked-mermaid requires an update to deal with marked moving forward. |
Closing as orphan in favor of #3697. |
Integrating Mermaid.js into Homebrewery.
Closes #2701
The heavy lifting is done in the
marked-mermaid
package which I've open-sourced here:https://github.com/MichielDeMey/marked-mermaid
Example Homebrewery document: