Skip to content

Commit

Permalink
Expand to allow div class as well as chunk option
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeLydeamore committed Jul 18, 2023
1 parent 50edc28 commit 651a4a8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion _extensions/unilur-question/unilur.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ end

local function Div(el)
local options_collapse = true
if el.classes:includes("cell") and el.attributes["unilur-solution"] == "true" then
if (el.classes:includes("cell") and el.attributes["unilur-solution"] == "true") or (el.classes:includes("unilur-solution")) then
el.attributes["unilur-solution"] = nil
-- Embed solution code/block inside a callout if global option is true
if options_solution then
Expand Down
2 changes: 1 addition & 1 deletion _extensions/unilur-solution/unilur.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ end

local function Div(el)
local options_collapse = true
if el.classes:includes("cell") and el.attributes["unilur-solution"] == "true" then
if (el.classes:includes("cell") and el.attributes["unilur-solution"] == "true") or (el.classes:includes("unilur-solution")) then
el.attributes["unilur-solution"] = nil
-- Embed solution code/block inside a callout if global option is true
if options_solution then
Expand Down
8 changes: 7 additions & 1 deletion example.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,18 @@ Of note, if `show-solution` is absent, it is considered `false`.

- Solution with markdown text (`{block}`):

```{block}
````{block}
#| unilur-solution: true
#| unilur-collapse: false
For text with **bold** or warning people about CO~2~ atmospheric concentration
```{{r}}
1 + 1
```
````

Any machinery supported by Quarto can be used:

- Python Code chunk with `unilur-solution: true`
Expand Down

0 comments on commit 651a4a8

Please sign in to comment.