Ox-hugo: Writing Hugo posts in native Org mode

Hello all,

I have worked on an Emacs package to export Org mode files to Markdown files with Hugo front matter.

A question might naturally arise that why not use the inbuilt Org mode support in Hugo.

I have attempted to answer questions like those in addition to detailed package documentation here:

That is the ox-hugo documentation website, and is generated using ox-hugo + Hugo from a single Org file.

You can find a link to the source Org file in the footer of the above site.

In there, you will also find a link to the extensive teat suite which can help you understand how Org exports to Markdown.

Feedback and comments are welcome!

That’s very nice!

I’ve decided to try to use org-mode as single-source markup for all my writings, but have severe problems with the inbuilt org-mode support - see e.g. this issue, so my 'answer to why? is that your package should be free from such stuff…and I’m going to install/try it soon. :wink:

The only concern I have is whether one can expect some issues considering that org-mode’s markup is semantically richer than markdown, have you encountered some problem that some more complex constructs in your org-file are not adequately “translated” into HTML via Blackfriday’s markdown?

Thank you :slight_smile:

Same here. As I say that, I also respect the effort gone into writing the goorgeous package. That’s one of the inspirations for ox-hugo. My requirements effectively would have required goorgeous to be a complete rewrite of Org in Go, plus some Emacs features like supporting local variables, setting Org options via variables, etc.

That wasn’t practical. So ox-hugo was born.

Yep, footnotes are supported.

Try it out and let me one if one of your use cases catches an issue in ox-hugo. If have about a hundred or so Org-to-Markdown test cases here. The main file in there is all-posts.org. Here is the Hugo rendered full test site.

With respect to that specific issue. I had added a support to ox-hugo to specifically handle auto-filled lines in footnotes. As markdown does not support that, I ensure that the Org footnotes when exported to Markdown are force unfilled. I even have a test for that: https://ox-hugo.scripter.co/test/posts/multi-line-footnote-goldmark/

Search for multi-line-footnote in https://raw.githubusercontent.com/kaushalmodi/ox-hugo/master/test/site/content-org/all-posts.org … at the time of writing this, that footnote is fn:3 in that example file.

Definitely, I’m very happy to see goorgeous package - similar to the recent native implementation of Pygments, but it’s simply, imho, not ready for the prime time.

In order to be able to have emphasis >2 lines in my org files, I’ve found the following setting on the Net:

(setcar (nthcdr 4 org-emphasis-regexp-components) 10) ;; allow multi-line emphasis

but it is, for whatever reason, not honored in ox-hugo and it also depends whether the paragraph is filled (M-q) or not?

Hmm, it should have worked (because I use it without issues). I have a test for that too: https://raw.githubusercontent.com/kaushalmodi/ox-hugo/master/test/site/content/posts/multi-line-bold.md

You can find the corresponding Org in test/site/content-org/all-posts.org.

That said, please open an issue on the ox-hugo repo and continue the discussion there, so that this forum doesn’t get spammed. Also provide a minimum working example there to help recreate the issue you are seeing.

Don’t know why, but after applying your settings which allow 20 lines, it does work now. :slight_smile:

You probably missed the second form:

  ;; Below is needed to apply the modified org-emphasis-regexp-components
  ;; settings from above.
  (org-set-emph-re 'org-emphasis-regexp-components org-emphasis-regexp-components)

Not sure since I found the ‘workaround’ in the same place and it worked in the ‘plain’ org files. :confused: