Skip to main content

Wagtail set

PyPI PyPI - Python Version PyPI - License PyPI - Downloads GitHub contributors

Wagtail 6 Wagtail 7

Wagtail anchors set.

Installation

Install using pip:

pip install wagtailset

Table of Contents

Wagtail Draftail Anchors

Adds the ability to add and edit anchors in the Draftail rich text editor, as well as automatically adding (slug-form) anchor ids to all headings with possibility to changes heading ids. Inspired by wagtail_draftail_anchors with some improvements like possibility to edit previous anchor id and headings' ids.

Instalation

Add 'wagtailset.draftail_anchors' to INSTALLED_APPS below wagtail.admin.

Add 'anchor-identifier' to the features of any rich text field where you have overridden the default feature list. Note: 'anchor-identifier' must be added before any heading('h1',...,'h6') feature and also before 'link' feature:

body = RichTextField(features=['anchor-identifier', 'h2', 'h3', 'bold', 'italic', 'link'])

Rendered representation of anchors

By default, anchor-identifier rich text entities will be rendered as HTML anchor elements, e.g.:

<a href="#my-element" id="my-element" data-id="my-element">My element</a>

Configuration

This package provides an alternative renderer that renders anchor-identifier entities as HTML span elements, e.g.:

<span id="my-element">My element</span>

The desired renderer can be specified using the DRAFTAIL_ANCHORS_RENDERER setting. To use the span renderer, configure your application as follows:

DRAFTAIL_ANCHORS_RENDERER = "wagtailset.draftail_anchors.rich_text.render_span"

It is possible to define your own renderer. It should be a callable that takes a dict of attributes, and returns a string containing the opening tag of the HTML element that represents the anchor target. The dict passed to the renderer, for an anchor with an identifier of "my-anchor", would look like the following:

{"data-id": "my-anchor", "href": "#my-anchor", "id": "my-anchor", "linktype": "my-anchor"}

If you define your own renderer, you should set the value of DRAFTAIL_ANCHORS_RENDERER to your custom renderer's import path.

See render_span and render_a in wagtailset.draftail_anchors.rich_text for examples.

Release files for wagtailset 1.1.8

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

Source distribution (sdist)

Source distribution for wagtailset 1.1.8
File Size Uploaded
wagtailset-1.1.8.tar.gz 17.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wagtailset 1.1.8
File Interpreter ABI Platform
wagtailset-1.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 36.7 kB

Release files / wagtailset-1.1.8.tar.gz

Download URL wagtailset-1.1.8.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9e2d3a86cfdd666df59fff296188c80215fb36173109e5c5ec327a345eff1541
BLAKE2b-256 checksum
How to use checksums
a3cd657b9f7ecc1b3ec1a1340d84c30745a2bc33aa8cd3f7f2e9cfec1ada8a35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / wagtailset-1.1.8-py3-none-any.whl

Download URL wagtailset-1.1.8-py3-none-any.whl
Size 19.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eeaa2ef9851ed0da556e6e833136c455415b996fb5634992267c088f12a21888
BLAKE2b-256 checksum
How to use checksums
6865c4371cd26d28c405f07bafcd420600048ee9d06dd29e036634fae23fd3b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

1.1.8 This release

2 release files

1.1.7

1 release file

1.1.6

1 release file

1.1.5

1 release file

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.0.1

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