Pandoc::Filter::HeaderIdentifiers - Add identifiers to headers
my $id = header_identifier( $header->content ); # calculate identifier Pandoc::Filter::HeaderIdentifiers->new->apply($doc); # add all identifiers
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.
header_identifier
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).
$content
$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.
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}/
http://pandoc.org/MANUAL.html#header-identifiers
To install Pandoc::Elements, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pandoc::Elements
CPAN shell
perl -MCPAN -e shell install Pandoc::Elements
For more information on module installation, please visit the detailed CPAN module installation guide.