Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/llm-docs/callout-styling-html.md
6446 views
---
main_commit: 50db5a5b0 analyzed_date: 2026-01-22 key_files: - src/resources/formats/html/bootstrap/_bootstrap-rules.scss - src/resources/formats/revealjs/quarto.scss - src/resources/formats/html/styles-callout.html - src/resources/filters/customnodes/callout.lua
---

HTML Callout Styling Architecture

This document describes the CSS architecture for Quarto callouts across HTML-based output formats.

Overview

Quarto uses a three-tier callout styling architecture depending on the output format:

TierFormatsCSS LocationFeatures
Bootstrap HTMLhtml (with themes)formats/html/bootstrap/_bootstrap-rules.scssFull theming, collapsible, dark mode
RevealJSrevealjsformats/revealjs/quarto.scssPresentation-specific scaling, slide-aware
Standalone HTMLepub, gfm, plain htmlformats/html/styles-callout.htmlInline CSS, no dependencies

All HTML callouts support three appearance values:

  • default: Full-featured with colored header background

  • simple: Lightweight with left border only

  • minimal: Maps to simple with icon=false

Format Detection (Lua Filter)

The Lua filter src/resources/filters/customnodes/callout.lua selects the appropriate renderer:

Renderer selection order: 1. hasBootstrap() → Bootstrap HTML renderer 2. isEpubOutput() || isRevealJsOutput() → Simpler HTML structure 3. isGfmOutput() → GitHub markdown alerts 4. Default → BlockQuote fallback

The hasBootstrap() function (in filters/common/pandoc.lua) checks the has-bootstrap parameter set by TypeScript during format initialization.

HTML Structure by Format

Bootstrap HTML

<div class="callout callout-style-default callout-note callout-titled"> <div class="callout-header d-flex align-content-center"> <div class="callout-icon-container"><i class='callout-icon'></i></div> <div class="callout-title-container flex-fill">Title</div> </div> <div class="callout-body-container"> <div class="callout-body">Content</div> </div> </div>

EPUB/RevealJS HTML

<div class="callout callout-note callout-style-default"> <div class="callout-body"> <div class="callout-icon-container"><i class='callout-icon'></i></div> <div class="callout-title">Title</div> <div class="callout-content">Content</div> </div> </div>

Note: Bootstrap uses callout-body-container wrapper and Bootstrap utility classes (d-flex, flex-fill). EPUB/RevealJS uses a flatter structure.

Feature Comparison

FeatureBootstrapRevealJSStandalone
CollapsibleYesNoNo
Icon typeSVG (dynamic color)SVG (dynamic color)PNG (base64)
ThemingFull Bootstrap varsPresentation varsFixed colors
Dark modeYesSlide background awareNo
Font scalingResponsivePresentation-specific (0.7em)Fixed (0.9rem)

Bootstrap HTML Styling

File: src/resources/formats/html/bootstrap/_bootstrap-rules.scss

Callout States

StateCSS ClassDescription
Titled.callout-titledHas a title/header
Untitled:not(.callout-titled)Content only, no header
Collapsed.callout-header.collapsedCollapsible, currently closed
Empty content.callout-empty-contentNo body content

Styling Patterns

Base callout:

.callout { margin-top: $callout-margin-top; margin-bottom: $callout-margin-bottom; border-radius: $border-radius; }

Simple vs Default appearance:

  • .callout-style-simple: Left border only, lighter styling

  • .callout-style-default: Full border, colored header background

Body margins vary by appearance (simple/default) and titled state (titled/untitled). The margin rules handle edge cases like collapsed callouts and empty content states.

Theming Variables

Bootstrap callouts use SCSS variables (in _bootstrap-variables.scss):

$callout-border-width: 0.4rem !default; $callout-border-scale: 0% !default; $callout-icon-scale: 10% !default; $callout-margin-top: 1.25rem !default; $callout-margin-bottom: 1.25rem !default;

Colors are defined per callout type (note, warning, important, tip, caution) using Bootstrap's color functions.


RevealJS Styling

File: src/resources/formats/revealjs/quarto.scss

Presentation-Specific Adjustments

// Variables $callout-border-width: 0.3rem; $callout-margin-top: 1rem; $callout-margin-bottom: 1rem; // Font scaling for slide readability .reveal div.callout { font-size: 0.7em; }

Light/Dark Slide Awareness

RevealJS callouts adjust colors based on slide background using the shift_to_dark mixin:

.has-dark-background div.callout-note { // Lighter colors for dark backgrounds }

Standalone/EPUB Styling

File: src/resources/formats/html/styles-callout.html

Characteristics

  • Inline CSS embedded in HTML template

  • PNG icons (base64-encoded) instead of SVG

  • Fixed colors: Uses hardcoded #acacac, silver borders

  • No collapsible support

  • No theming - works without Bootstrap or any CSS framework

Key Selectors

.callout /* Base container */ .callout.callout-style-simple /* Simple bordered style */ .callout.callout-style-default /* Default style with header */ .callout-title /* Title container */ .callout-body /* Content container */ .callout-icon::before /* Icon pseudo-element */

CSS Class Reference

Classes applied across all HTML formats:

ClassApplied WhenPurpose
.calloutAlwaysBase container
.callout-{type}AlwaysType: note, warning, important, tip, caution
.callout-style-{appearance}AlwaysStyle: default, simple
.callout-titledHas titleStructural indicator
.no-iconicon=falseSuppress icon
.callout-empty-contentNo bodyEmpty state (Bootstrap only)

CSS/SCSS

FilePurpose
src/resources/formats/html/bootstrap/_bootstrap-rules.scssBootstrap HTML callout styles
src/resources/formats/html/bootstrap/_bootstrap-variables.scssBootstrap callout variables
src/resources/formats/revealjs/quarto.scssRevealJS callout styles
src/resources/formats/html/styles-callout.htmlStandalone HTML template
src/resources/formats/dashboard/quarto-dashboard.scssDashboard margin overrides

Lua Filters

FilePurpose
src/resources/filters/customnodes/callout.luaRenderer selection and AST processing
src/resources/filters/modules/callouts.luaBootstrap renderer implementation
src/resources/filters/common/pandoc.luahasBootstrap() function

Tests

FilePurpose
tests/docs/callouts.qmdAll callout types and appearances
tests/docs/playwright/html/callouts/Playwright test documents
tests/integration/playwright/tests/html-callouts.spec.tsPlaywright CSS tests