From c635cb9d0640413fa074f7f0e95fcaa2292b8c72 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Thu, 8 Jan 2026 20:30:51 -0800 Subject: [PATCH] Add debug code for writing rendered article HTML to disk. --- iOS/Article/WebViewController.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/iOS/Article/WebViewController.swift b/iOS/Article/WebViewController.swift index 9f819c666..cbca90d03 100644 --- a/iOS/Article/WebViewController.swift +++ b/iOS/Article/WebViewController.swift @@ -607,6 +607,14 @@ private extension WebViewController { var html = try! MacroProcessor.renderedText(withTemplate: ArticleRenderer.page.html, substitutions: substitutions) html = ArticleRenderingSpecialCases.filterHTMLIfNeeded(baseURL: rendering.baseURL, html: html) + + // Uncomment when you want to debug HTML and CSS for an article. + // If you’re running in the simulator, this will write the file to a location on your Mac. +// let debugFolderURL = AppConfig.dataSubfolder(named: "debug") +// let fileURL = debugFolderURL.appendingPathComponent("article.html") +// try? html.write(to: fileURL, atomically: true, encoding: .utf8) +// print("article.html written to \(fileURL.path)") + webView.loadHTMLString(html, baseURL: ArticleRenderer.page.baseURL) }