quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.93k stars 325 forks source link

Hugo code folding and linking #2186

Closed cgoo4 closed 2 years ago

cgoo4 commented 2 years ago

Would it be possible to enable the quarto options for code folding and linking to the hugo format (as per html)?

format: 
  hugo:
    code-fold: true
    code-link: true
cderv commented 2 years ago

Hi,

format: hugo will output Markdown as documented in https://quarto.org/docs/output-formats/hugo.html

code-fold and code-link are used for HTML outputs as they use HTML tags and even Javascript to work.

Are you looking to have those feature available in your rendered Hugo website ?

Or are you looking to have the HTML content written in markdown output for Hugo created by Quarto ?

Thank you

cgoo4 commented 2 years ago

Hi Christophe - my existing blog is built with Rmarkdown, blogdown and Hugo Apero. I'm experimenting with converting one of the projects to a qmd and trying various quarto features within RStudio. So, yes, I wondered if it might be possible to incorporate code-linking and code-folding in this rendered Hugo site.

cderv commented 2 years ago

So, yes, I wondered if it might be possible to incorporate code-linking and code-folding in this rendered Hugo site

If by rendered Hugo site, you mean the HTML website. This will depend on the Hugo theme you are using. The theme would need to have such feature available. For example Hugo Apero.

Quarto does not handle anything related to Hugo. It is just supporting format: hugo as a way to render a .qmd file to a .md file that can be used with Hugo. Any specific Quarto feature for HTML websites & blog are not working in Hugo by default. A Hugo theme would need to implement it.

I hope it helps understand

I'm experimenting with converting one of the projects to a qmd and trying various quarto features within RStudio.

Are you trying to convert to using .qmd with a Hugo website then , or converting to using Quarto instead of Hugo for the website ?

cgoo4 commented 2 years ago

Ideally I wanted to migrate to Quarto whilst retaining the Hugo Apero theme you see here: https://www.quantumjitter.com. If it would be better to instead create a brand new Quarto site (to more fully utilise Quarto features) using the existing Rmarkdown files saved as qmd files (i.e. not use Hugo at all), then I could consider doing that.

cderv commented 2 years ago

I would say that you could keep using Hugo and use .qmd file instead of .Rmd by producing Markdown files and letting Hugo handle the Markdown to HTML conversion but that would mean not taking advantage of Quarto specific features.

If you want to use Quarto features for your site, then you need to switch from Hugo to using Quarto websites.

With Quarto websites, theme can be customize too. Default theme is based on Bootstrap and Bootswatch, and can be tweaked https://quarto.org/docs/output-formats/html-themes.html with some choices, or even custom one https://quarto.org/docs/output-formats/html-themes.html#custom-themes Custom theming system is based on Bootstrap and is quite configurable https://quarto.org/docs/output-formats/html-themes-more.html

Deactivating bootstrap CSS (theme: none is an option), and you would need to add your own system.

Doing something more custom would mean changing the HTML template, but then not all feature of Quarto may be working. See minimal: true (https://quarto.org/docs/output-formats/html-basics.html#minimal-html).

If a feature is available in Hugo Apero and not in Quarto, then it could maybe be implemented using Extensions (https://quarto.org/docs/extensions/) or a feature request should be made.

Switching from Hugo website to Quarto websites has been made I believe, it is just a bit of work to tweak the custom Markdown for Hugo that could have been used, to other content supported by Quarto (which uses Pandoc as markdown renderer - not used by Hugo).

Anyway, I hope I gave you the right pointers to help

cgoo4 commented 2 years ago

Yes, thank you for the guidance.

jjallaire commented 2 years ago

Note that code folding now should work w/ Hugo: https://github.com/quarto-dev/quarto-cli/commit/3e071c1e30a4253d9b5640356da6b9c0b4ff7ddd

I'm gong to close this issue as the way code-link currently works we assume that we can operating on raw HTML that is compatible with Pandoc code block output (neither of which is the case for Hugo).