diff --git a/docs/src/components/Preview.svelte b/docs/src/components/Preview.svelte
index c412b82d..fda63086 100644
--- a/docs/src/components/Preview.svelte
+++ b/docs/src/components/Preview.svelte
@@ -87,6 +87,10 @@
color: #bb8eff;
}
+ .token.comment {
+ color: #bebebe;
+ }
+
.code-override {
border: 1px solid #262626;
}
diff --git a/docs/src/layouts/Recipe.svelte b/docs/src/layouts/Recipe.svelte
new file mode 100644
index 00000000..ce3ff566
--- /dev/null
+++ b/docs/src/layouts/Recipe.svelte
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+ {component}
+
+
+
+
+
+
+
+
+
+
Table of Contents
+
+
+
+
+
+
+
+
+
+
Table of Contents
+
+
+
+
diff --git a/docs/src/pages/_layout.svelte b/docs/src/pages/_layout.svelte
index fffe569e..37ae563e 100644
--- a/docs/src/pages/_layout.svelte
+++ b/docs/src/pages/_layout.svelte
@@ -26,6 +26,7 @@
$: components = $layout.children.filter(
(child) => child.title === "components"
)[0];
+ $: recipes = $layout.children.filter((child) => child.title === "recipes")[0];
$beforeUrlChange(() => {
if (isMobile) isSideNavOpen = false;
@@ -215,7 +216,10 @@
-
+
{#each components.children as child, i (child.path)}
{/each}
+
+ {#each recipes.children as child, i (child.path)}
+
+ {/each}
+
diff --git a/docs/src/pages/framed/Breadcrumbs/Breadcrumbs.svelte b/docs/src/pages/framed/Breadcrumbs/Breadcrumbs.svelte
new file mode 100644
index 00000000..cd77ead9
--- /dev/null
+++ b/docs/src/pages/framed/Breadcrumbs/Breadcrumbs.svelte
@@ -0,0 +1,32 @@
+
+
+
+
+
+ {#each items as item, i}
+
+ {item.text}
+
+ {/each}
+
+
+
diff --git a/docs/src/pages/framed/CopyableCodeSnippet/CopyableCodeSnippet.svelte b/docs/src/pages/framed/CopyableCodeSnippet/CopyableCodeSnippet.svelte
new file mode 100644
index 00000000..aa7f4492
--- /dev/null
+++ b/docs/src/pages/framed/CopyableCodeSnippet/CopyableCodeSnippet.svelte
@@ -0,0 +1,8 @@
+
+
+{code}
diff --git a/docs/src/pages/recipes/Breadcrumbs.svx b/docs/src/pages/recipes/Breadcrumbs.svx
new file mode 100644
index 00000000..d8f7afc0
--- /dev/null
+++ b/docs/src/pages/recipes/Breadcrumbs.svx
@@ -0,0 +1,11 @@
+---
+layout: recipe
+---
+
+
+
+## Breadcrumb trail
+
+
diff --git a/docs/src/pages/recipes/CopyableCodeSnippet.svx b/docs/src/pages/recipes/CopyableCodeSnippet.svx
new file mode 100644
index 00000000..96334ad5
--- /dev/null
+++ b/docs/src/pages/recipes/CopyableCodeSnippet.svx
@@ -0,0 +1,15 @@
+---
+layout: recipe
+---
+
+
+
+The [CodeSnippet](/components/CodeSnippet) and [CopyButton](/components/CopyButton) do not include logic to copy the supplied `code` text.
+
+## clipboard-copy
+
+This example uses [clipboard-copy](https://www.npmjs.com/package/clipboard-copy), a lightweight module designed for the web.
+
+
diff --git a/docs/src/pages/recipes/TileAspectRatio.svx b/docs/src/pages/recipes/TileAspectRatio.svx
new file mode 100644
index 00000000..61602f18
--- /dev/null
+++ b/docs/src/pages/recipes/TileAspectRatio.svx
@@ -0,0 +1,16 @@
+---
+layout: recipe
+---
+
+
+
+## Tile (16x9 ratio)
+
+
+
+ Content
+
+
diff --git a/docs/svelte.config.js b/docs/svelte.config.js
index 151b1167..0e981f5f 100644
--- a/docs/svelte.config.js
+++ b/docs/svelte.config.js
@@ -141,13 +141,55 @@ module.exports = {
}),
mdsvex({
remarkPlugins: [plugin, slug, carbonify],
- layout: path.join(__dirname, "src/layouts/ComponentLayout.svelte"),
+ layout: {
+ recipe: path.join(__dirname, "src/layouts/Recipe.svelte"),
+ _: path.join(__dirname, "src/layouts/ComponentLayout.svelte"),
+ },
}),
{
markup({ content, filename }) {
+ if (filename.endsWith(".svx") && filename.match(/pages\/(recipes)/)) {
+ const toc = [];
+
+ walk(parse(content), {
+ enter(node) {
+ if (node.type === "Element") {
+ if (node.name === "h2") {
+ const id = node.attributes.find(
+ (attribute) => attribute.name === "id"
+ );
+ toc.push({
+ id: id.value[0].raw,
+ text: node.children[0].raw,
+ });
+ }
+ }
+ },
+ });
+
+ return {
+ code: content.replace(
+ "",
+ `
+
+ ${toc
+ .map((item) => {
+ return `
+ -
+ ${item.text}
+
`;
+ })
+ .join("")}
+
+
+ `
+ ),
+ };
+ }
+
if (
- filename.includes("pages/components") &&
- filename.endsWith(".svx")
+ filename.endsWith(".svx") &&
+ filename.match(/pages\/(components)/)
) {
const toc = [];