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

How to adapt Mermaid shorcodes to my need #1760

Open
JOduMonT opened this issue Sep 30, 2024 · 2 comments
Open

How to adapt Mermaid shorcodes to my need #1760

JOduMonT opened this issue Sep 30, 2024 · 2 comments

Comments

@JOduMonT
Copy link

Do you think it would be possible to use Mermaid shorcodes with this syntax

mindmap
      Root
          A
            B
            C
Loading

instead of that syntax

{{< mermaid >}}
mindmap
Root
A
B
C
{{< mermaid >}}

@wermos
Copy link
Contributor

wermos commented Oct 4, 2024

I don't think this feature is possible to do with Hugo.

This is because Hugo treats triple backtick code blocks as code blocks that are to be syntax highlighted, and not a code block that needs further processing. From a quick look at the Hugo docs on this matter (here and here), it doesn't seem like there is a way to override how Hugo processes triple backticks.

Even if it's possible to override that, I think you would end up losing the ability to syntax highlight code blocks, unless you separately add that feature in using yet another shortcode.

@unacro
Copy link
Contributor

unacro commented Oct 19, 2024

I don't think this feature is possible to do with Hugo.我认为 Hugo 不可能实现此功能。

This is because Hugo treats triple backtick code blocks as code blocks that are to be syntax highlighted, and not a code block that needs further processing. From a quick look at the Hugo docs on this matter (here and here), it doesn't seem like there is a way to override how Hugo processes triple backticks.这是因为 Hugo 将三个反引号代码块视为要语法高亮的代码块,而不是需要进一步处理的代码块。从快速浏览一下关于这个问题的 Hugo 文档(这里和这里)来看,似乎没有办法覆盖 Hugo 处理三个反引号的方式。

Even if it's possible to override that, I think you would end up losing the ability to syntax highlight code blocks, unless you separately add that feature in using yet another shortcode.即使可以覆盖它,我认为您最终也会失去语法高亮代码块的能力,除非您在使用另一个短代码中单独添加该功能。

That's not true.

In fact, Hugo use goat code block to render GoAT(Go ASCII Tool) diagrams as early as 2 years ago.
To this day, Hugo official document even given the solution for example.
(See Diagrams | Hugo)

I used for a while in my own modified version. Maybe commit a PR later.

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

No branches or pull requests

3 participants