From c0d38dc05ad4f03b0eee0008b9f26cc042297ab8 Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Thu, 30 Jul 2026 13:32:21 +0200 Subject: [PATCH] fix(content): drop the trailing rule from every rendered section Section bodies end with a `---` separating them from the next heading in the source. The player renders one section at a time, so that separator drew a rule directly above the navigation's own top border: two stacked lines at the bottom of every module. 116 of 132 sections were affected. Stripped at the splitter, so the rules stay where they are useful - reading the raw markdown. Only trailing rules go; a rule mid-section is real content. Signed-off-by: Anna Larch --- lib/content.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/content.ts b/lib/content.ts index f923b88..5d61876 100644 --- a/lib/content.ts +++ b/lib/content.ts @@ -89,11 +89,24 @@ export function splitIntoSections(markdown: string): Section[] { return seen === 0 ? base : `${base}-${seen + 1}` } + /* + * Section bodies in the source files end with a `---` separating them from the + * next heading. Once each section is rendered on its own that separator has + * nothing left to separate: it becomes a rule sitting directly above the + * player's own navigation border, so the module ends in two stacked lines. + * + * Stripping it here keeps the raw markdown readable as a document - the rules + * are useful when reading the file - without leaking into the rendered page. + * Only trailing rules go; a rule used mid-section is real content. + */ + const stripTrailingRule = (body: string): string => + body.replace(/(?:\n[ \t]*(?:-{3,}|\*{3,}|_{3,})[ \t]*)+$/, '').trimEnd() + const push = (heading: string) => { const { title, id } = parseHeading(heading) sections.push({ title, - content: currentLines.join('\n').trim(), + content: stripTrailingRule(currentLines.join('\n').trim()), index: sectionIndex++, id: uniqueId(id), })