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

Katex and Mermaid examples in live demo don't work because of /**/ comments #583

Closed
hugomg opened this issue Jan 11, 2024 · 5 comments
Closed

Comments

@hugomg
Copy link

hugomg commented Jan 11, 2024

I had some trouble getting Katex and Mermaid to work. I could not get the examples from the live demo site to work. Both of them told to add /**/ in the shortcode definition.

https://hugo-book-demo.netlify.app/docs/shortcodes/katex/
https://hugo-book-demo.netlify.app/docs/shortcodes/mermaid/

{{</* katex [display] [class="text-center"] */>}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
{{</* /katex */>}}

However, when I looked at the source for the files I noticed that the text inside the Latex code block is different from the actual katex invocation. The real katex only says {{< katex display >}}, without the /**/ and the text-center. This one did work for me.

{{< katex display >}}
f(x) = \int_{-\infty}^\infty\hat f(\xi),e^{2 \pi i \xi x},d\xi
{{< /katex >}}

What's going on with the /**/? Should those be removed from the documentation examples?


ps.: Here is a screenshot of what I see in the live demo website:

Captura de tela de 2024-01-11 15-14-18

@alex-shpak
Copy link
Owner

alex-shpak commented Feb 17, 2024

Hi!
It is kinda intentional, left side is a code block, and right side is the result, but I agree it doesn't look good. So left side is wrapped in comment block in order to not get rendered by katex.

So below is how you use it

{{< katex display >}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
{{< /katex >}}

@alex-shpak
Copy link
Owner

Related issue, gohugoio/hugo#10058

@hugomg
Copy link
Author

hugomg commented Feb 17, 2024

If this is the only possible workaround to have it render as a code block, perhaps we should add some text next to it, instructing to remove the /**/ ?

@alex-shpak
Copy link
Owner

alex-shpak commented Feb 17, 2024

I fixed examples pages with some raw html trickery, see a111041
https://hugo-book-demo.netlify.app/docs/shortcodes/katex/

@hugomg
Copy link
Author

hugomg commented Feb 17, 2024

Awesome!

recomkasch added a commit to RECOMGmbH/hugo-book-theme that referenced this issue Mar 8, 2024
recomkasch added a commit to RECOMGmbH/hugo-book-theme that referenced this issue Mar 8, 2024
recomkasch added a commit to RECOMGmbH/hugo-book-theme that referenced this issue Mar 8, 2024
recomkasch added a commit to RECOMGmbH/hugo-book-theme that referenced this issue Mar 8, 2024
Hanekihyouka pushed a commit to Hanekihyouka/hugo-book that referenced this issue Oct 11, 2024
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

2 participants