Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pelican_decorate_content-0.1.1.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pelican_decorate_content-0.1.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file pelican_decorate_content-0.1.1.tar.gz.

File metadata

  • Download URL: pelican_decorate_content-0.1.1.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.9

File hashes

Hashes for pelican_decorate_content-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b866ec3245e366c80db1c08ddd61de9e172929d0f8fd088ae9e13135abe56982
MD5 e4e4d7e459204ca52a7d8f7cd937d1a1
BLAKE2b-256 eec9df7a435bbd99ad2ee95b07985fa451e8aa85f3bc5f7db629a10c397086ad

See more details on using hashes here.

File details

Details for the file pelican_decorate_content-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pelican_decorate_content-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.9

File hashes

Hashes for pelican_decorate_content-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8aac9d10dfe57892b64d92f5e3032a6e6049af0123a3e14ade2e2d05d92d7c36
MD5 30642c5fe0e6a33bed74eb810f89ee81
BLAKE2b-256 bf9b06eb51f09a5135c1a3311555779c5cc7455c060238258ba5e6226f4b56ec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page