From 565fdb921179c02e5764b444af3430173c89a954 Mon Sep 17 00:00:00 2001 From: SkateSpots Date: Sun, 27 Sep 2026 20:34:31 +0700 Subject: [PATCH] fix(newsletter): render _underscore italics_ in issue bodies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit issueToMarkdown wraps each issue's vibe in _underscores_, but the in-app markdown renderer only understood *asterisk* emphasis — so every published archive issue showed LITERAL underscores around its intro line (both in our reader and here). Added the underscore form to the tokenizer. Verified on the live issue-5 naddr: the vibe now renders as with no literal underscores. --- src/components/NewsletterIssueView.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/components/NewsletterIssueView.tsx b/src/components/NewsletterIssueView.tsx index a1556bf..7c6e071 100644 --- a/src/components/NewsletterIssueView.tsx +++ b/src/components/NewsletterIssueView.tsx @@ -29,8 +29,11 @@ function renderMarkdown(md: string) { const renderInline = (text: string): React.ReactNode[] => { const nodes: React.ReactNode[] = []; - // Tokenise **bold**, *italic*, and [label](url) / bare http(s) links. - const regex = /(\*\*([^*]+)\*\*)|(\*([^*]+)\*)|(\[([^\]]+)\]\((https?:\/\/[^\s)]+)\))|(https?:\/\/[^\s]+)/g; + // Tokenise **bold**, *italic*, _italic_ (underscore form — issueToMarkdown + // wraps the vibe in underscores, which used to render as LITERAL underscores + // in this reader), [label](url) and bare http(s) links. + const regex = + /(\*\*([^*]+)\*\*)|(\*([^*]+)\*)|(_([^_]+)_)|(\[([^\]]+)\]\((https?:\/\/[^\s)]+)\))|(https?:\/\/[^\s]+)/g; let last = 0; let m: RegExpExecArray | null; let i = 0; @@ -41,15 +44,17 @@ function renderMarkdown(md: string) { } else if (m[3]) { nodes.push({m[4]}); } else if (m[5]) { + nodes.push({m[6]}); + } else if (m[7]) { nodes.push( - - {m[6]} + + {m[8]} , ); - } else if (m[8]) { + } else if (m[10]) { nodes.push( - - {m[8]} + + {m[10]} , ); }