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

Insert tabset overtypes existing code #13

Open Lextuga007 opened 8 months ago

Lextuga007 commented 8 months ago

Following on from the function update in #6 when I have headers like:

## Overview
## Covid cases

And highlight before selecting Insert tabset I get:

::: {.panel-tabset}

## Tab A

## Overview
## Covid cases

## Tab B

Content for Tab B

:::

And I'm really wanting:

::: {.panel-tabset}
## Overview
## Covid cases
::

💮 😄

matt-dray commented 8 months ago

Thank you, I agree. We can probably be a bit smarter and guess the user's intention; if two or more headers are selected then they're probably intended as tabset headers. I'll take a look at this.

There might also be some other functions in the package that would benefit from guessing user intention a bit better.

matt-dray commented 8 months ago

Note to self: stamp_tabset() is hard-coded for a two-tab tabset. Will need to detect the number of tabsets a user has intended and iterate over them to generate the return string.