Jump to content

Extension:ParagraphLinks

From mediawiki.org
MediaWiki extensions manual
ParagraphLinks
Release status: stable
Implementation User interface
Description Adds hover link icons to section headings for easy copying of direct links to specific sections within wiki pages
Author(s) Luca Mauri
Latest version 1.0.2 (2026-04-24)
Compatibility policy Snapshots releases along with MediaWiki. Master is not backward compatible.
MediaWiki 1.35+
PHP 7.4+
Composer lucamauri/paragraphlinks
  • $wgParagraphLinksEnabled - Enable/disable the extension globally (default: true)
  • $wgParagraphLinksNamespaces - Array of namespace IDs where the extension is active (default: [0, 4, 10, 12, 14])
Licence GNU General Public License 2.0 or later
Download
README.md

ParagraphLinks is a MediaWiki extension that adds a copy-link icon (🔗) to section headings, allowing users to quickly copy direct links to specific sections within wiki pages. The icon appears on hover next to each heading, similar to the behaviour found in popular documentation platforms like GitHub and GitLab.

Features

[edit]
  • Hover-activated link icons on section headings (H2–H6)
  • Anchor detection using existing MediaWiki-generated heading IDs
  • One-click clipboard copying with modern Clipboard API support
  • Accessibility support with proper ARIA labels and keyboard navigation
  • Configurable namespaces to control where the extension is active
  • No database modifications — purely client-side implementation

Installation

[edit]

The extension can be installed either manually or via Composer; the latter is recommended.

Composer installation

[edit]
  1. From your MediaWiki root directory, run:
    composer require lucamauri/paragraphlinks
    
  2. Add to LocalSettings.php:
    wfLoadExtension( 'ParagraphLinks' );
    

Manual installation

[edit]
  1. Clone the extension into your extensions/ directory:
    cd /path/to/mediawiki/extensions/
    git clone https://github.com/lucamauri/ParagraphLinks.git ParagraphLinks
    
  2. Add the following line to your LocalSettings.php:
    wfLoadExtension( 'ParagraphLinks' );
    
This extension makes no database changes. No need to run maintenance/update.php.

Configuration

[edit]
$wgParagraphLinksEnabled
Enable or disable the extension globally. Default: true
$wgParagraphLinksEnabled = true;
$wgParagraphLinksNamespaces
Array of namespace IDs where heading link icons are active. Default includes Main, Project, Template, Help, and Category namespaces.
$wgParagraphLinksNamespaces = [
    NS_MAIN,      // 0 - Main namespace
    NS_PROJECT,   // 4 - Project namespace
    NS_TEMPLATE,  // 10 - Template namespace
    NS_HELP,      // 12 - Help namespace
    NS_CATEGORY   // 14 - Category namespace
];

Usage

[edit]
  1. Navigate to any wiki page with section headings.
  2. Hover over a section heading (H2 through H6).
  3. A link icon (🔗) will appear to the left of the heading text.
  4. Click the icon to copy the full URL with anchor fragment to your clipboard.
  5. A notification will confirm successful copying or alert on failure.

See also

[edit]
[edit]