parse markdown in type descriptions
This commit is contained in:
parent
b2d43ad425
commit
09e8d76bca
3 changed files with 15 additions and 3 deletions
|
|
@ -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>
|
||||||
|
|
|
||||||
|
|
@ -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: await processMarkdown(version.name, type.description),
|
||||||
|
...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>
|
<span class="root-nav-desc" set:html={type.description2}>/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -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 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue