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

John Rankin john.rankin at affinity.co.nz
Wed Jun 10 15:06:51 PDT 2026


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

On 05/06/2026 3:05 am, Petko Yotov wrote:
> On 04/06/2026 11:57, John Rankin wrote:
>> On 04/06/2026 5:34 pm, Petko Yotov wrote:
>>> Instead of a separate global variable $DuplicateAnchor, duplicate 
>>> anchors are styled in pmwiki-core.css, and can be overridden in 
>>> pub/css/local.css:
>>>
>>>   a.visible-anchor:not([id]) {
>>>     background-color: var(--pmc-yellow2);
>>>   }
>>>
>>> See/test: https://pmwiki.org/t/VisibleAnchors
>>
>> That is quite subtle to my eyesight (the world gets yellower with age;
>> YMMV).
>
> I changed the background to brighter orange-red color. I wanted to 
> have a color that is available in the core but configurable, and this 
> one is in PmSyntax.
>
> At any rate, via custom CSS a webmaster can change the colors and add 
> some content before or after:
>
>   a.visible-anchor:not([id]):before {
>     content: attr(title);
>     /* or: content: "\FFFD"; */ /*�*/
>   }
>
> We can even remove the $VisibleAnchor variable and configure the 
> character in CSS.
>
>> A more flexible option could be to retain $VisibleAnchor and
>> $DuplicateAnchor, and SDV($DuplicateAnchor, $VisibleAnchor); in the
>> core. Those who wish to, can over-ride the default.
>
> If we can avoid adding more global variables when alternative 
> configuration exists, we should. It is very painful to remove features 
> people rely on.
>
> Petko



More information about the pmwiki-devel mailing list