Compare commits

..

No commits in common. "8c961c729bd423c8f3aac33f4f8ae2e2d1a14f37" and "c0e0266d4594d2635e162766cc276f20debc39d6" have entirely different histories.

9 changed files with 86 additions and 76 deletions

View file

@ -12,5 +12,5 @@ const { title } = Astro.props;
<Fragment set:html={collapsibleMarker}/> <Fragment set:html={collapsibleMarker}/>
{title} {title}
</div> </div>
<slot /> <slot>
</Accordion> </Accordion>

View file

@ -35,42 +35,47 @@ const remarkParseAtTypes: RemarkPlugin<[]> =
(rawNode as Md.Code).lang === "qml") (rawNode as Md.Code).lang === "qml")
) { ) {
const node = rawNode as Md.Literal; const node = rawNode as Md.Literal;
node.value = node.value.replace( node.value = node.value.replace(
/@@(?<path>([A-Z]\w*\.)*([A-Z]\w*))?((?<member>[a-z]\w*)((?<function>\(\))|(?<signal>\(s\)))?)?(?=[$.,;:)\s]|$)/g, /@@((?<module>([A-Z]\w*\.)*)(?<type>([A-Z]\w*))(\.(?!\s|$))?)?((?<member>[a-z]\w*)((?<function>\(\))|(?<signal>\(s\)))?)?(?=[$.,;:)\s]|$)/g,
(_full, ...args) => { (_full, ...args) => {
type Capture = { type Capture = {
path: string | undefined; module: string | undefined;
type: string | undefined;
member: string | undefined; member: string | undefined;
function: string | undefined; function: string | undefined;
signal: string | undefined; signal: string | undefined;
}; };
const groups = args.pop() as Capture; const groups = args.pop() as Capture;
const pathp = (groups.path ?? "").split('.').filter(Boolean);
let type = (pathp.length >= 1 ? pathp.pop() : "");
let module = pathp.join('_');
if (module) { if (groups.module) {
const isQs = module.startsWith("Quickshell"); groups.module = groups.module.substring(
module = `99M${isQs ? "QS" : "QT_qml"}_${module}`; 0,
} else module = ""; // WARNING: rehype parser can't currently handle intra-module links groups.module.length - 1
);
const isQs = groups.module.startsWith("Quickshell");
groups.module = `99M${isQs ? "QS" : "QT_qml"}_${groups.module.replace(".", "_")}`;
} else groups.module = ""; // WARNING: rehype parser can't currently handle intra-module links
type = type ? `99N${type}` : ""; groups.type = groups.type ? `99N${groups.type}` : "";
groups.member = groups.member groups.member = groups.member
? `99V${groups.member}` ? `99V${groups.member}`
: ""; : "";
const typep = groups.member const type = groups.member
? `99T${groups.function ? "func" : groups.signal ? "signal" : "prop"}` ? `99T${groups.function ? "func" : groups.signal ? "signal" : "prop"}`
: ""; : "";
return `TYPE${module}${type}${groups.member}${typep}99TYPE`; return `TYPE${groups.module}${groups.type}${groups.member}${type}99TYPE`;
} }
); );
} }
}); });
return root; return root;
}; };
const rehypeRewriteTypelinks: RehypePlugin<[]> = () => (root: Html.Root): Html.Root => { const rehypeRewriteTypelinks: RehypePlugin<[]> =
() =>
(root: Html.Root): Html.Root => {
visit( visit(
root as Unist.Parent, root as Unist.Parent,
"text", "text",
@ -83,7 +88,10 @@ const rehypeRewriteTypelinks: RehypePlugin<[]> = () => (root: Html.Root): Html.R
changed = true; changed = true;
const linkObject = getQMLTypeLinkObject(match); const linkObject = getQMLTypeLinkObject(match);
const link = getQMLTypeLink(currentVersion, linkObject); const link = getQMLTypeLink(
currentVersion,
linkObject
);
const icon = const icon =
linkObject.mtype && linkObject.mtype !== "func" linkObject.mtype && linkObject.mtype !== "func"
? getIconForLink(linkObject.mtype, false) ? getIconForLink(linkObject.mtype, false)
@ -104,11 +112,14 @@ const rehypeRewriteTypelinks: RehypePlugin<[]> = () => (root: Html.Root): Html.R
parent.children.splice(index, 1, ...fragment.children); parent.children.splice(index, 1, ...fragment.children);
return SKIP; return SKIP;
} }
});
return CONTINUE;
}
);
return root; return root;
}; };
const rehypeRewriteVersionedDoclinks: RehypePlugin<[]> = const rehypeRewriteVersionedDoclinks: RehypePlugin<[]> =
() => () =>
(root: Html.Root): Html.Root => { (root: Html.Root): Html.Root => {

View file

@ -2,7 +2,7 @@ import { defineCollection, z } from "astro:content";
import { glob } from "astro/loaders"; import { glob } from "astro/loaders";
const guide = defineCollection({ const guide = defineCollection({
loader: glob({ pattern: "**/*.{md,mdx}", base: "src/guide" }), loader: glob({ pattern: "**/*.md", base: "src/guide" }),
schema: z.object({ schema: z.object({
title: z.string(), title: z.string(),
index: z.number(), index: z.number(),

View file

@ -75,11 +75,11 @@ To start with, let's make a clock. To get the time, we'll use the `date` command
> [!note/Note] > [!note/Note]
> Quickshell can do more than just run processes. Read until the end for more information. > Quickshell can do more than just run processes. Read until the end for more information.
We can use a [Process](@docs/types/Quickshell.Io/Process) object to run commands We can use a [Process](@docs/types/quickshell.io/process) object to run commands
and a @@Quickshell.Io.StdioCollector to read their output. and a @@Quickshell.Io.StdioCollector to read their output.
We'll listen to the @@Quickshell.Io.StdioCollector.streamFinished(s) signal with We'll listen to the @@Quickshell.Io.StdioCollector.streamFinished(s) signal with
a [signal handler](@docs/guide/qml-language#signal-handlers) a [signal handler](@docs/guide/qml-language/#signal-handlers)
to update the text on the clock. to update the text on the clock.
> [!note/Note] > [!note/Note]

View file

@ -172,7 +172,7 @@ Name {
Every object can contain [properties](#properties), [functions](#functions), Every object can contain [properties](#properties), [functions](#functions),
and [signals](#signals). You can find out what properties are available for a type and [signals](#signals). You can find out what properties are available for a type
by looking it up in the [Type Reference](@docs/types). by looking it up in the [Type Reference](@docs/types/).
#### Properties #### Properties

View file

@ -2,7 +2,6 @@
title: "QML Language" title: "QML Language"
index: 10 index: 10
--- ---
import Collapsible from "@components/Collapsible.astro"; import Collapsible from "@components/Collapsible.astro";
Quickshell is configured using the Qt Modeling Language, or QML. Quickshell is configured using the Qt Modeling Language, or QML.
@ -188,7 +187,7 @@ Name {
Every object can contain [properties](#properties), [functions](#functions), Every object can contain [properties](#properties), [functions](#functions),
and [signals](#signals). You can find out what properties are available for a type and [signals](#signals). You can find out what properties are available for a type
by looking it up in the [Type Reference](@docs/types). by looking it up in the [Type Reference](@docs/types/).
#### Properties #### Properties

View file

@ -27,11 +27,11 @@ export async function getStaticPaths() {
} }
const { version, page } = Astro.props; const { version, page } = Astro.props;
const { headings, Content } = await render(page); const { headings } = await render(page);
// we can't use 'Content' because there isn't a way to pass in a version // we can't use 'Content' because there isn't a way to pass in a version
const html = await processMarkdown(version.name, page.body!); const html = await processMarkdown(version.name, page.body!);
--- ---
<GuideLayout title={page.data.title} description="" headings={headings}> <GuideLayout title={page.data.title} description="" headings={headings}>
<Content/> <Fragment set:html={html}/>
</GuideLayout> </GuideLayout>

View file

@ -3,8 +3,8 @@ pre.shiki {
} }
:where(p, li):has(> code) code { :where(p, li):has(> code) code {
padding-inline: var(--sm); padding-inline: var(--2xl);
border-radius: var(--radius-xs); border-radius: var(--2xl);
color: hsl(var(--blue) 100 69); color: hsl(var(--blue) 100 69);
background-color: hsla(var(--blue) 85 35 / 0.1); background-color: hsla(var(--blue) 85 35 / 0.1);
} }

View file

@ -9,7 +9,7 @@
margin-inline: 0.618rem; margin-inline: 0.618rem;
margin-top: 3.5rem; margin-top: 3.5rem;
display: flex; display: flex;
justify-content: safe center; justify-content: center;
flex-direction: row; flex-direction: row;
flex-grow: 1; flex-grow: 1;
transition: filter var(--theme-transition); transition: filter var(--theme-transition);