Skip to content
Christophe Demko edited this page Apr 17, 2016 · 10 revisions

Each paragraph containing only a listof-marker will be replaced by a list of links pointing to all span whose id is defined in the listof-marker

The syntax for listof-marker is:

where:

  • prefix is a string composed of a letter followed by any number of letters, digits, dash or dot. (i.e. my-prefix)
  • sectioning can be either a numbered-sectioning or a wildcard-sectioning

If there is no sectioning part, the filter creates a list of links of all spans whose identifier is prefixed by prefix:

Thus

<span id="exercise:1">**Exercise 1**</span>

This is the first exercise.

<span id="exercise:2">**Exercise 2**</span>

This is the second exercise.

<span id="exercise:3">**Exercise 3**</span>

This is the third exercise.

{exercise}

will be rendered as

<span id="exercise:1">**Exercise 1**</span>

This is the first exercise.

<span id="exercise:2">**Exercise 2**</span>

This is the second exercise.

<span id="exercise:3">**Exercise 3**</span>

This is the third exercise.

-   [Exercise 1](#exercise:1)
-   [Exercise 2](#exercise:2)
-   [Exercise 3](#exercise:3)

A numbered-sectioning part is composed of a list of numbers separated by dots.

If a numbered-sectioning part is set, only spans belonging to that sectioning will be listed.

Thus

List of exercises for the first section
---------------------------------------

{exercise:1}

List of exercises for the second section
---------------------------------------

{exercise:2}

First Section
=============

<span id="exercise:1">**Exercise 1**</span>

This is the first exercise.

Second Section
=============

<span id="exercise:2">**Exercise 2**</span>

This is the second exercise.

<span id="exercise:3">**Exercise 3**</span>

This is the third exercise.

will be rendered as

List of exercises for the first section
---------------------------------------

-   [Exercise 1](#exercise:1)

List of exercises for the second section
----------------------------------------

-   [Exercise 2](#exercise:2)
-   [Exercise 3](#exercise:3)

First Section
=============

<span id="exercise:1">**Exercise 1**</span>

This is the first exercise.

Second Section
==============

<span id="exercise:2">**Exercise 2**</span>

This is the second exercise.

<span id="exercise:3">**Exercise 3**</span>

This is the third exercise.

In the preceding example:

  • {exercise:1} lists all spans whose identifier is prefixed by exercise: that belong to the first section.
  • {exercise:2} lists all spans whose identifier is prefixed by exercise: that belong to the second section.

A wildcard-sectioning part is composed of a list of sharps separated by dots.

If a wildcard-sectioning part is set, only spans belonging to the current sectioning will be listed.

Thus

First Section
=============

First subsection
----------------

{exercise:#.#}

<span id="exercise:1">**Exercise 1**</span>

This is the first exercise.

Second subsection
-----------------

{exercise:#.#}

<span id="exercise:2">**Exercise 2**</span>

This is the second exercise.

<span id="exercise:3">**Exercise 3**</span>

This is the third exercise.

Second Section
=============

First subsection
----------------

{exercise:#.#}

<span id="exercise:4">**Exercise 4**</span>

This is the fourth exercise.

<span id="exercise:5">**Exercise 5**</span>

This is the fifth exercise.

will be rendered as

First Section
=============

First subsection
----------------

-   [Exercise 1](#exercise:1)

<span id="exercise:1">**Exercise 1**</span>

This is the first exercise.

Second subsection
-----------------

-   [Exercise 2](#exercise:2)
-   [Exercise 3](#exercise:3)

<span id="exercise:2">**Exercise 2**</span>

This is the second exercise.

<span id="exercise:3">**Exercise 3**</span>

This is the third exercise.

Second Section
==============

First subsection
----------------

-   [Exercise 4](#exercise:4)
-   [Exercise 5](#exercise:5)

<span id="exercise:4">**Exercise 4**</span>

This is the fourth exercise.

<span id="exercise:5">**Exercise 5**</span>

This is the fifth exercise.

This filter can be efficiently combined with pandoc-numbering.

Example

Demonstration: Using pandoc-listof-sample.txt as input gives output files in pdf, tex, html, epub and other formats.

Clone this wiki locally