quarto-dev / quarto-dev/quarto-cli

Code Annotation Blocks Generation of Code Appendix

Open
#7,053 12 comments 0 reactions 1 assignee View on GitHub

@cderv is already working on this.

Since Sep 28, 2023.

bug code-annotation lua
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

A common tool for creating reproducible documents via R Markdown and Quarto is to include the following to auto generate a code appendix.

# Code Appendix
```{r, ref.label=knitr::all_labels(),echo=TRUE,eval=FALSE}
```

However, when you use even a single code annotation (e.g., # <1>) in any code block, the generation of the code appendix fails. There are no warnings or errors displayed but the code appendix is blank.

Steps to reproduce
---
title: "test"
date-modified: now
latex-tinytex: false
format: pdf
---

## Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.

## Running Code

When you click the **Render** button a document will be generated that includes both content and the output of embedded code. You can embed code like this:

```{r}
1 + 1 # <1>
```
1. Test statement
You can add options to executable code like this 

```{r}
#| echo: false
2 * 2
```

The `echo: false` option disables the printing of code (only output is displayed).


# Code Appendix
```{r, ref.label=knitr::all_labels(),echo=TRUE,eval=FALSE}
```

### Expected behavior

[annotationIssues_expected.pdf](https://github.com/quarto-dev/quarto-cli/files/12744758/annotationIssues_expected.pdf)
Actual behavior

annotationIssues.pdf

Your environment
R version 4.3.1 (2023-06-16)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.6.9
Quarto check output
neilhatfield$ quarto check

[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.1: OK
      Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.3.353
      Path: /Applications/RStudio.app/Contents/Resources/app/quarto/bin

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

[✓] Checking Python 3 installation....OK
      Version: 3.11.1
      Path: /Library/Frameworks/Python.framework/Versions/3.11/bin/python3
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.3.1
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library
      knitr: 1.44
      rmarkdown: 2.25

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.