Skip to content

Commit ec1c554

Browse files
authored
Merge pull request #13218 from mcanouil/fix/issue13216
2 parents 7001b78 + b66b3b0 commit ec1c554

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

news/changelog-1.8.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ All changes included in 1.8:
137137
- ([#13085](https://github.com/quarto-dev/quarto-cli/pull/13085)): Avoid `kbd` shortcode crashes on unknown OS keys.
138138
- ([#13164](https://github.com/quarto-dev/quarto-cli/pull/13164)): add `julia` to execute schema to allow autocomplete suggestions. (@mcanouil)
139139
- ([#13121](https://github.com/quarto-dev/quarto-cli/issues/13121)): Allow `contents` shortcode to find inline elements.
140+
- ([#13216](https://github.com/quarto-dev/quarto-cli/issues/13216)): Properly disable `downlit` (`code-link`) and enable `code-annotations` when non-R code blocks are present.
140141

141142

142143
## Quarto Internals

src/resources/rmd/rmd.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,14 @@
102102
# within a code chunk
103103
for (x in seq_along(chunkStarts)) {
104104
start <- chunkStarts[x]
105-
end <- chunkEnds[x]
105+
# Ensure end is greater than start
106+
end <- start
107+
for (e in chunkEnds) {
108+
if (e > start) {
109+
end <- e
110+
break
111+
}
112+
}
106113
for (y in start:end) {
107114
if (y > start && y < end) {
108115
chunkMap[y] <- TRUE
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: "Issue 13216"
3+
format: html
4+
code-annotations: below
5+
code-link: true
6+
_quarto:
7+
tests:
8+
html:
9+
ensureHtmlElements:
10+
-
11+
- "dl.code-annotation-container-grid"
12+
---
13+
14+
`downlit` (`code-link`) should be disable and `code-annotations` should be enabled.
15+
16+
```
17+
hello
18+
```
19+
20+
```{r}
21+
2 + 2 # <1>
22+
```
23+
24+
1. This is an annotation that should be properly displayed based on `code-annotations` setting.

0 commit comments

Comments
 (0)