Skip to content

Commit 75717b5

Browse files
committed
docusaurus - fix code-line-numbers: "1" not highlighting first line
This also affects docusaurus-md output. Add test, and fix filter
1 parent 67c5440 commit 75717b5

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

news/changelog-1.8.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ All changes included in 1.8:
7171

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

74+
### `docusaurus-md`
75+
76+
- [#13316](https://github.com/quarto-dev/quarto-cli/issues/13316): `code-line-numbers: "1"` correctly highlight the first line now.
77+
7478
## Projects
7579

7680
### `website`

src/resources/filters/quarto-pre/line-numbers.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function lineNumbersAttribute(el)
2727
local default = param(constants.kCodeLineNumbers, false)
2828
local lineNumbers = attribute(el, constants.kCodeLineNumbers, default)
2929
-- format that do accept string for this attributes. "1" and "0" should not be parsed as TRUE / FALSE
30-
local acceptStrings = _quarto.format.isRevealJsOutput() and not _quarto.format.isDocusaurusOutput()
30+
local acceptStrings = _quarto.format.isRevealJsOutput() or _quarto.format.isDocusaurusOutput()
3131
if lineNumbers == true or lineNumbers == "true" or (lineNumbers == "1" and not acceptStrings) then
3232
return true
3333
elseif lineNumbers == false or lineNumbers == "false" or lineNumbers == "0" then

tests/docs/smoke-all/2025/09/02/13316.qmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
title: highlight first line
23
format: html
34
_quarto:
45
tests:
@@ -10,6 +11,10 @@ _quarto:
1011
ensureHtmlElements:
1112
- ['#cb1[data-code-line-numbers="1"]', 'pre.sourceCode.number-lines']
1213
- []
14+
docusaurus-md:
15+
ensureFileRegexMatches:
16+
- ['[`]{3}r \{1\} showLineNumbers']
17+
- []
1318
execute:
1419
echo: true
1520
---

0 commit comments

Comments
 (0)