Pandoc...tifiers(3pm)

πŸ“¦
version 0.38 Β· 3 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ 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