You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am writing a lua filter to edit chapter headers in a Quarto book. However my filter doesn't access the level 1 headers in chapters, only in the index.qmd. I can see the problem in the page source but I don't know how to solve it.
function Header(el)
quarto.log.output(pandoc.utils.stringify(el.level))
end
index.qmd and one.qmd
# One
## Two
### Three
What I see in the pandoc output. The numbers are the level of the headers encountered. My filter is not "seeing" the level 1 header in the first chapter (one.qmd).
[1/2] index.qmd
1
2
3
[2/2] one.qmd
2
3
What I expect to see. Both qmd are identical with the same three headers.
[1/2] index.qmd
1
2
3
[2/2] one.qmd
1
2
3
Looking at the page source, I see the problem I think. The <h1> with the chapter title is inside a <header> block. But I don't know how to change my filter to get "inside" the header block. I don't actually care about the h1 headers. I am trying to change the <span class="chapter-number"> that is in <header> but I don't know how to access it.
Ok, I think I might know what's going on. I think this is a pandoc.MetaBlock and I need to tell the filter to work on that. Right now it is working blocks and pandoc treats titles differently, as MetaBlocks even when in a Quarto book.
booksluaIssues related to the lua codebase, filter chain, etc
3 participants
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Description
Quarto version 1.5.55
I am writing a lua filter to edit chapter headers in a Quarto book. However my filter doesn't access the level 1 headers in chapters, only in the index.qmd. I can see the problem in the page source but I don't know how to solve it.
_quarto.yml
test.lua
index.qmd
andone.qmd
What I see in the pandoc output. The numbers are the level of the headers encountered. My filter is not "seeing" the level 1 header in the first chapter (
one.qmd
).What I expect to see. Both qmd are identical with the same three headers.
Looking at the page source, I see the problem I think. The
<h1>
with the chapter title is inside a<header>
block. But I don't know how to change my filter to get "inside" the header block. I don't actually care about the h1 headers. I am trying to change the<span class="chapter-number">
that is in<header>
but I don't know how to access it.Here is the page source from
one.html
Here is the page source from
index.html
Beta Was this translation helpful? Give feedback.
All reactions