Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom solution block clashes with proof/solution block #1854

Closed
6 of 7 tasks
zkamvar opened this issue Aug 13, 2022 · 1 comment
Closed
6 of 7 tasks

custom solution block clashes with proof/solution block #1854

zkamvar opened this issue Aug 13, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@zkamvar
Copy link

zkamvar commented Aug 13, 2022

Bug description

I found an unexpected problem when I was testing out quarto for Carpentries lessons. We use a solution fenced div tag to provide accordion sections that contain solutions to challenges/exercises.

I ran into an error (described in carpentries/sandpaper#161 (comment)) when I had a file that looks like this:

::: solution

### Heading

```
code
```

:::
Error running filter /opt/quarto/share/filters/crossref/crossref.lua:
/opt/quarto/share/filters/crossref/crossref.lua:2009: attempt to get length of a nil value (field 'content')
stack traceback:
	/opt/quarto/share/filters/crossref/crossref.lua:1103: in function </opt/quarto/share/filters/crossref/crossref.lua:1097>

The solution (heh) to this problem is to insert a paragraph right after the heading:

::: solution

### Heading

text text

```
code
```

:::

But this gives the unsatisfactory result of formatting the heading as a span and linking it to the paragraph (though I believe we can handle it with our lua filters).

Many of our materials contain solution blocks with just code blocks or tables and I am wondering if there is a mechanism for us to register our divs so that we can avoid these clashes.

My system

Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.4 LTS
Release:	20.04
Codename:	focal

quarto check Output

[✓] Checking Quarto installation......OK
      Version: 1.0.38
      Path: /opt/quarto/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.8.8 (Conda)
      Path: /home/zhian/anaconda3/bin/python
      Jupyter: 4.7.1
      Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.2.1
      Path: /usr/lib/R
      LibPaths:
        - /home/zhian/R/library
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      rmarkdown: 2.14

[✓] Checking Knitr engine render......OK

quarto tools check Output

[✓] Inspecting tools

Tool         Status                    Installed     Latest  
chromium     Not installed             ---           869685  
tinytex      External Installation     ---           v2022.08

Checklist

  • formatted your issue so it is easier for us to read?
  • included a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
  • documented the quarto version you're running, by pasting the output from running quarto check in the "Quarto Check Output" text area?
  • documented the version of the quarto tools you're running, by providing the output from running quarto tools check in the "Quarto Tools Check Output" text area?
  • documented the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
  • documented which operating system you're running? If on Linux, please provide the specific distribution as well.
  • upgraded to the latest version, including your versions of R, the RStudio IDE, and relevant R packages?
@zkamvar zkamvar added the bug Something isn't working label Aug 13, 2022
@jjallaire
Copy link
Collaborator

Thanks for reporting this! There were a couple issues w/ the resilience of our solution/proof handling, fixed here: c56d23e (this should be available tomorrow in a pre-release build: https://quarto.org/docs/download/prerelease.html

If you have your own semantics for .solution divs my suggestion would be to arrange for your filters to run before the Quarto filters and somehow mask them out from processing by Quarto (e.g. change the name of the class). Here are docs on controlling filter order: https://quarto.org/docs/extensions/filters.html#activating-filters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants