Share one Markdown writer between the article exporters and escape properly #62
Labels
No labels
area/architecture
area/build-ci
area/bytecode
area/code-quality
area/docs
area/extension
area/fingerprint
area/security
area/tests
Bug report
Feature request
review
sev/low
sev/medium
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
midas/midas-patches#62
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found in the codebase review (2026-10-11). The review fixed the actual bugs (entity decoding collapsed newlines, multi-paragraph blockquotes, empty quote authors); this is the remaining, larger cleanup.
Duplication:
VolkskrantArticleExporter.buildMarkdownandGelderlanderArticleExporter.buildMarkdownrepeat the header (title, intro, author and date, original link,---), image + caption + credits, quote and list rendering. A sharedmarkdown/MarkdownWriterkeeps both in step. (Same for the identical privateFilterclass andisDroppedinvolkskrant/ContentFiltersandgelderlander/GelderlanderContentFilters.)Escaping gaps (cosmetic, but breaks rendering for some articles):
HtmlToMarkdown: literal*,_,[,]and a leading#,-orN.aren't escaped; link text/URLs aren't escaped (a)or space breaks the link); relativehrefs stay relative.<b>foo </b>becomes**foo **, which CommonMark doesn't render as bold: move inner whitespace outside the markers.*caption*breaks on newlines or edge spaces);MarkdownVideo's*▶ title*caption isn't escaped. Volkskrant doesn't pass author/quote author throughconvert, Gelderlander does.Small extras:
GelderlanderArticleExportercaches up to 50 fullArticleDetailResponsetrees (10-20 is plenty); JVM tests forKubusModels.value,ContentFilters.filterArticleBlocksandMarkdownVideo(anHtmlToMarkdownTestexists now).Done when: one writer used by both exporters, unit tests cover escaping, and a device test copies a few articles (with lists, quotes, images, video) correctly in both apps.
Device test v1.9.0-dev.11 (Volkskrant 7.52.0, De Gelderlander 9.21.1), installed over the previous local build: both start without crashes or VerifyErrors. Copy as Markdown checked on a Gelderlander article with video + image and a Volkskrant analysis with five inline links, subheads and an image: headings, intro quote, video embed (thumbnail URL encoding intact), captions/credits and links render correctly; no over-escaping. Remaining byline issues predate #66 and are tracked separately: Kubus author missing (not in Source), Volkskrant uses the byline description (bio) instead of the author name, and both print the publication date as raw ISO UTC.