Download the PHP package lucamauri/paragraphlinks without Composer
On this page you can find all versions of the php package lucamauri/paragraphlinks. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lucamauri/paragraphlinks
More information about lucamauri/paragraphlinks
Files in lucamauri/paragraphlinks
Package paragraphlinks
Short Description MediaWiki extension that adds hover link icons to paragraphs, enabling one-click paragraph link copying
License
Homepage https://github.com/lucamauri/ParagraphLinks
Informations about the package paragraphlinks
ParagraphLinks MediaWiki Extension
ParagraphLinks is a MediaWiki extension 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
- 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-labelsupport 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
- MediaWiki 1.35.0 or higher
- PHP 7.4 or higher
- JavaScript enabled in the browser
Installation
Manual installation
-
Clone the repository into your
extensions/directory: - Enable the extension in
LocalSettings.php:
Composer installation
-
Add the package to your
composer.local.json: -
Run Composer:
- Enable the extension in
LocalSettings.php:
Note: No database update is required. Do not run
maintenance/update.phpfor this extension.
Configuration
Add any of the following to your LocalSettings.php after the wfLoadExtension call:
How It Works
- On each page view, the PHP hook
BeforePageDisplaychecks whether the extension is enabled and whether the current namespace is in$wgParagraphLinksNamespaces. - If both conditions are met, the
ext.paragraphlinksResourceLoader module is enqueued. - The JavaScript module attaches a 🔗 icon to every
h2–h6element inside#mw-content-text. - Clicking the icon copies
window.location.href— with the heading'sidas the fragment — to the clipboard using the browser's native Clipboard API. - A MediaWiki notification confirms success or reports an error.
File Structure
Development
Running Tests
Development Setup
- Clone into your MediaWiki
extensions/directory and enable the extension. -
Enable detailed error reporting in
LocalSettings.php: - Disable caching to see changes immediately:
Contributing
- Fork the repository on GitHub.
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes and add or update tests.
- Verify all tests pass.
- Open a pull request against
main.
Please follow MediaWiki coding conventions and add PHPDoc comments to all public methods.
Troubleshooting
Icons not appearing
- Confirm the extension is enabled and
$wgParagraphLinksEnabledistrue. - 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
- 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
| Feature | Modern browsers | Older browsers |
|---|---|---|
| Clipboard copy | Native Clipboard API | document.execCommand fallback |
| Icon display | Full CSS support | Graceful degradation |
License
This extension is licensed under the GPL-2.0-or-later license.