Skip to content

Code Annotation Blocks Generation of Code Appendix #7053

@neilhatfield

Description

@neilhatfield

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcode-annotationluaIssues related to the lua codebase, filter chain, etc

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions