fix(DocDialog): Render doc bodies as markdown
DocContent rendered the raw body in a whitespace-pre-wrap div, so
markdown syntax and fenced code blocks appeared literally. Parse
through the shared markdown pipeline and style with prose.
Wrap the content in an <article> so md-bg and md-border, which
resolve element.closest("article"), get a valid style target
instead of throwing.
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
|||||||
} from "solid-js";
|
} from "solid-js";
|
||||||
import { docEntries, type DocEntry } from "./doc-data";
|
import { docEntries, type DocEntry } from "./doc-data";
|
||||||
import { journalDocEntries, type JournalDocEntry } from "./journal-doc-data";
|
import { journalDocEntries, type JournalDocEntry } from "./journal-doc-data";
|
||||||
|
import { parseMarkdown } from "../markdown";
|
||||||
|
|
||||||
type DocSet = "directives" | "journal";
|
type DocSet = "directives" | "journal";
|
||||||
type AnyEntry = DocEntry | JournalDocEntry;
|
type AnyEntry = DocEntry | JournalDocEntry;
|
||||||
@@ -166,9 +167,10 @@ const DocContent: Component<{ entry: AnyEntry }> = (props) => {
|
|||||||
{e.icon} {e.title}
|
{e.icon} {e.title}
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<div class="text-sm leading-relaxed whitespace-pre-wrap text-gray-800">
|
<article
|
||||||
{e.body}
|
class="prose prose-sm max-w-none text-gray-800"
|
||||||
</div>
|
innerHTML={parseMarkdown(e.body)}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user