Skip to content

Commit

Permalink
Merge pull request #10659 from quarto-dev/revealjs/incremental-blockq…
Browse files Browse the repository at this point in the history
…uote
  • Loading branch information
cderv authored Aug 30, 2024
2 parents 885239e + 0e175fb commit 74e55b5
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/changelog-1.6.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ All changes included in 1.6:
## `revealjs` Format

- Update to Reveal JS 5.1.0.
- ([#7715](https://github.com/quarto-dev/quarto-cli/issues/7715)): Revealjs don't support anymore special Pandoc syntax making BulletList in Blockquotes become incremental list. This was confusing and unexpected behavior. Supported syntax for incremental list is documented at <https://quarto.org/docs/presentations/revealjs/#incremental-lists>.

## `typst` Format

Expand Down
21 changes: 21 additions & 0 deletions src/format/reveal/format-reveal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,27 @@ function revealHtmlPostprocessor(
supporting: [],
};

// 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);
}
}
}

// apply highlighting mode to body
doc.body.classList.add("quarto-" + highlightingMode);

Expand Down
3 changes: 2 additions & 1 deletion src/resources/filters/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@ local quarto_post_filters = {
{ name = "post-render-gfm-fixups", filter = render_gfm_fixups() },
{ name = "post-render-hugo-fixups", filter = render_hugo_fixups() },
{ name = "post-render-email", filters = render_email() },
{ name = "post-render-pptx-fixups", filter = render_pptx_fixups() }
{ name = "post-render-pptx-fixups", filter = render_pptx_fixups() },
{ name = "post-render-revealjs-fixups", filter = render_reveal_fixups() }
}

local quarto_finalize_filters = {
Expand Down
16 changes: 16 additions & 0 deletions src/resources/filters/quarto-post/reveal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,20 @@ function asCssSize(size)
else
return size
end
end

function render_reveal_fixups()
if not _quarto.format.isRevealJsOutput() then
return {}
end
return {
-- Prevent BulletList in blockquote to be made incremental with .fragment class
-- https://github.com/quarto-dev/quarto-cli/issues/7715
BlockQuote = function(b)
if #b.content and b.content[1].t == "BulletList" then
b.content = pandoc.Div(b.content, pandoc.Attr('', {'blockquote-list-scaffold'}))
return b
end
end
}
end
17 changes: 17 additions & 0 deletions tests/docs/smoke-all/2024/08/30/7715.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: BulletList in Blockquote should not be fragment
format: revealjs
_quarto:
tests:
revealjs:
ensureHtmlElements:
- ['blockquote > ul > li:not([class])']
- ['blockquote > ul > li.fragment', 'div.blockquote-list-scaffold']
---

## Blockquote and incremental

> * Foo
> * Bar
Using blockquote should not create incremental like Pandoc (https://pandoc.org/MANUAL.html#incremental-lists)

0 comments on commit 74e55b5

Please sign in to comment.