pandoc-crossref Parity Test Page:

This page is a live demo of the pandoc-crossref-style features currently implemented by remark-crossref. It also calls out the current plugin defaults so the examples can be read against the behavior you get without extra configuration.

The defaults shown later in Configuration Reference reflect the current values in src/plugins/crossref-syntax.mjs.

Quick checks:


Figures

A figure is an image by itself in a paragraph with a trailing attribute block such as {#fig:label}.

Basic figure:

A placeholder figure used to demonstrate figure labeling
Figure 1: A placeholder figure used to demonstrate figure labeling

Reference it with Figure. 1.

Width and height attributes:

Width only
Figure 2: Width only
Height only
Figure 3: Height only
Width and height together
Figure 4: Width and height together

See Figure. 2, Figure. 3, and Figure. 4.


Subfigures

Wrap several labeled images in a <div id="fig:...">. The last paragraph becomes the parent caption, and each labeled image receives a subfigure letter.

A cat sitting
(a) A cat sitting
A dog standing
(b) A dog standing
Figure 5: Two animals shown as subfigures

Reference the whole group with Figure. 5. Reference the children with Figure. 5a and Figure. 5b.

Rows and width-driven grids

Each paragraph inside the wrapper becomes a row. Width attributes on the images in a row become grid-template-columns values.

Wide
(a) Wide
Wider
(b) Wider
Equal left
(c) Equal left
Equal right
(d) Equal right
Figure 6: A 2-row subfigure grid with explicit widths on the first row

This also demonstrates dotted labels: Figure. 6a and Figure. 6d.


Equations

Display math can be labeled with a following attribute paragraph, or by embedding a LaTeX \label{...} in the math itself.

Equation labeled after the block:

Reference: Equation. 1.

Equation labeled inside the math:

Reference: Equation. 2.

Another explicit equation for grouped references:

Reference: Equation. 3.

Auto equation labels

Because this page enables autoEqnLabels: true, an unlabeled display equation still gets numbered.


Tables

Tables use a caption paragraph of the form : Caption {#tbl:label}.

ElementSymbolNumber
HydrogenH1
HeliumHe2
LithiumLi3

Table 1: Periodic table excerpt

See Table. 1.

LanguageYearCreator
C1972Dennis Ritchie
Python1991Guido van Rossum
JavaScript1995Brendan Eich

Table 2: Programming languages

Compare Table. 1 and Table. 2.


Sections

Sections can use explicit labels or rely on autoSectionLabels.

Auto-labeled subsection

This subsection has no explicit label. With autoSectionLabels: true, it still receives a section id and can be referenced as ??sec:auto-labeled-subsection.

Depth-aware numbering

This page enables numberSections: true and sectionsDepth: -1, so all heading levels are numbered hierarchically.


Code Listings

Listings can be declared three different ways, plus a pandoc-style wrapping div.

Caption attribute on the fence

Listing 1: Hello World in Python

print("Hello, World!")

Reference: Listing. 1.

Table-style caption before the block

Listing 2: Fibonacci function

def fib(n):
    if n <= 1:
        return n
    return fib(n - 1) + fib(n - 2)

Reference: Listing. 2.

Table-style caption after the block

Listing 3: Greeting function

const greet = (name) => `Hello, ${name}!`;

Reference: Listing. 3.

Wrapping div syntax

Listing 4: Wrapped caption

console.log(1)

Reference: Listing. 4.


Cross-Reference Syntax

Single references

Single references use the full label as the link on this page because nameInLink: true is enabled.

Capitalized references

Prefix suppression

Use [-@...] to remove the default prefix.

Grouped references and ranges

Three consecutive equation numbers collapse into a range in Equations. 13.

Unknown references are preserved visibly

Undefined labels render as ??..., for example: ??fig:does-not-exist.


Custom Labels And Manual Numbering

You can override an item’s displayed number with label="...", or force the numeric counter with number=.

A figure with a custom label
Figure A: A figure with a custom label

Reference: Figure. A uses the custom label A.

Manual numbering start
Figure 7: Manual numbering start
Manual numbering continuation
Figure 8: Manual numbering continuation

Those two figures demonstrate chapter-aware number= overrides: the local counter is forced to 7, so the rendered references become Figure. 7 and Figure. 8 in this chapter.


Visibility And List Filtering

Items with truthy hidden values are omitted from list-of-X output. Section-level hidden also propagates to nested items until a subsection overrides it.

Hidden items by attribute

Hidden figure
Figure 9: Hidden figure

Listing 5: Hidden listing

console.log("hidden")

These items render in the document, but should not appear in the list of figures or list of listings.

Hidden sections with visible overrides

Hidden parent section

Figure hidden by section
Figure 10: Figure hidden by section

Listing 6: Hidden by section

console.log("hidden by section")

Visible child subsection

Figure visible again
Figure 11: Figure visible again

Listing 7: Visible by override

console.log("visible again")

Only Figure. 11 and Listing. 7 should appear in the generated lists below.


List Of Figures / Tables / Listings

Use \listoffigures, \listoftables, and \listoflistings to render ordered lists of the currently registered visible items.

List of Figures

  1. 1. A placeholder figure used to demonstrate figure labeling
  2. 2. Width only
  3. 3. Height only
  4. 4. Width and height together
  5. 5. Two animals shown as subfigures
  6. 6. A 2-row subfigure grid with explicit widths on the first row
  7. A. A figure with a custom label
  8. 7. Manual numbering start
  9. 8. Manual numbering continuation
  10. 11. Figure visible again

List of Tables

  1. 1. Periodic table excerpt
  2. 2. Programming languages

List of Listings

  1. 1. Hello World in Python
  2. 2. Fibonacci function
  3. 3. Greeting function
  4. 4. Wrapped caption
  5. 7. Visible by override

Chapter-Aware Numbering

Because this page enables chapters: true and chaptersDepth: 1, top- level sections act like chapters. Figure, table, equation, and listing numbers reset when a new top-level section begins.

You can see this in the numbering of Figure. 1, Table. 1, Equation. 1, and Listing. 1: each object number is prefixed by the current top-level section number.


Putting It Together

This section cross-references the whole page:

  1. Figure. 1 shows basic figure labeling with image sizing. 2. Figure. 5 groups subfigures like Figure. 5a and Figure. 5b. 3. Equation. 1, Equation. 2, and Equation. 3 demonstrate equation labeling, inline \label, and grouped references. 4. Table. 1 and Table. 2 demonstrate numbered tables. 5. Listing. 1, Listing. 2, Listing. 3, and Listing. 4 demonstrate the supported listing syntaxes. 6. Figure. A, Figure. 7, and Figure. 8 demonstrate custom labels and manual counter overrides. 7. Section. 9 and Section. 10 show hidden-item filtering and the generated list-of-X commands.

Configuration Reference

The following YAML keys are currently supported by the plugin and match the current DEFAULTS in src/plugins/crossref-syntax.mjs.

# Titles
figureTitle: "Figure"
tableTitle: "Table"
listingTitle: "Listing"
titleDelim: ":"

# Prefixes (singular, plural)
figPrefix: ["Figure.", "Figures."]
eqnPrefix: ["Equation.", "Equations."]
tblPrefix: ["Table.", "Tables."]
lstPrefix: ["Listing.", "Listings."]
secPrefix: ["Section.", "Sections."]

# Delimiters
rangeDelim: "–"
pairDelim: ", "
lastDelim: ", "
refDelim: ", "

# Numbering schemes
figLabels: "arabic"
subfigLabels: "alpha a"
eqLabels: "arabic"
tblLabels: "arabic"
lstLabels: "arabic"
secLabels: "arabic"
secLevelLabels: null

# Booleans / numbering controls
autoEqnLabels: false
autoSectionLabels: false
chapters: false
chaptersDepth: 1
codeBlockCaptions: true
linkReferences: true
nameInLink: true
numberSections: false
sectionsDepth: -1

# List-of titles
lofTitle: "## List of Figures"
lotTitle: "## List of Tables"
lolTitle: "## List of Listings"

Notes:

True vs false behavior

These four options are easiest to understand by comparing what happens when they are enabled versus disabled.

autoSectionLabels

Example:

## My Heading

autoEqnLabels

Example:

$$
a^2 + b^2 = c^2
$$

codeBlockCaptions

Examples:

Listing: Fibonacci function {#lst:fib}

```python
print("hello")
```
```javascript
const x = 1;
```

: Greeting function {#lst:greet}

Example:

See @fig:placeholder.

Parity Status