parse markdown in type descriptions

This commit is contained in:
outfoxxed 2026-04-02 03:31:49 -07:00
parent b2d43ad425
commit 1f1444eb65
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
3 changed files with 15 additions and 3 deletions

View file

@ -28,6 +28,10 @@ const superLink = type.super ? getQMLTypeLink(version.name, type.super) : null;
const details = type.details const details = type.details
? await processMarkdown(version.name, type.details) ? await processMarkdown(version.name, type.details)
: null; : null;
const description = type.description
? await processMarkdown(version.name, type.description)
: null;
--- ---
<DocsLayout title={`${module.name} - ${type.name}`} description={type.description ?? ""} type={type}> <DocsLayout title={`${module.name} - ${type.name}`} description={type.description ?? ""} type={type}>
<div class="docs"> <div class="docs">
@ -57,7 +61,7 @@ const details = type.details
<code class="type-module" data-pagefind-ignore>import {module.name}</code> <code class="type-module" data-pagefind-ignore>import {module.name}</code>
<section class="typedocs-data typedata"> <section class="typedocs-data typedata">
<subheading class="typedocs-subheading"> <subheading class="typedocs-subheading">
{details ? <span class="parsedMD" set:html={details}/> : (<span class="toparse">{type.description}</span>)} {details ? <span class="parsedMD" set:html={details}/> : <span class="parsedMD" set:html={description}/>}
</subheading> </subheading>
{ Object.keys(type.properties ?? {}).length != 0 && ( { Object.keys(type.properties ?? {}).length != 0 && (
<h2>Properties <a href={`/docs/${version.name}/guide/qml-language#properties`}>[?]</a></h2> <h2>Properties <a href={`/docs/${version.name}/guide/qml-language#properties`}>[?]</a></h2>

View file

@ -16,6 +16,11 @@ const { version, module } = Astro.props;
const details = module.details const details = module.details
? await processMarkdown(version.name, module.details) ? await processMarkdown(version.name, module.details)
: null; : null;
const types = await Promise.all(module.types.map(async type => ({
description2: type.description ? await processMarkdown(version.name, type.description) : null,
...type
})));
--- ---
<DocsLayout <DocsLayout
@ -28,13 +33,13 @@ const details = module.details
<section> <section>
<span>{module.description}</span> <span>{module.description}</span>
<div class="root-nav" data-pagefind-ignore> <div class="root-nav" data-pagefind-ignore>
{module.types.map(type => {types.map(type =>
( (
<div class="root-nav-entry"> <div class="root-nav-entry">
<a class="root-nav-link" href={`/docs/${version.name}/types/${module.name}/${type.name}`}> <a class="root-nav-link" href={`/docs/${version.name}/types/${module.name}/${type.name}`}>
{type.name} {type.name}
</a> </a>
<span class="root-nav-desc">{type.description}</span> {type.description2 && <span class="root-nav-desc" set:html={type.description2}/>}
</div> </div>
) )
)} )}

View file

@ -341,6 +341,9 @@ html.dark .typevariants {
& .root-nav-desc { & .root-nav-desc {
padding-left: 1rem; padding-left: 1rem;
border-left: 1px solid hsl(var(--blue) 10% 15% / 0.6); border-left: 1px solid hsl(var(--blue) 10% 15% / 0.6);
/* for processMarkdown in desc strs*/
& > p { margin: 0 }
} }
} }
} }