PHPackages                             lucamauri/paragraphlinks - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. lucamauri/paragraphlinks

ActiveMediawiki-extension[Utility &amp; Helpers](/categories/utility)

lucamauri/paragraphlinks
========================

MediaWiki extension that adds hover link icons to paragraphs, enabling one-click paragraph link copying

v1.0.2(2mo ago)13PHPPHP &gt;=7.4

Since Oct 9Pushed 1mo agoCompare

[ Source](https://github.com/lucamauri/ParagraphLinks)[ Packagist](https://packagist.org/packages/lucamauri/paragraphlinks)[ Docs](https://github.com/lucamauri/ParagraphLinks)[ RSS](/packages/lucamauri-paragraphlinks/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (6)Versions (7)Used By (0)

ParagraphLinks MediaWiki Extension
==================================

[](#paragraphlinks-mediawiki-extension)

**ParagraphLinks** is a [MediaWiki extension](https://www.mediawiki.org/wiki/Extension:ParagraphLinks) that adds a hover-activated copy-link icon (🔗) to every section heading in wiki page content. Clicking the icon copies the full URL — including the heading's anchor fragment — to the clipboard, letting users share deep links to specific sections without inspecting the page source.

Features
--------

[](#features)

- **Hover link icons**: Shows a 🔗 icon when hovering over section headings (`h2`–`h6`)
- **One-click copy**: Copies the full URL with anchor fragment to the clipboard
- **User notification**: Displays a success or error message after the copy attempt
- **Accessible**: Full `aria-label` support for screen readers; keyboard-navigable
- **Mobile friendly**: Adapts to touch devices where hover is unavailable
- **Configurable**: Can be enabled or disabled globally and per namespace
- **No database changes**: Pure client-side implementation; no schema modifications required

Requirements
------------

[](#requirements)

- MediaWiki 1.35.0 or higher
- PHP 7.4 or higher
- JavaScript enabled in the browser

Installation
------------

[](#installation)

**Manual installation**

1. Clone the repository into your `extensions/` directory: ```
    cd /path/to/mediawiki/extensions/
    git clone https://github.com/lucamauri/ParagraphLinks.git ParagraphLinks
    ```
2. Enable the extension in `LocalSettings.php`: ```
    wfLoadExtension( 'ParagraphLinks' );
    ```

**Composer installation**

1. Add the package to your `composer.local.json`: ```
    {
        "require": {
            "lucamauri/paragraphlinks": "~1.0"
        }
    }
    ```
2. Run Composer: ```
    composer update --no-dev
    ```
3. Enable the extension in `LocalSettings.php`: ```
    wfLoadExtension( 'ParagraphLinks' );
    ```

> **Note:** No database update is required. Do not run `maintenance/update.php` for this extension.

Configuration
-------------

[](#configuration)

Add any of the following to your `LocalSettings.php` after the `wfLoadExtension` call:

```
// Enable or disable the extension globally (default: true)
$wgParagraphLinksEnabled = true;

// Namespaces where heading links are active
// Default: [0, 4, 10, 12, 14] (Main, Project, Template, Help, Category)
$wgParagraphLinksNamespaces = [
    NS_MAIN,      // 0
    NS_PROJECT,   // 4
    NS_TEMPLATE,  // 10
    NS_HELP,      // 12
    NS_CATEGORY   // 14
];
```

How It Works
------------

[](#how-it-works)

1. On each page view, the PHP hook `BeforePageDisplay` checks whether the extension is enabled and whether the current namespace is in `$wgParagraphLinksNamespaces`.
2. If both conditions are met, the `ext.paragraphlinks` ResourceLoader module is enqueued.
3. The JavaScript module attaches a 🔗 icon to every `h2`–`h6` element inside `#mw-content-text`.
4. Clicking the icon copies `window.location.href` — with the heading's `id` as the fragment — to the clipboard using the browser's native Clipboard API.
5. A MediaWiki notification confirms success or reports an error.

File Structure
--------------

[](#file-structure)

```
ParagraphLinks/
├── extension.json                        # Extension manifest
├── composer.json                         # Composer metadata
├── includes/
│   └── ParagraphLinksHooks.php           # PHP hook handler
├── resources/
│   ├── ext.paragraphlinks.js             # Client-side logic
│   └── ext.paragraphlinks.css           # Heading icon styles
├── i18n/
│   ├── en.json                           # English messages
│   ├── it.json                           # Italian messages
│   └── qqq.json                          # Message documentation for translators
├── tests/
│   └── phpunit/
│       └── ParagraphLinksHooksTest.php   # PHPUnit tests
├── CHANGELOG.md
├── CONTRIBUTING.md
├── README.md
└── LICENSE

```

Development
-----------

[](#development)

### Running Tests

[](#running-tests)

```
# Run PHPUnit tests
php tests/phpunit/phpunit.php extensions/ParagraphLinks/tests/phpunit/

# Run with HTML coverage report
php tests/phpunit/phpunit.php --coverage-html coverage extensions/ParagraphLinks/tests/phpunit/
```

### Development Setup

[](#development-setup)

1. Clone into your MediaWiki `extensions/` directory and enable the extension.
2. Enable detailed error reporting in `LocalSettings.php`: ```
    $wgShowExceptionDetails = true;
    $wgDevelopmentWarnings = true;
    $wgShowDBErrorBacktrace = true;
    ```
3. Disable caching to see changes immediately: ```
    $wgMainCacheType = CACHE_NONE;
    $wgCacheDirectory = false;
    ```

Contributing
------------

[](#contributing)

1. Fork the repository on GitHub.
2. Create a feature branch: `git checkout -b feature/your-feature`
3. Make your changes and add or update tests.
4. Verify all tests pass.
5. Open a pull request against `main`.

Please follow [MediaWiki coding conventions](https://www.mediawiki.org/wiki/Manual:Coding_conventions) and add PHPDoc comments to all public methods.

Troubleshooting
---------------

[](#troubleshooting)

**Icons not appearing**

- Confirm the extension is enabled and `$wgParagraphLinksEnabled` is `true`.
- Check that the current page's namespace is listed in `$wgParagraphLinksNamespaces`.
- Verify JavaScript is enabled in your browser and there are no console errors.

**Copy to clipboard not working**

- The browser Clipboard API requires the page to be served over HTTPS.
- Check the browser console for permission errors.

Security Considerations
-----------------------

[](#security-considerations)

- All processing happens client-side; no user input is sent to the server.
- No database modifications are made.
- The extension uses the browser's native Clipboard API when available.

Browser Support
---------------

[](#browser-support)

FeatureModern browsersOlder browsersClipboard copyNative Clipboard API`document.execCommand` fallbackIcon displayFull CSS supportGraceful degradationLicense
-------

[](#license)

This extension is licensed under the [GPL-2.0-or-later](LICENSE) license.

Links
-----

[](#links)

- [Extension homepage on MediaWiki.org](https://www.mediawiki.org/wiki/Extension:ParagraphLinks)
- [Source code on GitHub](https://github.com/lucamauri/ParagraphLinks)
- [Issue tracker](https://github.com/lucamauri/ParagraphLinks/issues)
- [MediaWiki coding conventions](https://www.mediawiki.org/wiki/Manual:Coding_conventions)

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance89

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~197 days

Total

2

Last Release

70d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dd8777d6a2cb6716bb24cef15643edf8f463a9ff9de1c3c7efeda0f1111cf342?d=identicon)[lucamauri](/maintainers/lucamauri)

---

Top Contributors

[![lucamauri](https://avatars.githubusercontent.com/u/433582?v=4)](https://github.com/lucamauri "lucamauri (26 commits)")

---

Tags

anchorsextensionmediawikimediawikiextensionlinksparagraphs

### Embed Badge

![Health badge](/badges/lucamauri-paragraphlinks/health.svg)

```
[![Health](https://phpackages.com/badges/lucamauri-paragraphlinks/health.svg)](https://phpackages.com/packages/lucamauri-paragraphlinks)
```

###  Alternatives

[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.5k10](/packages/helsingborg-stad-municipio)[mediawiki/maps

Adds various mapping features to MediaWiki

84152.3k3](/packages/mediawiki-maps)[starcitizentools/citizen-skin

A beautiful, usable, responsive MediaWiki skin with in-depth extension support. Originally developed for the Star Citizen Wiki.

3376.6k](/packages/starcitizentools-citizen-skin)[professional-wiki/network

MediaWiki extension for adding interactive network visualizations to your wiki pages

3213.7k](/packages/professional-wiki-network)[mediawiki/semantic-glossary

A terminology markup extension with a Semantic MediaWiki back-end

1452.6k](/packages/mediawiki-semantic-glossary)[starcitizentools/tabber-neue

Allows to create tabs within a page. Forked from Extension:Tabber

235.4k](/packages/starcitizentools-tabber-neue)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
