Skip to content

Commit 909fb79

Browse files
authored
revert to only auto-binding engines based on block code cells (#4689)
* revert to only auto-binding engines based on block code cells * fix tests after auto-binding change
1 parent 1631817 commit 909fb79

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

news/changelog-1.3.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
## Knitr engine
1717

1818
- Help rmarkdown find pandoc binary bundled with Quarto if none is found ([#3688](https://github.com/quarto-dev/quarto-cli/issues/3688)).
19+
- Do not bind knitr engine when only inline `r` expressions are found ([#3908](https://github.com/quarto-dev/quarto-cli/issues/3908)).
1920

2021
## Code Annotation
2122

src/execute/engine.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ export function markdownExecutionEngine(
130130
}
131131

132132
// if there is no computational engine discovered then bind
133-
// to the knitr engine if there are inline r expressions
134-
return engineForMarkdownWithNoLanguages(markdown);
133+
// to the markdown engine;
134+
return markdownEngine;
135135
}
136136

137137
/**
@@ -209,14 +209,6 @@ export async function fileExecutionEngineAndTarget(
209209
};
210210
}
211211

212-
function engineForMarkdownWithNoLanguages(markdown: string) {
213-
if (markdown.match(/`r[ #]([^`]+)\s*`/)) {
214-
return knitrEngine;
215-
} else {
216-
return markdownEngine;
217-
}
218-
}
219-
220212
export function engineIgnoreDirs() {
221213
const ignoreDirs: string[] = ["node_modules"];
222214
executionEngines().forEach((name) => {
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
An inline r value `r 7 * 11 * 13`.
1+
An inline r value `r 7 * 11 * 13`.
2+
3+
As of 2023-03-07, we only auto-bind code blocks.
4+
5+
```{r}
6+
3 + 4
7+
```

tests/docs/scholar/generated-bib.qmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ citation:
2929
collection-title: foo
3030
keyword: 'foo, bar'
3131
bibliography: "`r 'references.bib'`"
32+
engine: knitr
3233
---
3334

3435
## this is a test document

tests/docs/smoke-all/2023/02/22/generated-bib.qmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ citation:
2929
collection-title: foo
3030
keyword: 'foo, bar'
3131
bibliography: "`r 'references.bib'`"
32+
engine: knitr
3233
---
3334

3435
## this is a test document

0 commit comments

Comments
 (0)