matt-dray / quartostamp

:white_flower::scroll: R package: RStudio Addin to insert ('stamp') useful Quarto elements
https://matt-dray.github.io/quartostamp
Other
59 stars 2 forks source link

Tabset should be ## rather than ### #10

Closed Lextuga007 closed 1 year ago

Lextuga007 commented 1 year ago

It works with ### but ## is what is in the Quarto documentation https://quarto.org/docs/interactive/layout.html#tabset-panel and most people start with # as the header.

matt-dray commented 1 year ago

Aha! Thanks for this. Took me a sec to realise why: ### is needed in Quarto presentation tabsets, since ## demarcates a new slide.

This is deeper than I thought. Maybe there's three solutions:

  1. Switch to ##, though presentation makers will have to adjust manually because it will break their document.
  2. Retain only ###, recognising that 'regular' Quarto users might need to adjust (though it won't break their document).
  3. Have two different versions of the function, one that defaults to ## and one to ### (the latter labelled as 'presentation version' or something).

Bonus and perhaps best approach (?):

  1. Autodetect what the document type is according to the YAML header ('if format is revealjs then...') and adapt accordingly (and perhaps just default to ## in tabsets if detection fails).

Which of these do you think makes the most sense?

Lextuga007 commented 1 year ago

I hadn't realised you could use tabsets in presentations (I'll have a go now!) 😲

I like bonus approach the best as I'm thinking of a very new Quarto audience. RMarkdown allowed for #, ## and ##, ### tabsests so this is slightly different.

matt-dray commented 1 year ago

I smashed something together in #12. I'd like to 'test' it a little before merging. You are very welcome to try it out as well! In short, there's a helper function .is_revealjs() that returns a logical. If TRUE, it adds an extra # to the tabset header in stamp_tabset().

matt-dray commented 1 year ago

Hm, I overegged that. Level 2 tabset headers don't cause a slide-demarcation problem in Quarto presentations. This demo code renders to produce two slides with functioning tabsets, despite one using level 2 tab titles.

Click for demo code ``` --- title: "Untitled" format: revealjs editor: visual --- ## Quarto ::: {.panel-tabset} ### Tab A Content for Tab A ### Tab B Content for Tab B ::: Quarto enables you to weave together content and executable code into a finished presentation. To learn more about Quarto presentations see . ## Bullets ::: {.panel-tabset} ## Tab A Content for Tab A ## Tab B Content for Tab B ::: When you click the **Render** button a document will be generated that includes: - Content authored with markdown - Output from executable code ```

In other words, #11 is totally viable and I now have an excuse to write a blogpost to memorialise my cunning solution and mildly shame myself for overengineering!

Lextuga007 commented 1 year ago

Wow! So the ::: seems to demarcate the section and ## doesn't trigger a new slide - nice spot!