Hi, I use org mode files as my content input in Hugo. I want to use a custom third party helper to parse my org files into html. Specifically, I know goorgeous provides support for org files, but I want to use certain features (like auto numbering sections and references) which I think only I’ll use. Is there a way to use a custom helper (which I have written)? As a side note, goorgeous hasn’t seen much development since last Dec, and I don’t think sending them a pull request for a highly specific feature will be accepted anytime soon.
Curious… which is that third party helper? Pandoc is kind of supported by Hugo (I haven’t used it, but I see some kind of basic pandoc invocation baked into hugo).
Hugo doesn’t allow any other third party parser to inject HTML while it is generating the pages. Your another option might be to use the third party helper to generate HTML plus front-matter and put that directly in the content/
dir.
Yeah. That’s sad; the Goorgeous dev doesn’t seem to be using Hugo any more.
Related: I maintain the ox-hugo package (also third party) for Emacs/Org mode if you want to try that out.
I know both about pandoc and your tool. Sadly, they don’t offer auto numbering sections and some other features I want. The third party helper I am mentioning is written by me, specific to my purpose. I’m afraid I might have to jump to some other more extensible static site generator, perhaps Pelican. Thanks for the reply though.
Not sure if you have looked at num ❚ ox-hugo Test Site or the ox-hugo
extensive test suite Org file!
ox-hugo
fully supports :EXPORT_OPTIONS: num:t toc:2
and the likes, and even the UNNUMBERED
Org property. Search for “num:” in the Org file that I linked above.
Even if you don’t plan to use ox-hugo
, I am curious to know what they are.
I am trying to write some theory posts. So I would need theorems, lemmas, proofs, etc.
I want stuff like
Theorem (blah blah).
This is the theorem.
to be converted to
Theorem 2.3 (blah blah).
This is the theorem
where 2.3 is the automatically generated number based on that section number etc. Kinda like latex does. As you can see this is a pretty specific use case. And then I want references for these (using named anchors in html, etc). I am ok writing my own org parser, but I would have preferred if Hugo had a plugin architecture or at least was more extensible in this respect. Pelican atleast has a plugin architecture.
Yes, that’s pretty easy to do in ox-hugo
; just that I haven’t coded it (I already do that for figure/code snippet/table numbering) – Example.
That’s why we have so many static site generators. There’s always something that appeals to everyone.
Btw, looks like I am already supporting inserting numbered section/heading numbers
See Link to headings by name ❚ ox-hugo Test Site, search for “Links (no descriptions) to headings with section numbers”.
So I would need theorems, lemmas, proofs, etc. I want stuff like
It’s not clear what kind of Org Element they are… are they headings? A little sample Org file would help.
No they were custom elements. As in, I write Theorems in a certain way and then extract out the content using a regex, substitute the Theorem statement with an appropriate html statement.
Alas it seems Pelican doesn’t support important features like multiple categories (which is “unwelcome”) which I need, and custom fs-based hierarchy like hugo does. Priorities! I guess…
Anyway, now your project intrigues me even more. I glanced at the code. The main code looks > 3000 loc of elisp (with a lot of documentation). Seems too much for me at the moment (I am not very familiar with elisp). Would you be interested in considering support for generic latex environments (which includes Definitions, Theorems, etc)? Since you support Org mode files and they are frequently used to export to latex, maybe this might be of interest to you. In such case, these environments would have to be auto numbered (like latex does), and able to be referenced.
Your latest reply did not appear at once because it was flagged by the Forum software probably because you typed too fast.
I resolved the flag but then once it was published I realized that you had already posted another similar reply, so I removed the one that was flagged.
Thank you for your understanding.
You don’t have to go through the code line-by-line, unless of course if you want to . You can start with reading the documentation on https://ox-hugo.scripter.co.
I don’t have a good clue on what you expect ox-hugo to do with those… what they look like in Org file… what should they be exported to in Markdown, etc. I’d suggest that you open an issue on Issues · kaushalmodi/ox-hugo · GitHub requesting the feature you need… with (1) Example Org file (2) Example Markdown file that ox-hugo
should export that Org file to, theoretically.
We can then work on refining the spec, etc. in that issue.
In such case, these environments would have to be auto numbered (like latex does), and able to be referenced.
I’ll need a clear spec as I mentioned above… let’s continue on ox-hugo
Issues.
The project has matured quite a bit over time… there’s actually more code split up in different files…
-------------------------------------------------------------------------------
Language Files Lines Code Comments Blanks
-------------------------------------------------------------------------------
CSS 12 2141 1442 388 311
Emacs Lisp 10 6162 4216 1250 696
HTML 58 2273 1888 203 182
JSON 5 27 27 0 0
Makefile 1 230 146 44 40
Markdown 409 15946 15946 0 0
Org 41 15595 13729 99 1767
TOML 17 722 485 114 123
YAML 2 127 29 95 3
-------------------------------------------------------------------------------
Total 555 43223 37908 2193 3122
-------------------------------------------------------------------------------