On systems such as Windows, JavaScript files can be incorrectly assigned
the "text/plain" MIME type in Python's mimetypes module. This overrides
this behavior when it occurs.
* Strip TOC elements from article summaries
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.
---------
Co-authored-by: Justin Mayer <entroP@gmail.com>
This fixes `invoke setup` failing in fresh virtual environments.
The top-level import of `livereload` caused tasks.py to fail before any
task could execute, since `livereload` is a development dependency only
installed by PDM as part of the setup task.
Folks tend to ignore the comments in issue templates and create new
issues, even when the issue template comments make it clear that we
would prefer that folks create discussions for topics outside of bug
reports, documentation issues, and feature requests.