%META:TOPICINFO{author="TWikiContributor" date="1616656372" format="1.1" version="$Rev$"}%
---+!! Anchor Link Plugin
<!--
   Contributions to this plugin package are appreciated. Please update this page at
   http://twiki.org/cgi-bin/view/Plugins/AnchorLinkPlugin or provide feedback at
   http://twiki.org/cgi-bin/view/Plugins/AnchorLinkPluginDev.
   If you are a TWiki contributor please update the extension in the SVN repository.
-->
<sticky>
<div style="float:right; background-color:#EBEEF0; margin:0 0 20px 20px; padding: 0 10px 0 10px;">
%TOC{title="Page contents"}%
</div>
</sticky>
%SHORTDESCRIPTION%

---++ Description

This plugin shows an <img src="%ATTACHURLPATH%/anchor-bg.gif" alt="" width="16" height="16" /> anchor link icon when hovering over headings. When clicked, the browser URL bar will show the anchor link of the heading, useful to copy and paste a deep link. In addition, anchor links can be added using an =%<nop>ANCHORLINK{}%= variable.

Screenshot when hovering over a heading, and clicking on the anchor link:

<img src="%ATTACHURLPATH%/screenshot.png" alt="screenshot.png" width="764" height="200" />

---++ ANCHORLINK Variable

%INCLUDE{ "VarANCHORLINK" section="description"}%

---++ Settings

The ={Plugins}{AnchorLinkPlugin}{Headings}= configure setting defines the headers that show an anchor link on hover, default: =h2, h3, h4, h5, h6=

This configure setting can be redefined by a =ANCHORLINKHEADINGS= preferences setting at the site level ([[%USERSWEB%.TWikiPreferences]]), any web (WebPreferences), and topic level. Example:

   * Set ANCHORLINKHEADINGS = h1, h2, h3, h4

---++ Plugin Installation &amp; Configuration

You do not need to install anything on the browser to use this plugin. These instructions are for the administrator who installs the plugin on the TWiki server.

%TWISTY{
 mode="div"
 showlink="Show details %ICONURL{toggleopen}% "
 hidelink="Hide details %ICONURL{toggleclose}% "
}%

   * For an __automated installation__, run the [[%SCRIPTURL{configure}%][configure]] script and follow "Find More Extensions" in the in the __Extensions__ section.
      * See the [[http://twiki.org/cgi-bin/view/Plugins/BuildContribInstallationSupplement][installation supplement]] on TWiki.org for more information.

   * Or, follow these __manual installation__ steps:
      * Download the ZIP file from the Plugins home (see below).
      * Unzip ==%TOPIC%.zip== in your twiki installation directory. Content:
        | *File:* | *Description:* |
        | ==data/TWiki/AnchorLinkPlugin.txt== | Plugin topic |
        | ==lib/TWiki/Plugins/AnchorLinkPlugin.pm== | Plugin Perl module |
        | ==lib/TWiki/Plugins/AnchorLinkPlugin/Config.spec== | Configuration spec file |
        | ==pub/TWiki/AnchorLinkPlugin/anchor-bg.gif== | Anchor link icon |
      * Set the ownership of the extracted directories and files to the webserver user.

   * Plugin configuration:
      * Run the [[%SCRIPTURL{configure}%][configure]] script and enable the plugin in the __Plugins__ section.

   * Test if the configuration is successful:
      * Hover over a heading, and click on a %ATTACHURL%/anchor-bg.gif anchor link icon

%ENDTWISTY%

#PluginInfo
---++ Plugin Info

   * Set SHORTDESCRIPTION = Show anchor links on hover over headings, to copy anchor link address

%TABLE{ tablewidth="100%" columnwidths="170," }%
|  Author: | TWiki:Main.PeterThoeny, [[http://twiki.org/][TWiki.org]] |
|  Copyright: | &copy; 2020-2021 TWiki:Main.PeterThoeny %BR% &copy; 2020-2021 TWiki:TWiki.TWikiContributor |
|  License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
|  Version: | 2021-03-25 |
|  2021-03-25: | TWikibug:Item7927: Copyright update to 2021 |
%TWISTY{
 mode="div"
 showlink="Show Change History %ICONURL{toggleopen}%"
 hidelink="Hide Change History %ICONURL{toggleclose}% "
}%
%TABLE{ tablewidth="100%" columnwidths="170," }%
|  2020-12-20: | TWikibug:Item7919: Add ANCHORLINK variable; fix name clash with existing =twikiAnchorLink= class name in TWiki |
|  2020-10-24: | TWikibug:Item7919: Initial version of !AnchorLinkPlugin |
%ENDTWISTY%
%TABLE{ tablewidth="100%" columnwidths="170," }%
|  TWiki Dependency: | $TWiki::Plugins::VERSION 1.2 |
|  CPAN Dependencies: | none |
|  Other Dependencies: | none |
|  Perl Version: | 5.008 |
|  [[TWiki:Plugins.Benchmark][Plugin Benchmark]]: | %SYSTEMWEB%.GoodStyle nn%, %SYSTEMWEB%.FormattedSearch nn%, %TOPIC% nn% |
|  Home: | http://TWiki.org/cgi-bin/view/Plugins/AnchorLinkPlugin |
|  Feedback: | http://TWiki.org/cgi-bin/view/Plugins/AnchorLinkPluginDev |
|  Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/AnchorLinkPluginAppraisal |

__Related Topics:__ VarANCHORLINK, LinkingAndNavigationVariables, UIAndVisualizationVariables, %SYSTEMWEB%.TWikiPlugins

%META:FILEATTACHMENT{name="screenshot.png" attachment="screenshot.png" attr="h" comment="Screenshot" date="1603575800" size="113300" user="TWikiContributor" version="1"}%
%META:FILEATTACHMENT{name="anchor-bg.gif" attachment="anchor-bg.gif" attr="h" comment="" date="1603576207" size="943" user="TWikiContributor" version="1"}%
