From b4c0048f68eafba48166334b5c18c7d99da2a1d3 Mon Sep 17 00:00:00 2001 From: rays Date: Sun, 18 Oct 2026 18:45:18 +0000 Subject: [PATCH] The HTML and Markdown choice drops the Markdown source view (#285) Rendered Markdown is the one wanted beside the publisher's HTML. A browser that had chosen the source view shows the HTML. Co-Authored-By: Claude Opus 5.5 --- tests/ui/app.spec.js | 5 ++--- web/CHANGELOG.md | 2 +- web/app.css | 1 - web/src/items.ts | 7 +++---- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/ui/app.spec.js b/tests/ui/app.spec.js index 217947c..207752f 100644 --- a/tests/ui/app.spec.js +++ b/tests/ui/app.spec.js @@ -537,10 +537,9 @@ test('an item sent as HTML and Markdown switches between them', async ({ page }) await expect(page.locator('#detail .dbody b')).toHaveText('HTML'); await view.selectOption('markdown'); await expect(page.locator('#detail .dbody strong')).toHaveText('Markdown'); - await view.selectOption('source'); - await expect(page.locator('#detail .dbody pre.mdsrc')).toHaveText('The **Markdown** copy.'); + await expect(view.locator('option')).toHaveText(['HTML', 'Markdown']); // Kept for the next item; set back so nothing after this sees it. - expect(await page.evaluate(() => localStorage.getItem('ipx.textview'))).toBe('source'); + expect(await page.evaluate(() => localStorage.getItem('ipx.textview'))).toBe('markdown'); await view.selectOption('html'); // An item with no Markdown has no choice to make. diff --git a/web/CHANGELOG.md b/web/CHANGELOG.md index 06e3d6a..42ac06f 100644 --- a/web/CHANGELOG.md +++ b/web/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- An item sent as both HTML and Markdown, as Scripting News's are, has a choice beside its buttons to show it as the publisher's HTML, as the Markdown, or as the Markdown source, kept from one item to the next (#285). +- An item sent as both HTML and Markdown, as Scripting News's are, has a choice beside its buttons to show it as the publisher's HTML or as the Markdown, kept from one item to the next (#285). - A show inside an OPML subscription has a Keep button, a plus, on its page, so it stays on your list as a show of its own if the OPML drops it or you unsubscribe from the OPML (#280). - Admin, Server: a setting to give everyone Signals on the server's TypeSafe key (#271). - Admin, Server: how many days back a new Signal reads (#276). diff --git a/web/app.css b/web/app.css index c462111..fcd132b 100644 --- a/web/app.css +++ b/web/app.css @@ -849,7 +849,6 @@ body.scan-this .fhead [data-a=scan] .i,body.scan-any .fhead [data-a=scanall] .i, the next line one at a time (#146). */ .dacts{display:flex;gap:inherit;flex:none} .dmeta .tview{width:auto;padding:3px 6px;font-size:12px} -.dbody .mdsrc{white-space:pre-wrap;font:13px/1.6 ui-monospace,SFMono-Regular,Menlo,monospace} #detail .encbox{margin:0 0 10px} .dbody{font-size:14.5px;line-height:1.65;overflow-wrap:anywhere;color:var(--fg)} .dbody img{max-width:100%;height:auto;border-radius:6px} diff --git a/web/src/items.ts b/web/src/items.ts index 7cb5774..a393630 100644 --- a/web/src/items.ts +++ b/web/src/items.ts @@ -422,13 +422,12 @@ function detailHtml(e: Entry){ } /// How an item whose feed sends Markdown beside its HTML is shown, kept from one item to the -/// next (#285): the publisher's HTML, the Markdown made HTML, or the Markdown as written. -const TEXT_VIEWS=[['html','HTML'],['markdown','Markdown'],['source','Markdown source']]; +/// next (#285): the publisher's HTML, or the Markdown made HTML. +const TEXT_VIEWS=[['html','HTML'],['markdown','Markdown']]; let textView=(()=>{ try{ return localStorage.getItem('ipx.textview'); }catch{ return null; } })()||'html'; function textOf(e: Entry){ - // Both cleaned server-side with ammonia, as the description is. + // Cleaned server-side with ammonia, as the description is. if(e.markdown&&textView==='markdown'&&e.markdown_html) return e.markdown_html; - if(e.markdown&&textView==='source') return `
${esc(e.markdown)}
`; return (e.description&&e.description.trim())||'No show notes.'; }