Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions news/changelog-1.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ All changes included in 1.8:
- ([#12598](https://github.com/quarto-dev/quarto-cli/pull/12598)): Ensure `.fragment` on an image with caption applies to whole figure.
- ([#12716](https://github.com/quarto-dev/quarto-cli/issues/12716)): Correctly resolve `"brand"` set in `theme` configuration for document in subdirectory from project root.
- Use `cdn.jsdelivr.net` for mathjax dependencies to ensure consistent CDN usage across formats. Previously, `cdnjs.cloudflare.com` was used for `revealjs` mathjax dependencies, while `cdn.jsdelivr.net` was used for html format.
- [#13316](https://github.com/quarto-dev/quarto-cli/issues/13316): `code-line-numbers: "1"` correctly highlight the first line now.

### `docx`

Expand Down Expand Up @@ -70,6 +71,10 @@ All changes included in 1.8:

- ([#12676](https://github.com/quarto-dev/quarto-cli/issues/12676)): Add support for rendering layout panels that are not floats.

### `docusaurus-md`

- [#13316](https://github.com/quarto-dev/quarto-cli/issues/13316): `code-line-numbers: "1"` correctly highlight the first line now.

## Projects

### `website`
Expand Down
4 changes: 3 additions & 1 deletion src/resources/filters/quarto-pre/line-numbers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ end
function lineNumbersAttribute(el)
local default = param(constants.kCodeLineNumbers, false)
local lineNumbers = attribute(el, constants.kCodeLineNumbers, default)
if lineNumbers == true or lineNumbers == "true" or lineNumbers == "1" then
-- format that do accept string for this attributes. "1" and "0" should not be parsed as TRUE / FALSE
local acceptStrings = _quarto.format.isRevealJsOutput() or _quarto.format.isDocusaurusOutput()
if lineNumbers == true or lineNumbers == "true" or (lineNumbers == "1" and not acceptStrings) then
return true
elseif lineNumbers == false or lineNumbers == "false" or lineNumbers == "0" then
return false
Expand Down
27 changes: 27 additions & 0 deletions tests/docs/smoke-all/2025/09/02/13316.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: highlight first line
format: html
_quarto:
tests:
html:
ensureHtmlElements:
- ['pre.sourceCode.number-lines']
- ['#cb1[data-code-line-numbers="1"]']
revealjs:
ensureHtmlElements:
- ['#cb1[data-code-line-numbers="1"]', 'pre.sourceCode.number-lines']
- []
docusaurus-md:
ensureFileRegexMatches:
- ['[`]{3}r \{1\} showLineNumbers']
- []
execute:
echo: true
---

```{r}
#| code-line-numbers: "1"
mean(
c(1, 2, 3, 4, 5)
)
```
Loading