Skip to content

Conversation

cderv
Copy link
Collaborator

@cderv cderv commented Oct 23, 2024

fixes #7142

When we deal with Code Annotation in our Lua processing, if incremental: true is set, then we make sure to wrap the definition list in a Div of class nonincremental, which is the way to opt out per Pandoc's documentation: https://pandoc.org/MANUAL.html#incremental-lists

For now, it will modify the resulting DOM in revealjs as Pandoc removes the class, but does not clean div when it is empty: jgm/pandoc#10328

We could do the cleaning if necessary. We could generalise the scaffold added for blockquotes

// Remove blockquote scaffolding added in Lua post-render to prevent Pandoc syntax for applying
if (doc.querySelectorAll("div.blockquote-list-scaffold")) {
const blockquoteListScaffolds = doc.querySelectorAll(
"div.blockquote-list-scaffold",
);
for (const blockquoteListScaffold of blockquoteListScaffolds) {
const blockquoteListScaffoldEL = blockquoteListScaffold as Element;
const blockquoteListScaffoldParent =
blockquoteListScaffoldEL.parentNode;
if (blockquoteListScaffoldParent) {
while (blockquoteListScaffoldEL.firstChild) {
blockquoteListScaffoldParent.insertBefore(
blockquoteListScaffoldEL.firstChild,
blockquoteListScaffoldEL,
);
}
blockquoteListScaffoldParent.removeChild(blockquoteListScaffoldEL);
}
}
}

This is one way to solve #7142 - As mention in Team discussion, we could also do post processing to remove fragment on DefinitionList created for annotation.

Design question:

For now, this applies to all code annotation. This means that when incremental: true and code-annoation: below, the definition list won't be incremental.
image

We could only apply this logic to code-annotation: hover or code-annotation: select if we think those list should be incremental like any other Definition List. I am hesitant on this...

Enregistrement.2024-10-23.163853.mp4

Any thoughts ?

cderv added 2 commits October 23, 2024 16:13
… incremental applying

Only do it when `incremental: true` is set

This leaves behind an empty <div> element in the output, which is not ideal.
@cderv cderv added the needs-discussion Issues that require a team-wide discussion before proceeding further label Oct 23, 2024
@cderv cderv removed the needs-discussion Issues that require a team-wide discussion before proceeding further label Oct 23, 2024
@cderv
Copy link
Collaborator Author

cderv commented Oct 23, 2024

We keep current behavior and so only fix this for hover and select and keep incremental for below

…tal: true`

This is how it is working in Quarto 1.5 and previous
@cderv
Copy link
Collaborator Author

cderv commented Oct 23, 2024

For now, it will modify the resulting DOM in revealjs as Pandoc removes the class, but does not clean div when it is empty: jgm/pandoc#10328

jgm/pandoc#10328 has been solved in upstream pandoc so the <div> will be removed in 1.7 when we'll update Pandoc.

[skip ci]
@cderv cderv merged commit e928dd8 into main Oct 24, 2024
@cderv cderv deleted the revealjs/code-annotation-incremental branch October 24, 2024 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

revealjs: incremental: true conflicts with code-annotations

1 participant