Hugo

Two questions after Goldmark age

  1. Is pygmentsCodefencesGuessSyntax removed?
    Now the code block will not have line numbers if I don’t specify a language next to the backticks before the fenced code block… It just renders directly to <pre><code> ... </code></pre>

  2. Is blackfriday backslashLineBreak missing?
    I used to set extensionsmask = ["backslashLineBreak"] to mask backslashLineBreak, which is very useful for LaTeX equations – I just need to add two more backslashes, e.g.

    $$
    \begin{aligned}
        a & = b \\\\
        b & = c
    \end{aligned}
    $$
    

    But now:

    1. There is no such option in [markup.blackFriday]. Although the old param [blackfriday] still works…
    2. Goldmark does not have such an option and I just don’t know how to insert LaTeX equations simply with it…

This might be a question for the Goldmark repo. But in the meanwhile try using a dummy language like “text” e.g. ```text

I’ve never used that extension with Hugo+Blackfriday. But to do line breaks in equations, you need six backslashes:


## `\\` at EOL → `\\\\\\` {#at-eol}

\begin{align}
a^1  &= x \\\\\\
a^2  &=  σ(W^2a^1 + b^2) \\\\\\
a^3  &=  σ(W^3a^2 + b^3) \\\\\\
⋯ \\\\\\
a^L  &= σ(W^La^{L-1} + b^L) \\\\\\
y  &= a^L \\\\\\
\end{align}

Source <- This page is rendered using an older Hugo version using Blackfriday, but from some brief testing yesterday, the same escaping of backslashes works with Goldmark too (because Goldmark (without an equation extension) lacks LaTeX equation support the same way Blackfriday does).

Thank you for your reply!

Well, I just tested that in Hugo v0.60.1 with goldmark and it didn’t work. :rofl: The result is as below:

<p>$$
\begin{aligned}
a &amp; = b \\\<br>
b &amp; = c
\end{aligned}
$$</p>

Anyway, goldmark is awesome and I think the solution to these problems is only a matter of time. :smiley:

It was accidently removed. I wrongly assumed that this was a Pygments thing only (which we now removed).

I will try to fix it:

2 Likes

Many thanks!

That’s indeed odd, because it works for me…

This:

image

renders to:

I am on Hugo 0.61.0-DEV.

Note that you do need the MathJax scripts to be loaded.

2 Likes

I see, I’m using KaTeX…