A Pelican plugin for rule-based addition of classes to your content
Project description
pelican-decorate-content
A Pelican plugin for rule-based addition of classes to your content. This can be useful when you use a functional CSS toolset (e.g. Tachyons) to style your site and do not want to write custom CSS targeting your content.
Installation
Install from PyPi:
pip install pelican_decorate_content
Usage
In your pelicanconf.py
import the plugin and add it to PLUGINS
:
from pelican_decorate_content import decorate_content
# ...
PLUGINS = [decorate_content]
Configuration
Global settings
Global configuration happens in a DECORATE_CONTENT
setting, which is a dict that maps CSS selectors to a list of classes that will be added to each match:
DECORATE_CONTENT = {
'h1': ['f2', 'normal', 'lh-title', 'mt3', 'ma0', 'mb3'],
'h2': ['f25', 'normal', 'lh-title', 'mt4', 'ma0', 'mb3'],
'h3': ['f5', 'normal', 'mt5', 'ma0', 'mb3'],
'h4': ['f5', 'normal', 'mt4', 'ma0', 'mb1'],
'h5': ['f5', 'normal', 'mt2', 'ma0', 'mb1'],
'h6': ['f5', 'lh-solid', 'normal', 'ma0', 'light-silver'],
}
Overrides on article or page level
Overrides for these global defaults can be added in your article or page's front matter by defining a JSON string as decorate_content
:
decorate_content: '{"h1": ["f3", "bold"]}' # this overrides the entire key
License
Copyright 2020 Frederik Ring - Available under the MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pelican_decorate_content-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4233acdbdfb9b4ba988ce0b9ed7fc9bc54c2561fea408e7a3a6f777a5fe4a6bf |
|
MD5 | a6c87952f755d896b284d0d048e881d0 |
|
BLAKE2b-256 | 7ec36b6af44bcf3dd9638c4c9248f3177ac508c07dbc4502697898313f8e3551 |
Hashes for pelican_decorate_content-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b23a3ee340eb350414dcc7f6a53c509da87f3c2759253ddf6f4bbe344860cc35 |
|
MD5 | 84593b38627901c576e9ac29cd0ba513 |
|
BLAKE2b-256 | fd882746965b163e02ab8b1d74ce2d8524b359675f125e6220e29b956e67b16e |