Hugo

Proposal for alternative rendering formats for content, DocBook, Latex etc

Hi all,

I’ve been tinkering with getting Hugo to generate Latex output from markdown files. With a quick hack in the code to switch out the Blackfriday HtmlRenderer used in Hugo with the Blackfriday LatexRender I was able to get some clean Latex output.

However I was thinking it would be useful to generalize this approach. Basically creating a BlackFriday renderer that could take bunch of Go templates. Each template would render a different markdown element.

This would allow a Hugo user to full customize the content generation. For instance spitting out Docbook markup or Latex or whatever other text format they want…

This proposal (combined with Output Formats) would allow the same source .md files to be turned for example into a Latex book and a website (or epub book) with relative ease.

What do you all think ?

1 Like

It is a good idea. I notice that this is marked “epxerimental” in Blackfriday (and it would only be for BF), but I guess it sill would be very useful.

Could you create a issue on GitHub where you describe this?

I will raise a GH issue.

I’ve started tinkering with a template based renderer. Here is the code: https://github.com/rabidgremlin/blackfridaytemplaterenderer/blob/master/templaterenderer_test.go

I think it could work quite nicely.

Excuse my code I’m not much of a Go developer :slight_smile:

I use Madoko as a preprocessor to build HTML and PDF documents and place them in the Static directory. Then I run Hugo to build the entire site. You can see my GitLab CI file here for an example. https://gitlab.com/zivbk1/bryanklein.com/blob/master/.gitlab-ci.yml

1 Like

I also have a demo of using Asciidoctor for standalone docs (HTML & PDF output) and Asciidoc content within the Hugo site. https://www.bryanklein.com/blog/hugo-asciidoctor-vscode-gitlab-firebase/