Extension:ParagraphLinks
Appearance
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.1 (2025-10-04) |
| Compatibility policy | Snapshots releases along with MediaWiki. Master is not backward compatible. |
| MediaWiki | 1.35+ |
| PHP | 7.4+ |
| Composer | lucamauri/paragraphlinks |
| License | GNU General Public License 3.0 or later |
| Download | GitHub: Note: 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 behavior found in popular documentation platforms like GitHub and GitLab.
Features
[edit]- Hover-activated link icons on section headings (H2–H6)
- Automatic anchor detection using existing MediaWiki-generated heading IDs
- One-click clipboard copying with modern Clipboard API support
- Responsive design that adapts to different screen sizes
- 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
- Mobile-friendly with touch-optimized interface
Installation
[edit]The extension can be installed either manually or via Composer, the latter is recommended.
Composer installation
[edit]- From your MediaWiki root directory:
composer require lucamauri/paragraphlinks
- Add to
LocalSettings.php:wfLoadExtension( 'ParagraphLinks' );
- Run the update script if needed:
php run maintenance/update.php
Manual installation
[edit]- Download or clone the extension into your
extensions/directory:cd /path/to/mediawiki/extensions/ git clone https://github.com/lucamauri/paragraphlinks.git ParagraphLinks
- Add the following line to your
LocalSettings.php:wfLoadExtension( 'ParagraphLinks' );
- Run the update script (if prompted):
php run maintenance/update.php
Configuration
[edit]The extension provides some configuration options:
$wgParagraphLinksEnabled- Enable or disable the extension globally. Default:
true $wgParagraphLinksEnabled = true;
$wgParagraphLinksNamespaces- Array of namespace IDs where paragraph links are enabled. 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]- Navigate to any wiki page with section headings
- Hover over a section heading (H2 through H6)
- A link icon (🔗) will appear to the left of the heading text
- Click the icon to copy the full URL with anchor to your clipboard
- A notification will confirm successful copying or alert on failure
See also
[edit]- Help:Links - MediaWiki's built-in linking features
$wgFragmentMode- Configuration for URL fragments
