Link Class: A Plugin for Pelican
This Pelican plugin lets you to set the class attribute of <a> elements (generated in Markdown by [ext](link)), depending on whether the link is external (i.e., starts with http:// or https://) or internal to the Pelican-generated site.
Currently, this plugin only works with Markdown. It has been tested with version 3.0+ of the Python-Markdown module and may not work with earlier versions.
Installation
This plugin is available as a package at PyPI and can be installed via:
python -m pip install pelican-linkclass
As long as there is no PLUGINS setting in the Pelican settings file, the newly installed plugin should be detected and enabled automatically. Otherwise, you must add linkclass to your existing PLUGINS list. For more information, please refer to the How to Use Plugins documentation.
Configuration
To avoid clashing with classes already defined in user CSS style sheets, it is possible to specify the names of the classes that will be used. This can be done in the Pelican settings file by defining the LINKCLASS variable as a list of tuples, such as in this example:
'LINKCLASS' = (('EXTERNAL_CLASS', 'name-of-the-class-for-external-links'),
('INTERNAL_CLASS', 'name-of-the-class-for-internal-links'))
The default values for EXTERNAL_CLASS and INTERNAL_CLASS are, respectively, 'external' and 'internal'.
Styling Hyperlinks
One possible use of this plugin is for styling. Suppose that we have the following Markdown content in your article:
This is an [internal](internal) link and this is an
[external](http://external.com) link.
Using the default configuration variable values, a possible CSS setting could be:
a.external:before {
content: url('../images/external-link.png');
margin-right: 0.2em;
}
(The external-link.png file is also distributed with this plugin. To use it, copy it to the appropriate location in your website's source tree, for instance in the theme/static/images/ directory.)
The result will then look like this:
Note that this plugin also works with reference-style links, as in the following example:
This is an [internal][internal] link and this is an
[external][external] link.
[internal]: internal
[external]: http://external.com
Contributing
Contributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation, adding missing features, and fixing bugs. You can also help out by reviewing and commenting on existing issues.
To start contributing to this plugin, review the Contributing to Pelican documentation, beginning with the Contributing Code section.
Acknowledgments
Many thanks to Yuliya Bagriy for setting up the package for PyPI, to Lucas Cimon for fixing the issues with pytest, and to Justin Mayer for helping with migration of this plugin under the Pelican Plugins organization.
Author
Copyright © 2015, 2017, 2019, 2021-2023, 2025 Rafael Laboissière (rafael@laboissiere.net)
License
This project is released under the terms of the GNU Affero Public License, version 3 or later.
Release files for pelican-linkclass 2.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pelican_linkclass-2.1.6.tar.gz | 22.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pelican_linkclass-2.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 42.5 kB
Release files / pelican_linkclass-2.1.6.tar.gz
| Download URL | pelican_linkclass-2.1.6.tar.gz |
|---|---|
| Size | 22.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d3217a3698371d1748282c06ed1d6daf8885916cb1d15d80e3445d1ddfcb9bf7
|
|
BLAKE2b-256 checksum How to use checksums |
3dc9073e18281a17c2832ed42bb252da4fa1d648bcd765b1b7f42f4202db92e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2025.
Transparency logRelease files / pelican_linkclass-2.1.6-py3-none-any.whl
| Download URL | pelican_linkclass-2.1.6-py3-none-any.whl |
|---|---|
| Size | 20.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db862353b5d86b9962cae7514a297e59829449eaa36c45f4a9d17d448a5a74e3
|
|
BLAKE2b-256 checksum How to use checksums |
a067ed96928179e02de45a915d87d677783291fdec81e914be37cb70a795d885
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2025.
Transparency log