Repository navigation
fix(rss): treat Atom text content and summary as plain text - #2374
Adam Fourney (afourney) merged 6 commits into
Conversation
|
Ishaan Potle (@IshaanPotle) I think this is tackling the same issue as #2375. I've been working in this one. Can you confirm if it addresses your issue? |
There was a problem hiding this comment.
🟡 Changes recommended
Plain text remains active Markdown, and multiline normalization can discard meaningful indentation.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes Atom plain-text content handling while retaining HTML/XHTML conversion behavior.
Changes:
- Classifies Atom content types and skips binary payloads.
- Adds plain-text rendering and whitespace normalization.
- Adds regression tests across Atom content variants.
File summaries
| File | Description |
|---|---|
_rss_converter.py |
Implements Atom content classification and rendering. |
test_rss_converter.py |
Covers text, HTML, XML, binary, and whitespace cases. |
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.
| lines = text.splitlines() | ||
| if len(lines) > 1: | ||
| text = lines[0] + "\n" + textwrap.dedent("\n".join(lines[1:])) |
There was a problem hiding this comment.
Confirmed, reproduced with a two-line value that starts on the content element's own line. Dedenting the full text now, in d272b88. Added a test for it.
| if not is_markup: | ||
| # Plain text is returned verbatim: routing it through the HTML | ||
| # parser drops tag-shaped text such as ``<job_id>`` entirely. | ||
| return value |
|
Adam Fourney (@afourney) Yes — confirming #2374 addresses the same issue as my #2375. Lazizbek Ergashev (@lazerg) opened this one first (17:32 vs my 17:38), and I didn't see it when I checked for duplicates. Happy to close mine in favour of this. This PR is also the more thorough of the two on classification: the media-type handling ( One gap worth flagging before this merges, though — the Copilot reviewer raised the same point on #2375. Returning plain text verbatim fixes the Markdown source but not what a reader ends up seeing, because the text is still live Markdown/HTML. Checked out this branch and ran the issue's own example: (rendered with the On #2375 I ended up escaping the value instead — convert it as a text node so the converter applies its own Markdown escaping, then escape the markup characters markdownify leaves alone. That round-trips exactly: Verified that ordinary prose isn't over-escaped ( |
|
Re-tested at d272b88 — the Markdown metacharacter escaping works: The angle-bracket case from the issue title is still open though, since
Worth noting it makes the source noisier than the literal example in #2373 — that example wasn't escaped and would lose Nothing else from me — the classification work in this PR is better than what I had, and the dedent fix is a case I missed entirely. Happy to close #2375 whenever you'd like. |
d272b88 to
a98483c
Compare
|
Checked this against the current tip. The angle-bracket drop is real when you render the markdown to HTML: Your So there are two different, both defensible, targets: keep the markdown source byte-identical to the plain-text input (current behavior, matches the issue's stated expected output), or make the markdown safe to re-render as HTML (your fix, at the cost of a noisier source). That is a real product decision, not a bug in either of our patches. Adam Fourney (@afourney), your call on which one this repo wants. |
|
Lazizbek Ergashev (@lazerg) please have your agent stop responding, and stop adding commits to the PR. |
Atom
contentandsummarywithtype="text"(or notypeat all) are plain text, but the converter hands them to the HTML parser anyway. Anything tag-shaped in that text gets dropped and entity-like strings get decoded a second time, soRun <job_id> with <literal>.comes out asRun with <literal>._get_atom_contentnow escapes those two cases before the existing HTML path runs, which keeps the literal text intact whilehtmlandxhtmlcontent converts as before.Fixes #2373