fix(rss): drop layout whitespace from feed and entry titles - #2428
Merged
afourney merged 4 commits intoSep 9, 2026
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Internal newlines remain unhandled, and channel descriptions are altered contrary to the stated scope.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes malformed Markdown headings caused by pretty-printed RSS and Atom metadata.
Changes:
- Normalizes title and date metadata.
- Omits missing Atom headings.
- Adds RSS/Atom regression tests.
File summaries
| File | Description |
|---|---|
_rss_converter.py |
Adds metadata normalization and heading guards. |
test_rss_titles.py |
Tests pretty-printed and absent titles. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
A pretty-printed feed loses its heading structure. Every title is emitted with the indentation
of the element it was written in, which ends the Markdown heading before the text starts:
The
#and##are bare, the titles become indented body text, andresult.titlecomes backas
'\n Example feed\n '.Why
_parse_rss_typeand_parse_atom_typeinterpolate the raw element text straight into theheading:
_get_data_by_tag_namereturns exactly what the XML holds, and for a value on its own linethat is
"\n Example feed\n ". XML has no notion of "the text minus the layout", so thecaller has to drop it -- and every one of these four call sites is a single-line construct
where a newline breaks the syntax.
The same shape was fixed for the Wikipedia converter in #1990 ("Treat whitespace-only titles
as if they were absent"); the feed converter still has it.
Fix
Read heading and metadata values through a small helper that strips the layout whitespace and
reports a whitespace-only value as absent, and guard the Atom feed heading the way the RSS one
already is.
That guard is not cosmetic:
_parse_atom_typebuilds its heading unconditionally, so a feedwhose title is missing renders the literal
# Nonetoday, and stripping would newly produceit for a whitespace-only title:
Item bodies are untouched.
description,summaryandcontentstill go through_get_data_by_tag_nameand_get_atom_contentexactly as before -- their whitespace iscontent, and
_get_atom_contentalready has its own dedent rule for Atom plain text.Tests
New file
packages/markitdown/tests/test_rss_titles.py:# Example feed,## A story about thingsand aone-line
Published on:, asserted line by line<subtitle>and<updated>result.title is Noneand emits no headingNoneagainst the full string
Against unmodified
main:With the fix:
How I tested
Windows 11, Python 3.12, editable install of
packages/markitdown[all].Those 18 are unchanged by this PR:
maingives18 failed, 426 passed, 4 skippedon thismachine before any edit, and the 5 added tests account for the difference. They are the CLI
stdout-encoding, Windows file-URI and speech-transcription tests that need a UTF-8 console, a
case-sensitive path and network/ffmpeg.
black --checkclean on both files.