plugin:anchor
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:anchor [2018-11-27 15:36] – zioth | plugin:anchor [2024-02-11 03:39] (current) – zioth | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
---- plugin ---- | ---- plugin ---- | ||
- | description: | + | description: |
author | author | ||
email : elifenton@this_is_not_a_real_email.fake | email : elifenton@this_is_not_a_real_email.fake | ||
type : syntax | type : syntax | ||
- | lastupdate : 2013-08-16 | + | lastupdate : 2024-02-10 |
- | compatible : 2010-11-07, 2011-05-25, | + | compatible : 2010-11-07, 2011-05-25, |
depends | depends | ||
conflicts | conflicts | ||
- | similar | + | similar |
- | tags : anchor, links, sample, bookmark | + | tags : anchor, bookmark, links |
- | downloadurl: | + | downloadurl: |
- | bugtracker : | + | bugtracker : https:// |
- | sourcerepo : | + | sourcerepo : https:// |
donationurl: | donationurl: | ||
- | |||
screenshot_img: | screenshot_img: | ||
---- | ---- | ||
- | Normally, | + | DokuWiki allows |
- | This plugin is also a useful sample, if you' | + | This plugin is extremely simple, so it's a good place to start if you' |
===== Installation ===== | ===== Installation ===== | ||
- | |||
- | This plugin is so simple, and I'm so lazy, that I'm just going to include the source code. The following text should be in the file '' | ||
Search and install the plugin using the [[plugin: | Search and install the plugin using the [[plugin: | ||
- | ==== syntax.php | + | ===== Examples/ |
- | <code php lib/ | + | This syntax creates an anchor. |
- | <?php | + | |
- | if(!defined(' | + | |
- | if(!defined(' | + | |
- | require_once(DOKU_PLUGIN.' | + | |
- | + | ||
- | class syntax_plugin_anchor extends DokuWiki_Syntax_Plugin | + | |
- | { | + | |
- | function getType() {return ' | + | |
- | function getPType() {return ' | + | |
- | function getSort() {return 167;} | + | |
- | function getInfo() { | + | <code> |
- | return array( | + | {{anchor:anchor_name:text}} |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ); | + | |
- | } | + | |
- | + | ||
- | function connectTo($mode){ | + | |
- | $this-> | + | |
- | } | + | |
- | + | ||
- | function handle($match, | + | |
- | return explode(' | + | |
- | } | + | |
- | + | ||
- | function render($mode, | + | |
- | $renderer-> | + | |
- | } | + | |
- | } | + | |
</ | </ | ||
+ | **anchor_name** is an arbitrary name of your choosing. It must begin with a letter, and must be lowercase. | ||
- | ===== Examples/ | + | **text**, if provided, is a block of text that the anchor will wrap in HTML. It' |
- | + | ||
- | Here' | + | |
< | < | ||
- | {{anchor: | + | {{anchor: |
</ | </ | ||
- | The anchor_name part is the name of the anchor | + | To link to an anchor |
- | To link to an anchor | + | Use standard DokuWiki syntax to link to the new anchor: |
< | < | ||
Line 95: | Line 61: | ||
==== Changelog ==== | ==== Changelog ==== | ||
- | * 2017-06-20 | + | * 2017-06-20 |
- | * 2013-05-23 | + | * 2013-05-23 |
===== Discussion ===== | ===== Discussion ===== | ||
+ | ==== Gratuitous newline ==== | ||
+ | |||
+ | The plugin inserts an unwanted newline after the anchor tag. But I want to create a glossary page with anchored entries of the form:\\ | ||
+ | **term** -- definition | ||
+ | |||
+ | It looks like the [[: | ||
==== Case sensitivity is not compatible with DW ==== | ==== Case sensitivity is not compatible with DW ==== | ||
While using anchor I found that you have to type the anchor_name in all lowercase letters to be compatible with the DW internal link mechanics, which converts the letters of a link to lowercase. | While using anchor I found that you have to type the anchor_name in all lowercase letters to be compatible with the DW internal link mechanics, which converts the letters of a link to lowercase. | ||
To enable copy& | To enable copy& | ||
- | |||
- | ==== Avoiding that Extension Managers erroneously thinks there is an update for this plugin ==== | ||
- | If you install the plugin from the source code given above, the Extension Manager of Dokuwiki (I'm using release 2014-05-05 " | ||
- | |||
- | You can fix this by installing the following file in the '' | ||
- | |||
- | <file txt plugin.info.txt> | ||
- | base anchor | ||
- | author Eli Fenton | ||
- | date 2013-05-23 | ||
- | name Anchor Plugin | ||
- | url http:// | ||
- | </ | ||
==== Jumps to top of the page ==== | ==== Jumps to top of the page ==== | ||
Line 121: | Line 80: | ||
If I use this internal link, DW jumps to the top of the page.\\ | If I use this internal link, DW jumps to the top of the page.\\ | ||
Isn't it possible to jump to the part of the page, where the anchor is defined?< | Isn't it possible to jump to the part of the page, where the anchor is defined?< | ||
+ | |||
+ | Answer: It's possible that your DokuWiki template includes code that automatically scrolls to the top of the page after page load. You can confirm this by creating a link to a Doku section header and seeing if it behaves the same way. | ||
==== / | ==== / | ||
Line 136: | Line 97: | ||
//ViForEver 20140207// | //ViForEver 20140207// | ||
+ | ==== Needs the colon even with no text ==== | ||
+ | Note that even if you don't provide the optional text for the anchor you still need the colon following the anchor name, otherwise the plugin will error. | ||
+ | UPDATE: This has been fixed (2023-08-14) | ||
- | Hello, | + | Very handy little plugin! |
- | in my private wiki __it does not work__. | + | // |
- | How i have to create an anchor and an anchor-goal? | + | |
- | Please give me an example! | + | |
===== Old Discussion ===== | ===== Old Discussion ===== |
plugin/anchor.txt · Last modified: 2024-02-11 03:39 by zioth