2 # quick HTML heading id adder by Paul Wise
3 package IkiWiki::Plugin::headinganchors;
11 hook(type => "getsetup", id => "headinganchors", call => \&getsetup);
12 hook(type => "sanitize", id => "headinganchors", call => \&headinganchors);
30 $str =~ s/^[^a-zA-Z]/z-/; # must start with an alphabetical character
31 $str = uri_escape_utf8($str);
36 sub headinganchors (@) {
38 my $content=$params{content};
39 $content=~s{<h([0-9])>([^>]*)</h([0-9])>}{'<h'.$1.' id="'.text_to_anchor($2).'">'.$2.'</h'.$3.'>'}gie;