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 graphs not rendering #718

Closed
3 tasks done
ericcsinger opened this issue Sep 18, 2022 · 2 comments · Fixed by #719
Closed
3 tasks done

Mermaid graphs not rendering #718

ericcsinger opened this issue Sep 18, 2022 · 2 comments · Fixed by #719
Labels
documentation Improvements or additions to documentation

Comments

@ericcsinger
Copy link

Prerequisites

Describe the issue

Hi,

As a newbie, I sure had a tough time revers engineering / poking around how to get mermaid rendered. Even when looking at your diagram example, it didn't stand out to me, what I needed to do. Or at least not entirely. I finally figured it out, after a bit of trial and error, and combing through your diagram example themes\hugo-theme-bootstrap\exampleSite\content\posts\diagram\index.md.

Ultimately it was really easy, once I figured out the missing front matter.

I wanted to do a pull request to suggest a page update on your diagram to help a newbie like myself figure it out. However, I've never done a pull request (ever) and figured rather than messing up something, I'd just put the small suggested addition for you below.


## Instructions

### Front Matter (Page)

You must add the following key / value pair to your front matter.  This tells the page you have a mermaid graph to render.  If you do not add this to your front matter, your mermaid diagram(s) will not render.

```yaml
diagram: true
diagram = true
"diagram": true

Diagram wrapper

Unlike standard markdown hints for mermaid charts, which typically look like this:

```mermaid
graph LR
  A --> B

You need to wrap your mermaid code so it looks like this.

```text
{{< mermaid >}}
graph LR
    A --> B
{{< /mermaid >}}

Feel free to ignore or change any verbiage as you see fit.  

### Steps to reproduce

see my description, nothing to reproduce.

### Expected behavior

Making instructions a little clearer.

### What operating system(s) are you seeing the problem on?

Windows

### What browser(s) are you seeing the problem on?

Chrome

### What version of theme are you using?

v0.8xx

### What version of Hugo are you using?

doesn't matter

### What version of Node.js are you using?

doesn't matter

### What version of Git are you using?

doesn't matter

### Additional context

_No response_
@ericcsinger ericcsinger added the bug Something isn't working label Sep 18, 2022
@razonyang razonyang added documentation Improvements or additions to documentation and removed bug Something isn't working labels Sep 18, 2022
@razonyang
Copy link
Owner

Sorry for the inconvenience, the docs not detail enough. I updated the Diagram Guide in detail.
BTW, you could wrap the diagram with other shortcode, such as align the diagram to center:

{{% text/align-center %}}
{{< mermaid >}}
YOUR DIAGRAM INSTRUCTIONS
{{< /mermaid >}}
{{% /text/align-center %}}

Thanks for your feedback.

@ericcsinger
Copy link
Author

ericcsinger commented Sep 18, 2022 via email

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

Successfully merging a pull request may close this issue.

2 participants