Pandoc...tifiers(3pm)
β¨ Pandoc::Filter::HeaderIdentifiers β¨
okay bestie so this is a Perl module from the User Contributed Perl Documentation collection, and it's giving Pandoc::Filter::HeaderIdentifiers β the little filter that goes around handing out id attributes to your headers like party favours π
π NAME π
Pandoc::Filter::HeaderIdentifiers β Add identifiers to headers π¦
πΈ SYNOPSIS πΈ
my $id = header_identifier( $header->content ); # calculate identifier
Pandoc::Filter::HeaderIdentifiers->new->apply($doc); # add all identifiers
that's it. two lines. one to figure out a single identifier, one to sprinkle them across your whole document like glitter, no cap β¨
π«Ά DESCRIPTION π«Ά
This Pandoc::Filter is literally here to add identifier attributes (id) to all Header elements. and the way it does it?? it uses the same algorithm as internally used by pandoc β so you're not getting some knockoff vibe, you're getting the real thing π
The module also exports the function header_identifier so you can calculate an identifier from a list of elements yourself, if you're feeling main-character about it π
β FUNCTIONS β
π header_identifier( $content [, $ids ] )
Returns an identifier for a given list of inlines or string ($content).
Optionally it can take existing ids into account β and update them, too β if you hand it a hash reference mapping identifier to usage count ($ids). so it knows who's already claimed which name, periodt π
π₯ METHODS π₯
π apply( $element [, $ids ] )
Adds identifiers to all Header elements found at a given element (typically a Document π«Ά). You can also pass in a hash reference of existing identifier counts β or an empty hash if you just want the new counts back. either way, it's gonna count π
π CHARACTER PROPERTIES π
π InPandocHeaderIdentifier
Matches all Unicode lowercase letters, digits 0 to 9, underscore, hyphen, and period. iconic character class tbh π
In the unlikely event that you want to check whether a given string could have been generated as a header identifier, use this:
$id =~ /^\p{InPandocHeaderIdentifier}+$/ and $id =~ /^\p{Letter}/
ngl it really is unlikely, but we support you either way π
π¦ SEE ALSO π¦
<http://pandoc.org/MANUAL.html#header-identifiers>
go read the pandoc manual bestie, it's giving lore πβ¨
and that's a wrap on this lil page π§ β it came to you courtesy of perl v5.38.2, dated 2024-08-03, from the User Contributed Perl Documentation section (3pm) π bye ily, go annotate some headers ππΈ
π¦ where this page comes from
- debian trixie: libpandoc-elements-perl 0.38-7 Β· GPL-2.0-only
- ubuntu resolute: libpandoc-elements-perl 0.38-7 Β· GPL-2.0-only
- ubuntu stonking: libpandoc-elements-perl 0.38-7 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms