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, 2026 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.1

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.1
File Size Uploaded
pelican_linkclass-2.2.1.tar.gz 24.0 kB Details

Built distribution (wheel)

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

Total release size: 44.6 kB

Release files / pelican_linkclass-2.2.1.tar.gz

Download URL pelican_linkclass-2.2.1.tar.gz
Size 24.0 kB
Tags Source
SHA-256 checksum
How to use checksums
50ebce22355552ee10178fd3b98441b405bd7097eed42e1f10f703b40655d0ba
BLAKE2b-256 checksum
How to use checksums
536dce76010ede905e04ede56e104a87ad2210cfcd53b289f0834cf1969a08a7
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.1-py3-none-any.whl

Download URL pelican_linkclass-2.2.1-py3-none-any.whl
Size 20.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bcf7ea470870bf1ba0ca4a6f966819a2e2b75f634284e633877838cb0503c700
BLAKE2b-256 checksum
How to use checksums
78352323c5f0bd3f8edd4d75b6410f376d72c268ecfcc6dfafdfe4314c1ecd7a
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

This release

2.2.1 This release

2 release files

2.2.0

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