[pmwiki-devel] Using "!#anchor heading" markup
Petko Yotov
5ko at 5ko.fr
Wed Apr 8 23:27:32 PDT 2026
In the HTML source of the rendered page, at the start of the <h2>
heading elements I see anchors like <a id='toc6'>, and the hash sign #
is missing from the identifier. So I suspect some markup rule is
processing the "!!#" part to produce what looks like a table-of-contents
related identifier.
When I open ?action=ruleset, I see a markup rule "^!#", it could be it.
When I open ?action=diag, I see this pattern:
[^!#] => Array(
[cmd] => <links
[seq] => B>>>>><
[pat] => /^(!+|Q?:)#(#?)/
[rep] => TocAnchor
)
This pattern matches the hash character and something else later
consumes it.
So it looks like there is a TocAnchor() function that does this
conversion.
Searching the cookbook, I found the recipe PageTableOfContents has such
a function.
Alternatively, the page PmWiki:Troubleshooting lists a few simpler steps
to track what recipe could cause a bug.
We should probably update PageTableOfContents. I don't see the !!#
markup documented. The pattern matches, at the start of a line:
!!#, !!##, Q:#, Q:##, :#, :##
This produces an anchor like [[#toc6]] or [[##toc6]], the latter is
later rendered as a visible link.
I see none of these patterns or usage documented on the recipe page, and
I don't know how many wikis are using these patterns.
Petko
--
If you upgrade : https://www.pmwiki.org/Upgrades
On 09/04/2026 07:20, Simon wrote:
> After upgrading my wiki to the current version I decided to move to
> the new, and concise "!#anchor heading" markup.
> Viz: Kiwi wiki | Extensions / Url Get [1]
>
> However the anchors are displaying in the headings (see here for how
> it is supposed to look UrlGet - Cookbook - PmWiki [2])
> Naturally I checked, and redid, my upgrade.
> I can only think there is a recipe (which I will check next) or some
> remnant of code that needs to be deleted (but my update removes
> directories when it can).
>
> I'd appreciate any suggestions
>
> tia
>
> Simon
>
> Links:
> ------
> [1] https://kiwiwiki.nz/Extensions/UrlGet
> [2] https://www.pmwiki.org/wiki/Cookbook/UrlGet
> _______________________________________________
> pmwiki-devel mailing list
> pmwiki-devel at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-devel
More information about the pmwiki-devel
mailing list