Skip to content

Extension template for defining custom callout (boxes) for Quarto. To be forked to create your own callout.

Notifications You must be signed in to change notification settings

prodageo/custom-callout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Need

For implementing Single Source Publishing based on a common language for all formats (namely Markdown) with help of Quarto, manage a common syntax in Markdown for customized callout (nice box) compatible with revealjs, beamer. It should be possible to put these callouts inside columns delimited by fenced div.

Installation

  • install the extension

quarto add frederic-baucher/callout-custom

  • add the following to _quarto.yml
format:
  revealjs:
    filters: 
      - _extensions/frederic-baucher/callout-custom/revealjs-callout-custom.lua
  beamer:
    include-in-header:
      file: _extensions/frederic-baucher/callout-custom/callout-custom.tex

Create a custom callout extension

First, create a fork of this repo. Suppose we create the example callout. Then add 3 files to manage the callout in the 3 corresponding format

  • callout-example-html.lua
  • callout-example-revealjs.lua
  • callout-example.tex

ADR

Alternatives selected

Syntax A + lua + tex (revealjs:OK, beamer:OK)

:::{.callout-example data-latex="{a nice title for callout}"}
* Know how to make your own callouts.
* Be able to mess with some SCSS/CSS styling.
:::

Alternatives rejected

Syntax A + tex (revealjs:KO, beamer:OK)

:::{.callout-example data-latex="{a nice title for callout}"}
* Know how to make your own callouts.
* Be able to mess with some SCSS/CSS styling.
:::

Syntax B (revealjs:OK, beamer:KO)

Syntax B : title given by first header after fenced div

:::{.callout-example data-latex=""}
### a nice title for callout
* Know how to make your own callouts.
* Be able to mess with some SCSS/CSS styling.
:::

Syntax C + scss + tex (revealjs:OK, beamer:BUG)

  • Should be OK in beamer but the tags are mixed because a bug in latex ?

excerpt from example.yml

:::{.callout-example data-latex=""}
::::{.callout-example-header data-latex=""}
a nice title for callout
::::
* Know how to make your own callouts.
* Be able to mess with some SCSS/CSS styling.
:::

_quarto.yml

format:
  html:
    theme:
      - cosmo
	  - diy/callout-example.scss

Tests

quarto render example.qmd quarto preview example.qmd

Resources

function latex(s)
return pandoc.RawBlock('latex', s)
end

function Div(el)
if el.classes[1] == 'solution' then
return { latex('\begin{solution}'), el.content, latex('\end{solution}') }
end
end
---
output:
  html_document:
    css: style.css
  pdf_document:
    includes:
      in_header: preamble.tex
---

About

Extension template for defining custom callout (boxes) for Quarto. To be forked to create your own callout.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published