teesloane / firn

Org Mode Static Site Generator
Eclipse Public License 1.0
324 stars 24 forks source link

downgrade h1 in body to h2 and so on #96

Closed holtzermann17 closed 2 years ago

holtzermann17 commented 3 years ago

This change in title->html will achieve it, and probably wouldn't negatively affect things like table of contents?

        h-level          (case level
                           1 (heading-id+class 2)
                           2 (heading-id+class 3)
                           3 (heading-id+class 4)
                           4 (heading-id+class 4)
                           5 (heading-id+class 6)
                           (heading-id+class 6))

— Compare: https://github.com/theiceshelf/firn/blob/master/clojure/src/firn/markup.clj#L573-L579

Maybe the remapping should be an option, for people who prefer to have multiple h1 tags? To my mind it seems better to have only one, but I understand that there's a debate about this.

teesloane commented 3 years ago

It should still be possible to have multiple h1 tags provided that your layouts/*.clj files render entire documents (ie, you are not rendering a specific h1 headline). However, perhaps it could be made possible to render the headline size relatively (so, if you (render "my-headline") and my headline is "3 stars deep" in your org tree, the first headline would still be an h1, and so forth. With that said, this is an area where the domain of org does not map perfectly to the web (ie. infinite levels of org bullets and only 6 heading tags). Not sure what to do here, so I'm going to say we should stick with what we have until a clear solution pops up. I'm also partial to the idea that each document should have only one h1 - the title of the doc.

teesloane commented 2 years ago

This is possible with 0.16 onward in the render function:

<div>
  {{render(update_level=1)}}
</div>

Where update_level will bump all headlines up one level (and update_level=-1) will bump all headlines down a level.