Pandoc::Filter::HeaderIdentifiers(3pm)

Pandoc::Filter::HeaderIdentifiers3pm

Add identifiers to headers

Usage

  my $id = header_identifier( $header->content );       # calculate identifier
  Pandoc::Filter::HeaderIdentifiers->new->apply($doc);  # add all identifiers

Overview

This Pandoc::Filter adds identifier attributes (id) to all Headers elements. It uses the same algorithm as internally used by pandoc. The module also exports function "header_identifier" to calculate an identifier from a list of elements.

Functions

header_identifier( $content [, $ids ] )

Returns an identifier for a given list of inlines or string ($content). Optionally takes into account and updates existing ids, given as hash reference mapping identifier to usage count ($ids).

Methods

apply( $element [, $ids ] )

Add identifiers to all Header elements found at a given element (typically a Document. A hash reference of existing identifier counts (or an empty hash to get the new counts) can be passed in addition.

Character properties

InPandocHeaderIdentifier

Matches all Unicode lowercase letters, digits 0 to 9, underscore, hyphen, and period. In the unlikely event that you want to check whether a given string could have been generated as header identifier, use this:

  $id =~ /^\p{InPandocHeaderIdentifier}+$/ and $id =~ /^\p{Letter}/

Releases

3 releases since Debian 10 (Buster); the text changed 2 times.

  1. 10
  2. 12
  3. 13

From libpandoc-elements-perl 0.38-7 in Debian 13 (Trixie). Parsed by carta from the page's man source.