From c60332dcf12d919acb45492fc544f1df06cb1a0b Mon Sep 17 00:00:00 2001 From: Maurice Date: Mon, 13 Apr 2026 20:39:29 +0200 Subject: [PATCH] fix(journey): normalize headings and fix setext hr in story text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Render h1/h2/h3 as plain paragraphs — journal stories are plain text, not structured documents - Preprocess text to insert blank line before --- and === so they become horizontal rules instead of setext headings --- client/src/components/Journey/JournalBody.tsx | 11 ++++++----- client/src/pages/JourneyDetailPage.tsx | 10 +++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/client/src/components/Journey/JournalBody.tsx b/client/src/components/Journey/JournalBody.tsx index b043c199..2caa84c3 100644 --- a/client/src/components/Journey/JournalBody.tsx +++ b/client/src/components/Journey/JournalBody.tsx @@ -1,5 +1,6 @@ import ReactMarkdown from 'react-markdown' import remarkGfm from 'remark-gfm' +import remarkBreaks from 'remark-breaks' interface Props { text: string @@ -15,11 +16,11 @@ export default function JournalBody({ text, dark }: Props) { color: 'inherit', }}>

{children}

, - h2: ({ children }) =>

{children}

, - h3: ({ children }) =>

{children}

, + h1: ({ children }) =>

{children}

, + h2: ({ children }) =>

{children}

, + h3: ({ children }) =>

{children}

, p: ({ children }) =>

{children}

, blockquote: ({ children }) => (
- {text} + {text.replace(/^(.+)\n([-=]{3,})$/gm, '$1\n\n$2')} ) diff --git a/client/src/pages/JourneyDetailPage.tsx b/client/src/pages/JourneyDetailPage.tsx index 73710b8a..eee2e222 100644 --- a/client/src/pages/JourneyDetailPage.tsx +++ b/client/src/pages/JourneyDetailPage.tsx @@ -1004,7 +1004,7 @@ function VerdictSection({ pros, cons }: { pros: string[]; cons: string[] }) { >
- Pros & Cons + {t('journey.editor.prosCons')} {pros.length > 0 && ( -
+
- {t('journey.verdict.lovedIt')} + {t('journey.verdict.lovedIt')} {pros.length}
@@ -1061,12 +1061,12 @@ function VerdictSection({ pros, cons }: { pros: string[]; cons: string[] }) {
)} {cons.length > 0 && ( -
+
- {t('journey.verdict.couldBeBetter')} + {t('journey.verdict.couldBeBetter')} {cons.length}