HTML man pages: show anchor elements for headings & options on hovering

This commit is contained in:
Moritz Bunkus 2024-02-03 12:50:46 +01:00
parent be8c9d127a
commit 9bcaf81ff8
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
2 changed files with 29 additions and 2 deletions

View File

@ -80,6 +80,7 @@
<xsl:number format="1. " value="position()"/>
<xsl:value-of select="title"/>
</a>
<a class="headerlink" href="#{$anchor}" title="Link to this heading">#</a>
</h1>
<xsl:apply-templates/>
@ -96,6 +97,7 @@
<xsl:number level="multiple" format="1. " count="refsynopsisdiv|refsect1|refsect2"/>
<xsl:value-of select="title"/>
</a>
<a class="headerlink" href="#{$anchor}" title="Link to this heading">#</a>
</h2>
<xsl:apply-templates/>
@ -140,7 +142,7 @@
<tr>
<td class="varlistoption">
<xsl:choose>
<xsl:when test="@id"><a name="{@id}"><xsl:apply-templates select="term"/></a></xsl:when>
<xsl:when test="@id"><a name="{@id}"><xsl:apply-templates select="term"/></a><a class="headerlink" href="#{@id}" title="Link to this option">#</a></xsl:when>
<xsl:otherwise><xsl:apply-templates select="term"/></xsl:otherwise>
</xsl:choose>
</td>

View File

@ -155,4 +155,29 @@ td p:first-child {
td p:last-child {
margin-bottom: 0;
}
}
a.headerlink {
visibility: hidden;
font-size: .8em;
margin-left: .2em;
opacity: .7;
padding: 0 4px;
text-decoration: none;
transition: all .2s ease-out;
user-select: none;
}
h1:hover > a.headerlink,
h2:hover > a.headerlink,
h3:hover > a.headerlink,
h4:hover > a.headerlink,
h5:hover > a.headerlink,
h6:hover > a.headerlink,
dt:hover > a.headerlink,
td:hover > a.headerlink,
caption:hover > a.headerlink,
p.caption:hover > a.headerlink,
div.code-block-caption:hover > a.headerlink {
visibility: visible;
}