Skip to content

Commit

Permalink
.to-panel -> .to-source
Browse files Browse the repository at this point in the history
  • Loading branch information
coatless committed Jun 10, 2024
1 parent c7bc972 commit 5c7016b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ Supported options include:

| Class | Description |
|---------------|-------------------------------------------------------------------------------------|
| `.to-panel` | Convert a code cell to show rendered output and its source. |
| `.to-source` | Convert a code cell to show rendered output and its source. |
| `.to-pyodide` | Convert code cell from static Python code to interactive Python code using Pyodide. |
| `.to-webr` | Convert code cell from static R code to interactive R code using webR. |


For example, if we have a code cell with R that we want to show its options, then we use:

```` md
:::{.to-panel}
:::{.to-source}
```{r}
#| echo: fenced
#| eval: true
Expand Down
4 changes: 2 additions & 2 deletions _extensions/panelize/panelize.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ function Div(div)
local to_webr = div.classes:includes("to-webr")
local to_pyodide = div.classes:includes("to-pyodide")

-- Check if the `div` has the class "to-panel"/"to-webr"/"to-pyodide"
if not (div.classes:includes("to-panel") or to_webr or to_pyodide) then
-- Check if the `div` has the class "to-source"/"to-webr"/"to-pyodide"
if not (div.classes:includes("to-source") or to_webr or to_pyodide) then
return
end

Expand Down
4 changes: 2 additions & 2 deletions docs/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ The `panelize` extension allows you to tabbify existing code cells. The supporte

| Class | Description |
|---------------|-------------------------------------------------------------------------------------|
| `.to-panel` | Convert a code cell to show rendered output and its source. |
| `.to-source` | Convert a code cell to show rendered output and its source. |
| `.to-pyodide` | Convert code cell from static Python code to interactive Python code using Pyodide. |
| `.to-webr` | Convert code cell from static R code to interactive R code using webR. |

You can wrap existing code cells using a `Div` and specify the class. For example, with Python we would have:

```` md
:::{.to-panel}
:::{.to-source}
```{{python}}
#| echo: fenced
#| eval: true
Expand Down
6 changes: 3 additions & 3 deletions docs/qpanelize-cell.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ For example, let's take the following code cell using the [fenced](https://quart
Using the **{quarto-panelize}** extension, you can show the code cell and its output together in one tab, and separately display the source of the code cell with nearly all options (minus `echo`) in another tab tab. Here's how it can be done:

````md
:::{.to-panel}
:::{.to-source}
```{{r}}
#| echo: fenced
#| eval: true
Expand All @@ -29,7 +29,7 @@ Using the **{quarto-panelize}** extension, you can show the code cell and its ou

This will create two tabs: Result and Source.

:::{.to-panel}
:::{.to-source}

```{r}
#| echo: fenced
Expand All @@ -41,7 +41,7 @@ This will create two tabs: Result and Source.

Without setting `echo: fenced`, the Source tab will only display the code without results.

:::{.to-panel}
:::{.to-source}


```{r}
Expand Down
5 changes: 3 additions & 2 deletions docs/qpanelize-release-notes.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ format:
## Features

- `panelize` allows for Quarto code cells to be tabbified.
- `.to-webr`: converts an R code cell to webR
- `.to-source`: converts an existing code cell also show its source with options.
- `.to-pyodide`: converts a Python cell to Python
- `.to-panel`: converts an existing code cell also show its source with options.
- `.to-webr`: converts an R code cell to webR

0 comments on commit 5c7016b

Please sign in to comment.