Skip to main content

A Sphinx extension that enables watermarks for HTML output.

Project description

GPL3 License Maintainability Project Status Package Version

sphinx-watermark is an extension for Sphinx that enables watermarks for HTML output.

Full documentation: https://jokneemo.github.io/sphinx-watermark

Why a Fork?

Forked from kallimachos/sphinxmark

This fork was created primarily to remove the dependency on bottle, and to support updates to Sphinx v7, Docutils, and Pillow.

Some themes perform differently in newer version of Docutils. The main issues faced are html elements are changed between div, section, article, etc.

Sphinxmark only supported div elements and the configuration changes I made to support it were too expansive for a simple pull request. See below for all of the enhancements added.

What’s Different?

  • Removed bottle dependency

  • HTML element selection

  • Static png name to support spaces in text

  • Collection of fonts

  • Customizable border

Installation

Install sphinx-watermark using pip:

$ pip3 install sphinx-watermark

Usage

  1. Add sphinx-watermark to the list of extensions in conf.py:

    extensions = ['sphinx_watermark']
  2. Enable and configure sphinx-watermark in conf.py. You only have to include the values you want to change from default.

    Below is the bare-minimum config for an Internal Draft watermark:

    watermark = {
       'enabled': False,
       'text': 'Internal\nDraft'
    }

    Below are the defaults for all options: (Notice that watermarks are disabled by default.)

    watermark = {
       'enabled': False,
       'selector': {
          'type': 'div',
          'class': 'body'
       },
       'position': {
          'margin': None,
          'repeat': True,
          'fixed': False
       },
       'image': None,
       'text': {
          'content': None,
          'align': 'center',
          'font': 'RubikDistressed',
          'color': (255, 0, 0),
          'opacity': 40,
          'size': 100,
          'rotation': 0,
          'width': 816,
          'spacing': 400,
          'border': {
                'outline': (255, 0, 0),
                'fill': None,
                'width': 10,
                'padding': 30,
                'radius': 20,
          }
       }
    }
  3. Build your docs as normal. The defined watermark should appear behind the text.

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

sphinx-watermark-2.0.0.tar.gz (987.5 kB view details)

Uploaded Source

Built Distribution

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

sphinx_watermark-2.0.0-py2.py3-none-any.whl (986.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sphinx-watermark-2.0.0.tar.gz.

File metadata

  • Download URL: sphinx-watermark-2.0.0.tar.gz
  • Upload date:
  • Size: 987.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.2

File hashes

Hashes for sphinx-watermark-2.0.0.tar.gz
Algorithm Hash digest
SHA256 e5bbe1e1d5b3afee6df86209131fe6966cbca254537c135130f186e25d29039d
MD5 32312fbc5125c8546fc1ecadcc7dcee0
BLAKE2b-256 3ec9ca281b73ac90caf6fae2e473cb4dec7ea5f19c74b0b851fb8c92550076d7

See more details on using hashes here.

File details

Details for the file sphinx_watermark-2.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_watermark-2.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5ad45f4d0383b6c4e4e5a94238fc628504666b5a95eb7095d686b65043dd0225
MD5 29e466a1ff6f66b37a3c6783f2a9f442
BLAKE2b-256 99605176fd1d4ed9ccbfe4cc741e93c396499d265a25e6d549c44e718c5d21cf

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