Skip to main content

Link Class: A Plugin for Pelican

Build Status PyPI Version Downloads License

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'.

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:

figure

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

The short form of reference can also be used

This is an [internal] link and this is an [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.

Metadata

Release files for pelican-linkclass 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pelican-linkclass 2.2.0
File Size Uploaded
pelican_linkclass-2.2.0.tar.gz 24.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pelican-linkclass 2.2.0
File Interpreter ABI Platform
pelican_linkclass-2.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 44.6 kB

Release files / pelican_linkclass-2.2.0.tar.gz

Download URL pelican_linkclass-2.2.0.tar.gz
Size 24.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5dda8c7419c680258c69df35a6ab6a29b6a38f5dff4c861a327f925cd7d051b6
BLAKE2b-256 checksum
How to use checksums
fdd12160b20f1938092faa0cf797efd7152e54419dfec25e2abad376bf6bb39f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 14, 2026.

Transparency log

Release files / pelican_linkclass-2.2.0-py3-none-any.whl

Download URL pelican_linkclass-2.2.0-py3-none-any.whl
Size 20.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86e2ddc1df55f7973909ed15cda7d6dbf898641af4f3a1fb3900a671de7f63ef
BLAKE2b-256 checksum
How to use checksums
d55b0cc29f72dd7a43df9298538efabd67e470385ba5d5c2c12feff0b91b890b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 14, 2026.

Transparency log

Release history Release notifications | RSS feed

2.2.1

2 release files

This release

2.2.0 This release

2 release files

2.1.6

2 release files

2.1.5

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page