From 64a28acd64f9941aec58d57d20b278634be4888b Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Tue, 4 Aug 2026 19:38:58 -0400 Subject: [PATCH] Keep wrapped list items in their bullet instead of orphaning the continuation --- Plugin/unraid/include/docs.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Plugin/unraid/include/docs.php b/Plugin/unraid/include/docs.php index 3be6eb6..a85e633 100644 --- a/Plugin/unraid/include/docs.php +++ b/Plugin/unraid/include/docs.php @@ -134,6 +134,7 @@ function vv_docs_markdown(string $md, array $vars): string { $inCode = false; $para = []; $quote = []; + $li = []; $flushPara = function () use (&$para, &$out, $inline) { if (!$para) return; @@ -145,7 +146,15 @@ function vv_docs_markdown(string $md, array $vars): string { $out .= '
' . $inline(implode(' ', $quote)) . "
\n"; $quote = []; }; - $closeList = function () use (&$list, &$out) { + // A list item is buffered rather than emitted on sight, because markdown wraps: a bullet + // whose text runs onto the next line is one item, not an item followed by a paragraph. + $flushLi = function () use (&$li, &$out, $inline) { + if (!$li) return; + $out .= '
  • ' . $inline(implode(' ', $li)) . "
  • \n"; + $li = []; + }; + $closeList = function () use (&$list, &$out, &$flushLi) { + $flushLi(); if ($list) { $out .= "\n"; $list = null; } }; $closeTable = function () use (&$inTable, &$out) { @@ -211,16 +220,23 @@ function vv_docs_markdown(string $md, array $vars): string { if (preg_match('/^[-*]\s+(.*)$/', $t, $m)) { $flushPara(); if ($list !== 'ul') { $closeList(); $out .= "