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.1(7mo ago)13GPL-3.0-or-laterPHPPHP &gt;=7.4

Since Oct 9Pushed 6mo 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 1mo ago

READMEChangelog (1)Dependencies (3)Versions (4)Used By (0)

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

[](#paragraphlinks-mediawiki-extension)

**ParagraphLinks** is a [MediaWiki extension](https://www.mediawiki.org/wiki/Extension:ParagraphLinks) that adds hover link icons to paragraphs, allowing users to easily copy direct links to specific content within wiki pages without needing to inspect the page source or manually add anchors.

Features
--------

[](#features)

- **Hover Link Icons**: Shows a link icon (🔗) when hovering over paragraphs
- **Automatic Anchor Generation**: Creates meaningful anchor IDs based on paragraph content
- **One-Click Copy**: Click the link icon to copy the full URL with anchor to clipboard
- **Mobile Friendly**: Adapts to touch devices where hover isn't available
- **Accessible**: Full keyboard navigation and screen reader support
- **Configurable**: Enable/disable per namespace and global settings
- **No Database Changes**: Pure client-side implementation with no schema modifications

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

[](#installation)

You can install ParagraphLinks in two ways:

**Manual Installation**

1. Clone 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' );
    ```
3. Update your wiki database schema (if prompted): ```
    php maintenance/update.php
    ```

**Composer Installation (Local without Packagist)**

1. in your `composer.local.json` file create or add the following to `require` section: ```
    "require": {
       "lucamauri/paragraphlinks": "~1.0",
    }
    ```

    and run ```
    composer update --no-dev
    ```
2. Load the extension in `LocalSettings.php`: ```
    wfLoadExtension( 'ParagraphLinks' );
    ```
3. Run schema updates if needed: ```
    php maintenance/update.php
    ```

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

[](#configuration)

The extension provides several configuration options:

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

// Namespaces where paragraph links are enabled
// Default: [0, 4, 10, 12, 14] (Main, Project, Template, Help, Category)
$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
];
```

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

[](#how-it-works)

1. **Automatic Detection**: The extension scans all paragraphs in the main content area
2. **Anchor Generation**: Creates unique anchor IDs based on the first few words of each paragraph
3. **Visual Feedback**: Shows a link icon on hover (always visible on mobile)
4. **Clipboard Integration**: Uses modern Clipboard API with fallback for older browsers
5. **User Notification**: Shows success/error messages when copying links

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

[](#browser-support)

- **Modern Browsers**: Full support with Clipboard API
- **Older Browsers**: Fallback using `document.execCommand`
- **Mobile Devices**: Touch-optimized interface
- **Accessibility**: Screen reader and keyboard navigation support

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

[](#file-structure)

```
ParagraphLinks/
├── extension.json                        # Extension configuration
├── includes/
│   └── ParagraphLinksHooks.php           # Server-side hooks
├── resources/
│   ├── ext.paragraphlinks.js             # Client-side JavaScript
│   └── ext.paragraphlinks.css            # Styles
├── i18n/
│   ├── en.json                           # English messages
│   └── qqq.json                          # Message documentation
├── tests/
│   └── phpunit/
│       └── ParagraphLinksHooksTest.php   # Unit tests
├── README.md
└── LICENSE

```

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

[](#development)

### Requirements

[](#requirements)

- MediaWiki 1.35.0 or higher
- PHP 7.4 or higher
- Modern browser with JavaScript enabled

### Running Tests

[](#running-tests)

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

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

### Development Setup

[](#development-setup)

1. Clone the repository into your MediaWiki `extensions/` directory
2. Enable developer mode in MediaWiki: ```
    $wgShowExceptionDetails = true;
    $wgDevelopmentWarnings = true;
    $wgShowDBErrorBacktrace = true;
    ```
3. Disable caching during development: ```
    $wgMainCacheType = CACHE_NONE;
    $wgCacheDirectory = false;
    ```

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

[](#contributing)

1. Fork the repository
2. Create a feature branch: `git checkout -b feature/your-feature`
3. Make your changes and add tests
4. Ensure all tests pass
5. Submit a pull request

### Code Standards

[](#code-standards)

- Follow [MediaWiki coding conventions](https://www.mediawiki.org/wiki/Manual:Coding_conventions)
- Use tabs for indentation in PHP, spaces in JavaScript/CSS
- Add PHPDoc comments for all public methods
- Write unit tests for new functionality
- Ensure accessibility compliance

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

[](#security-considerations)

- The extension only operates on the client-side
- No user input is processed server-side
- Generated anchor IDs are sanitized
- No database modifications are made
- Uses secure clipboard API when available

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

[](#troubleshooting)

**Link icons not appearing:**

- Check that the extension is enabled in configuration
- Verify the current page's namespace is in `$wgParagraphLinksNamespaces`
- Ensure JavaScript is enabled in your browser

**Copy to clipboard not working:**

- Modern browsers require HTTPS for clipboard access
- Check browser console for JavaScript errors
- Verify clipboard permissions are granted

**Performance issues:**

- The extension only processes paragraphs with substantial content (&gt;10 characters)
- Client-side processing is minimal and cached
- No server-side performance impact

License
-------

[](#license)

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

Links
-----

[](#links)

- [MediaWiki Extension Documentation](https://www.mediawiki.org/wiki/Manual:Extensions)
- [Issue Tracker](https://github.com/lucamauri/ParagraphLinks/issues)
- [Source Code](https://github.com/lucamauri/ParagraphLinks)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance65

Regular maintenance activity

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

217d 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 (18 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

[professional-wiki/network

MediaWiki extension for adding interactive network visualizations to your wiki pages

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

A terminology markup extension with a Semantic MediaWiki back-end

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

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

243.6k](/packages/starcitizentools-tabber-neue)[mediawiki/semantic-cite

A Semantic MediaWiki extension to manage citation resources.

2310.2k1](/packages/mediawiki-semantic-cite)[mediawiki/babel

Users can easily indicate their language proficiency on their user page

116.3k](/packages/mediawiki-babel)

PHPackages © 2026

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