Visible anchor

anchor.PNG
Description
Anchors for hyperlinking within posts, displaying as # (hash sign)

Can be used as:
  • [anchor=sample1]Anchored part[/anchor]
  • Anchored part [anchor=sample2][/anchor]
  • Anchored [anchor]part[/anchor]
All 3 forms rendered as same text: Anchored part #


Additional styling:
Prepend HTML replacement string with this code to make focused anchor more clearly distinguishable:

CODE: Select all

<style>a#{@anchor}:focus {background-color:yellow;text-decoration:none;padding:1px}/style>

P.S.
Originally inspired by this discussion: viewtopic.php?p=15320331#p15320331 (thx mrgoldy)
  • Author johnd0e
  • Last updated Fri Feb 21, 2020 2:35 am
  • Rating
    (0)
  • Categories Misc

Public performance attribution has been waived.

Demo

Tag content is used as anchor id [i](no spaces allowed)[/i]: [anchor]anchor1[/anchor].

Anchor id specified as attribute: [anchor=anchor2]anchor 2[/anchor].

Tag content may be empty: [anchor=anchor3][/anchor].

[code]Tag content is used as anchor id [i](no spaces allowed)[/i]: [anchor]anchor1[/anchor].

Anchor id specified as attribute: [anchor=anchor2]anchor 2[/anchor].

Tag content may be empty: [anchor=anchor3][/anchor].
[/code]

To link anchors use [noparse][url][/noparse] bbcode:

[url=#anchor1]Anchor 1[/url], [url=#anchor2]Anchor 2[/url], [url=#anchor3]Anchor 3[/url].

[code][url=#anchor1]Anchor 1[/url], [url=#anchor2]Anchor 2[/url], [url=#anchor3]Anchor 3[/url].
[/code]

Settings

BBCode Usage: Select all
[anchor={IDENTIFIER;useContent}]{TEXT;optional}[/anchor]

HTML Replacement: Select all
<xsl:if test="@anchor"><xsl:apply-templates/></xsl:if> <xsl:if test="@content!=''"></xsl:if><a class="postlink visible-anchor" id="{@anchor}" title="{@anchor}" href="#{@anchor}">#</a>

Help Line: Select all
[anchor]Name[/anchor], [anchor=Name][/anchor]
  • Revisions
    Version
    phpBB Version(s)
  • Visible anchor 1.0
    1.0
    3.3.x
    Validation time: Feb 21, 2020 2:35 am

    BBCode Usage: Select all
    [anchor={IDENTIFIER;useContent}]{TEXT;optional}[/anchor]

    HTML Replacement: Select all
    <xsl:if test="@anchor"><xsl:apply-templates/></xsl:if> <xsl:if test="@content!=''"></xsl:if><a class="postlink visible-anchor" id="{@anchor}" title="{@anchor}" href="#{@anchor}">#</a>

    Help Line: Select all
    [anchor]Name[/anchor], [anchor=Name][/anchor]