Skip to main content

Adds anchor links and related backlinks to the Wagtail editor (Draftail). Useful for footnotes and more!

Project description

Comparison with other solutions

This package is similar to https://github.com/torchbox/wagtail-footnotes but in general:

  • our approach is more lightweight
  • our approach is similar to what users do in Microsoft Word
  • our approach is more flexible, you can use it to make a handcrafted table of contents, for example
  • our approach is not structured, so developers have no control over where the notes should be and what they should look like, since any inline selection of text can become a note anchor or reference
  • as a consequence, our approach relies more on editor consistency across a site

More technical details:

  • we save notes inside the same rich text field/block
  • we do not create an extra database model
  • we do not require an extra InlinePanel
  • you can copy anchors and their references directly from Office documents (only from LibreOffice, for now), the links are created automatically
  • future database migrations can be easier as the data is less spread
  • We are not limited to 1 set of footnotes per page, you can have many footnotes section if needed, one per rich text field/block

Install

  1. pip install wagtail-notes
  2. Add 'wagtail_notes', to INSTALLED_APPS, before 'wagtail.admin',
  3. Add 'wagtailfontawesomesvg', to INSTALLED_APPS if it is not already added. Its position does not matter.
  4. Add 'note-anchor' and 'note-reference' features to your Draftaileditor features. Example:
     WAGTAILADMIN_RICH_TEXT_EDITORS = {
         'default': {
             'WIDGET': 'flaubert.rich_text.TypographicDraftailRichTextArea',
             'OPTIONS': {
                 'features': [
                     'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'bold', 'italic',
                     'link', 'document-link', 'note-anchor', 'note-reference', 'image', 'embed',
                 ],
             },
         },
     }
    

Usage

2 new buttons will appear in the Draftail bar. To use them, you must select some text first. You also need to create a note before making a reference to this note.

Typically, for creating footnotes:

  1. Add a paragraph to your RichTextField/RichTextBlock.
  2. Add another paragraph at the end of the same rich text, starting with 1. and containing a comment about something in the paragraph written in step 1.
  3. Select just 1. and click on “Note anchor”, then give a unique name to that note. It can be a number too, but we recommend you to give a more meaningful name, as it makes it easier to change the order of notes later.
  4. Go back to the step 1 paragraph, and write [1] just after the place that the note will comment (no space). Select [1] and click on “Note reference”. Select the unique name of the note you wrote in step 3.
  5. The [1] part will be rendered as:
    <a id="slugified-unique-name-reference" href="#slugified-unique-name" data-note="reference">[1]</a>
    
    The 1. part will be rendered as:
    <a id="slugified-unique-name" href="#slugified-unique-name-reference" data-note="anchor">1.</a>
    

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

wagtail_notes-1.0.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

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

wagtail_notes-1.0.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file wagtail_notes-1.0.0.tar.gz.

File metadata

  • Download URL: wagtail_notes-1.0.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for wagtail_notes-1.0.0.tar.gz
Algorithm Hash digest
SHA256 163fc987174944625aa98282c48117ec68b8b966faa69eb0d83298d08019df8d
MD5 c7cd5955c67202553288fd3198cef775
BLAKE2b-256 c9ed6e101ea615d0eabf10706145a00e05491575b3d0318665e05b3fdc3430de

See more details on using hashes here.

File details

Details for the file wagtail_notes-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: wagtail_notes-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for wagtail_notes-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d21cddac99ce8129af4ad72a7a0f1d45177eb5693690fb705b199a33004e716b
MD5 c48d8c115a841e19af7d90ee4db77749
BLAKE2b-256 d0ead39b91c7720d411fb4fb635864b0a682a80e9f241f3dc9f02796b9da4948

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