CaiJimmy / hugo-theme-stack

Card-style Hugo theme designed for bloggers
https://stack.jimmycai.com
GNU General Public License v3.0
4.96k stars 1.63k forks source link

Mermaid charts #220

Closed sbrandsborg closed 2 years ago

sbrandsborg commented 3 years ago

Is there any plans including support for Mermaid charts?

https://mermaid-js.github.io/mermaid/#/

CaiJimmy commented 3 years ago

Is there any plans including support for Mermaid charts?

Not yet.

But it doesn't seem hard to be integrated by the user neither, just pasting a snippet of HTML if I have understood it correctly: image

So I probably won't include this into the theme, unless there are many demands for this feature.

Thanks for the request.

ipfans commented 3 years ago

+1 for this.

The official solution is not a very correct choice, if the code is placed into a global page such as footer, it usually leads to pages that all import an additional JavaScript file, which is only needed in the posts content. Otherwise, the user may be required to manually import JavaScript files into each post, which will keep the writers away from focusing on the writings.

MikDal002 commented 3 years ago

Think about AsciiDoctor instead of Markdown – it has such features (almost) built-in and many others in addition. Here from Hugo doc: https://gohugo.io/content-management/formats/ and here about AsciiDoctor: https://docs.asciidoctor.org/diagram-extension/latest/. If you are familiar with docker, it's the Dockerfile I use for developing blog with those things:

FROM asciidoctor/docker-asciidoctor
RUN apk add hugo
d0zingcat commented 2 years ago

According to this article you can easily do it by yourself. What you need to do is create one default markup and then copy the article template from hugo-theme-stack and put it in the same level directory in layouts(and the file of the theme will be replaced by this file). BTW, if it doesn't make sense to you so far, you can refer to this commit. Hope it helps.