-
DescriptionI'm wondering if it's possible to create new, or extend existing, callout types and then to share/deploy them via an extension? For context: I've got a set of iPython teaching notebooks that make use of the built-in CSS classes (
Currently these are notebooks, but I've realised that I could manage them quite effectively as QMD files and want to swap to rendering the ipynb file from the QMD instead of maintaining the notebook file as-is. I use these alert-blocks enough that I don't want to be continually tweaking a The logic for sharing this as an extension is that my colleagues (or anyone else who was interested) could then use this same approach for a more standardised presentation of our teaching materials. I can't quite figure how to do this based on the materials I've found at docs/authoring/callouts.html and docs/authoring/callouts.html and quarto-dev/quarto-cli/discussions/4755. Any guidance gratefully received. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
This will need to be done in a Lua filter. You'd need to write a filter that catches divs, detects the class "notebook-link", and then emit a callout programmatically. That filter would look something like this: function Div(div)
if div.classes:includes("notebook-link") then
-- create callout here, something like the following.
-- You'll need to inspect the contents of the
return quarto.Callout({
type = "note",
content = div.content
title = "Notebook link"
})
end
end Then you can create an extension that exposes the filter. Documentation on filter extensions, and Lua development for Quarto. |
Beta Was this translation helpful? Give feedback.
-
Hi @jreades in the past there were an interesting discussion about callouts (how to convert Obsidian/github callouts to the quarto/pandoc type, you might find it useful) |
Beta Was this translation helpful? Give feedback.
-
Thank you very much, that’s really helpful! Will check these out and see how I do — Lua definitely not part of my knowledge base but I usually get there in the end.
|
Beta Was this translation helpful? Give feedback.
This will need to be done in a Lua filter. You'd need to write a filter that catches divs, detects the class "notebook-link", and then emit a callout programmatically. That filter would look something like this:
Then you can create an extension that exposes the filter.
Documentation on filter extensions, and Lua development for Quarto.