yihui / litedown

A lightweight version of R Markdown
https://yihui.org/litedown/
Other
173 stars 3 forks source link

Wishlist: An Option for Preserving YAML Headers in HTML Outputs #19

Closed liao961120 closed 1 month ago

liao961120 commented 3 months ago

Hi Yihui,

I'm really thrilled to see the newly implemented bibliography feature (#6). This got me thinking about the potential of using litedown to render Rmds into HTML fragments that could then be fed to a static site generator like Hugo.

The only obstacle (that I'm able to notice) is that the YAML header—which could also be used to specify options for a Hugo page—is currently excluded from the HTML output.

Is it possible (or are there any workarounds) to provide an option for keeping the YAML header in the HTML outputs, such as:

---
output:
    litedown::html_format:
        template: FALSE
        keep_yaml: TRUE
---

Big thanks for the great work!

yihui commented 3 months ago

Yes, that should be simple enough to implement. I just submitted the first version of litedown to CRAN (#12), which is pending review. If they can finish the review relatively soon, I will consider adding this feature to the next dev version.

BTW, I'm not sure if you have noticed, but litedown does have its own minimalist site generator, litedown::fuse_site(), which is quite preliminary and may become a little more mature later. Then you probably won't need Hugo...

liao961120 commented 3 months ago

Thanks, I'll definitely give fuse_site() a try!

yihui commented 1 month ago

Done.

Note that keep_yaml: true implies template: false so you don't need to set the latter.