Table of Contents

AutoLink 4 Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" yes
  • 2023-04-04 "Jack Jackrum" yes
  • 2022-07-31 "Igor" yes
  • 2020-07-29 "Hogfather" yes

plugin Automatically link text in your wiki to pages

Last updated on
2024-02-10
Provides
Syntax
Repository
Source

Similar to autolink2, autolink3, structautolink

Tagged with links

This plugin automatically links text on your page to other pages of your wiki. There are already two other plugins that do this. What makes this one different?

More information: Choosing an autolink plugin.

Installation

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

Examples / Usage

This plugin is configured with a list of links in the DokuWiki admin interface. Each line of the configuration consist of three fields separated by commas:

Simple examples
Things, mywiki:thing

This links the word “Things” to mywiki:thing, everywhere on your wiki. It only links it when capitalized.

Things, mywiki:thing#heading

This links to the section of the mywiki:thing page with the section header “heading.”

Limiting replacement to a namespace
Things, mywiki:thing, mywiki

The word “Things” will only be replaced inside the “mywiki” namespace.

Tooltips
Things, mywiki:thing, , tt

The link will include a tooltip, which is drawn from the title and abstract of mywiki:thing. This feature requires autotooltip.

Links to specific sections will base the tooltip on the page, not the section. This is due to a limitation of DokuWiki and autotooltip (the tooltip comes from the abstract, and sections do not have abstracts).

Search inside of words
Things, mywiki:thing, , inword
Combining flags
Things, mywiki:thing, , once|tt

The link will include a tooltip, and only the first occurrence of this match will be linked.

Regular expressions
[Tt]hings?, mywiki:thing

This links the words “Thing,” “thing,” “Things” and “things” to mywiki:thing. Some of the more useful regular expression tools include:

Not supported:

Proper ordering
Incredible Things, mywiki:thing
Things, mywiki:thing

Replacements are made in the order in which they occur in the configuration. So if you have a short replacement which is contained within a longer one, list the longer one first.

Non-English language support

Due to limited non-Latin support in DokuWiki, this plugin cannot work with certain characters in regular expressions. To fix it, you will have to edit some core DokuWiki code. Open /inc/Parsing/Lexer/ParallelRegex.php, and change the getPerlMatchingFlags function to:

protected function getPerlMatchingFlags()
{
  return ($this->case ? "umsS" : "umsSi");
}

Development

Performance

I tested with 500 regular expression matches, with no noticeable impact on performance. If you scale to several thousand, I recommend limiting the number of regular expression links.

Nerd speak

The asymptotic complexity of this plugin is O(r*u + s), where r is the total number of configured links with regular expression characters, s is the number of configured links without regular expression characters, and u is the number of unique matched text strings on the page. This means that performance is only minimally impacted by non-regex entries, and becomes worse the more regex entries you have, and the more times those entries appear on the page.

Change Log

ToDo/Wish List

Discussion

[APPLAUSE] This implementation for auto-linking is handy to use. I may not be a heavy user since I haven't come up so many strings to be auto-linked to relative pages, but this plugin indeed suits my need in a most elegant way. — milchflasche 2020-10-26 02:56

howto: eg. #number, http://www.example.com/number - rick.