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

Petko Yotov 5ko at 5ko.fr
Wed Jun 3 22:34:40 PDT 2026


On 04/06/2026 03:21, John Rankin wrote:
> 2. The original user of pagetoc wanted visible anchors to be
> unobtrusive, leading to the choice of § (set in $VisibleAnchor;
> nitram's site uses ♦). Perhaps the core ought to let administrators
> choose between displaying #anchor or # with #anchor as a tool tip.

Oh, I did not notice it just shows the symbol not the name, and the 
title attribute can show the name. It is much better this way.

I've replaced the core variable $VisibleAnchorPrefix with 
$VisibleAnchor, and only that will appear as link text.

> 1. For duplicate and not duplicate visible anchors, pagetoc reveals
> the anchor name through a title='#anchor' attribute. For duplicate
> visible anchors, pagetoc produces:
> 
>> "<span style='color: red;' title='#$id'>$DuplicateAnchor</span>"
> 
> $VisibleAnchorLinks=true adds <a href='#$id'> … </a> to the <span>.
> 
> I wonder of the core ought to produce a similar output, with the
> default value of $DuplicateAnchor as ''. Those who prefer a visible
> sign of a duplicate can set $DuplicateAnchor to a value of their
> choice.

Wouldn't it be better if the duplicate visible anchor linked to the 
existing anchor with the same identifier?

I changed it to render like this:

   <a title="#anchor Duplicate anchor" href="#anchor" 
class="visible-anchor">#</a>

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

> 3. You wrote, "For including text sections like include Page#anchor,
> the same (ie !!##?name) will be replaced (ie with !![[##?name]]) in
> the TextSection function before extracting the section." Does this
> mean nitram's use of the diff2 recipe will work with !!##anchor as
> well as !![[##anchor]], or will the recipe need modifying?

Yes, the Diff2 recipe should already work with the new !!##anchor 
headings.

It does already work with [[##anchor]].

If if doesn't, we'll update it.

Petko



More information about the pmwiki-devel mailing list