[pmwiki-devel] New ##idName issue Re: Using "!#anchor heading" markup

Petko Yotov 5ko at 5ko.fr
Wed Jun 10 23:33:18 PDT 2026


I don't have this problem with the pre-release, did you update both 
pmwiki.php and stdmarkup.php? Do you use custom markup rules overriding 
the core anchors markups? Do you override the core (:include:) markup?

In stdmarkup.php there is a new MarkupAnchors() function and the Markup 
rule changed for '[[#'.

A new markup rule was added as '^!#', as we discussed, it simply 
rewrites !!#anchor into !![[#anchor]] (also with 2 hashes).

This rewrite also happens in pmwiki.php inside TextSection() when a 
section is included. In this case, since the replacement happened before 
the section is processed by the markup engine, the '^!#' markup engine 
does not see !!#... in the included text, it sees !![[#...

If you place your echo's in MarkupAnchors() you'll see every anchor in 
included pages is only seen once.

Petko


On 11/06/2026 00:06, John Rankin wrote:
> There seems to be an issue with visible anchors + duplicate anchors +
> (:include ...:) and I can't see what to do in pagetoc to fix it.
> 
> It appears that the markup rules are evaluated twice, once in the
> include code and once in the final page rendering code. Using echo, we
> can see that the markup rule for visible anchors is being called twice
> (id names from an included page are echo'd twice; id names on the page
> itself are echo'd once). So the TrackAnchors function is called twice
> for each included  anchor and the second time it thinks it has found a
> duplicate anchor name.
> 
> This is the same problem we encountered with Edit Section, and fixed
> by updating the $MarkupToUnstyledIgnorePattern (in the
> MarkupToUnstyled cookbook recipe) to ignore [[##idname]] markup.
> 
> Is there a similar thing I can do for (:include:)? Is there a way to
> insert what MarkupToUnstyled does with the
> $MarkupToUnstyledIgnorePattern somehow, without breaking (:include:)?
> 
> Any advice would be greatly appreciated.
> 
> JR
> 



More information about the pmwiki-devel mailing list