Skip to content
Discussion options

You must be logged in to vote

With that said, here's a Lua filter that does the specific thing you want (to rearrange a cell output into tabset panels).

It turns out that Tabsets can be constructed directly in Lua code with quarto.Tabset.

There's a small Quarto bug that needs fixing, but the filter below includes a workaround. Hopefully the filter is self-explanatory.

---
format: html
keep-md: true
filters:
  - topanel.lua
---


::: {.to-panel}

```{r}
#| echo: true

print("Hello, world")
```

:::

topanel.lua

function Div(div)
  if not div.classes:includes("to-panel") then 
    return
  end
  local code_block = nil
  local cell_output = nil
  quarto._quarto.ast.walk(div.content, {
    CodeBlock = function(code)
      if

Replies: 1 comment 14 replies

Comment options

You must be logged in to vote
14 replies
@coatless
Comment options

@cscheid
Comment options

@coatless
Comment options

@cscheid
Comment options

Answer selected by coatless
@cscheid
Comment options

@coatless
Comment options

@cscheid
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
project-scripts tabsets computations lua Issues related to the lua codebase, filter chain, etc
3 participants