Pandoc::Filter::HeaderIdentifiers(3pm) | User Contributed Perl Documentation | Pandoc::Filter::HeaderIdentifiers(3pm) |
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.
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).
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>
2023-01-02 | perl v5.36.0 |