[pmwiki-devel] Update Re: Using "!#anchor heading" markup

John Rankin john.rankin at affinity.co.nz
Fri May 29 19:45:56 PDT 2026


Before I upload a revised pagetoc.php file to the Cookbook, I'd like to 
check a couple of things.

First thanks to Simon and "nitram" for their patience and help working 
through the issues with me, most of which were related to the "visible 
anchor" markup that pagetoc provides.

1. [[##visibleAnchor]] now uses TrackAnchors function to detect 
duplicate ids. If it finds one, it displays � instead of § (the 
characters are user-configurable). This revealed a conflict with 
SectionEdit's use of MarkupToUnstyled, which I have fixed.

2. For consistency, the recipe now tests $SeenAnchor for [[#anchor]] and 
!!#anchor to display a � for a duplicate, before giving control back to 
pmwiki to process the markup. Telling a writer when ##anchors are 
duplicates but not #anchors felt wrong (by Philosophy 1).

3. !!##anchor heading produces a visible anchor, again for consistency.

4. (:toc anchors=visible:) makes all anchors in the toc headings visible 
(overriding any !![[#anchor]] markup); a new option (:toc 
anchors=!visible:) hides all anchors (overriding any 
!![[##anchor]] markup), except for any duplicate ids; (:toc:) processes 
anchors as written.

5. Is there a case for making duplicate anchor ids visible as part of 
the pmwiki core?

6. Should I be separating out visible and duplicate anchor markup 
processing into its own separate recipe? Should such a recipe be an 
optional part of the pmwiki core?

Thanks for any thoughts or advice.

jr

PS Simon, I'll update your site once nitram has confirmed that all is well.

On 10/04/2026 3:30 pm, Simon wrote:
> thank you so much.
> I will follow this up with the recipe's author, who probably has seen 
> this.
>
> regards
>
> Simon
>
> On Thu, 9 Apr 2026 at 18:27, Petko Yotov <5ko at 5ko.fr> wrote:
>
>     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
>
>
> _______________________________________________
> pmwiki-devel mailing list
> pmwiki-devel at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-devel/attachments/20260530/43aa56c9/attachment.html>


More information about the pmwiki-devel mailing list