Automatically remove table of contents divs and toc-backref anchor links
from article summaries when displayed outside full article context
(e.g., on homepage, in RSS feeds).
ReStructuredText automatically generates anchor links in section headings
when a table of contents directive is present. These anchors work perfectly
on full article pages, but become broken links when article summaries appear
on homepage or in feeds - the anchor targets don't exist in that context.
This change adds a strip_toc_elements_from_html() function in pelican/utils.py
that uses regex to remove:
- TOC div blocks (<div class="contents">...</div>) containing broken navigation
- toc-backref anchor links from headings while preserving heading text
Both removals are necessary since TOC anchor targets don't exist in summary context.
The function is called automatically in Content.get_summary() so all
summaries are cleaned without requiring configuration or template changes.
Includes comprehensive unit tests covering various TOC formats, edge cases,
and case-insensitive matching.
In the documentation, both `SOCIAL` and `LINKS` are described as a list
of tuples, but all examples show them as tuples of tuples. It makes the
most sense for them to be lists, so the examples should match the docs
going forward.
Similarly, `LOCALE` is described as a list, but the examples show it as
a tuple. Likewise, the examples should be lists, in line with the
description.
Sometimes we intentionally pin specific package versions -- such as for
Pygments, Jinja2, and Markdown -- and thus automated Dependabot PRs for
those packages are spurious and unwanted.
* Fix anchor links for settings by moving default value text down.
* Fix typos in default values.
---------
Co-authored-by: Justin Mayer <entroP@gmail.com>
The default `IGNORE_FILES` value of `'.*'` was being compiled to a regular expression and then passed into `watchfiles.DefaultFilter` to filter out files when auto-reload is enabled.
This commit compares the patterns from `IGNORE_FILES` directly with the filename to match the usage of `fnmatch` elsewhere in the codebase. The new filtering class will continue working as expected for custom `IGNORE_FILES` settings.
This change makes it easier to create new themes by inheriting from the
simple theme. It allows customization of the whole body (while still
making use of the theme’s head), or individual parts of the body like
header, menu, or footer.