I recently started using hugo as a static site generator. So far it has been a very good experience but there is one thing that I am missing.
I use pandoc quite frequently for md → tex → pdf conversion. Pandoc markdown gives me the ability to use custom container syntax like this:
::: environment
Hello World
:::
This syntax will be turned into (using my lua filter):
\begin{environment}
Hello World
\end{environment}
I was wondering if something similiar was achievable in hugo when converting from markdown to html, with the environment being the class of a div:
<div class="environment">
Hello World
</div>
Since the ::: container syntax is not native to goldmark, markdown render hooks won’t be able to solve this issue (and if there are any).
The only other option I have found is replaceRE, which I wasn’t able to set up properly.
Since I am quite new to hugo I am interested in possible solutions to this problem.
Ideally, I would like to be able to configure short forms for the environment names. For example, thm → theorem. I was thinking that one could add a yaml file to the data directory containing the short form as a key and long form as a value, like so:
thm: theorem
def: definition
prb: problem
...
Nesting would also be great.
I think that this extension to goldmark’s built in syntax would allow for a lot of flexibility. Adding this container syntax to goldmark itself would allow for even more flexibility, considering the possibility of adding a markdown render hook for containers.