Extending Quarto workshop @ posit::conf(2025)
Notes that we want as slides (format: revealjs
) and a document (format: html
).
Title slide in every slide deck controlled by metadata
Partial
Special slide combines boilerplate with content.
Filter
Write the participate.lua
filter to combine the content of the question in the div with class .participate
with boilerplate text:
Your slide should look like this:
Hints:
pandoc.Blocks()
, insert
Block
s, extend
with Blocks
.pandoc.Str()
a string with spaces.Exercise: 04-case-study/your-turns/1-add-filter
08:00
Take a look at the version of participate.lua
on the next slide.
With your neighbor, predict what the “Participate” slide will look like.
Exercise: 04-case-study/your-turns/2-predict-output
05:00
participate.lua
participate.lua
local function column(width)
return pandoc.Attr("", {'column'}, {width=width})
end
Div = function(el)
if not el.classes:includes("participate") then
return nil
end
local content = pandoc.Div(el.content, pandoc.Attr("", {'question'}, {}))
if not quarto.format.isHtmlSlideOutput() then
return content
end
local boilerplate = pandoc.Para(pandoc.Inlines({
pandoc.Image(
"",
"Discord-Logo-Black.png",
nil,
pandoc.Attr("", {}, {alt="Discord Logo"})
),
pandoc.Str("Answer in our "),
pandoc.Link(
pandoc.Str("Discord"),
pandoc.utils.stringify(quarto.metadata.get("discord")))
}))
local inner_columns = pandoc.Blocks({
pandoc.Div(content, column('75%')),
pandoc.Div(boilerplate, column('25%'))
})
local result = pandoc.Div(inner_columns, pandoc.Attr("", {"columns"}, {}))
return result
end
Take what you developed so far in this module and add your title-slide.html
partial and slides.scss
theme from earlier.
Exercise: 04-case-study/your-turns/3-add-partial
Example: 04-case-study/example
as an extension!
Example: 04-case-study/coursenotes
{{< include >}}
s are a convenient way to reuse content across documents
template-partial
s are a way to create reusable components with meta-data
format
specificfilter
s are a way to modify document content
format
specific (they operate on the document AST), but can function differently for different formats_extensions
are combinations of partial
s and filter
s, and possibly other things, that are designed for portability and reusabilityBefore we move on to Q&A, please take a note of the workshop survey:
Any questions, but especially of the kind:
How can I solve _
my problem_
with a filter, partial, etc.?
Do I need a filter or partial or something else for solving _
my problem_
?