aboutsummaryrefslogtreecommitdiff
path: root/packages/integrations/markdoc/test/fixtures/headings-custom/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/integrations/markdoc/test/fixtures/headings-custom/src')
-rw-r--r--packages/integrations/markdoc/test/fixtures/headings-custom/src/components/Heading.astro14
-rw-r--r--packages/integrations/markdoc/test/fixtures/headings-custom/src/content/config.ts7
-rw-r--r--packages/integrations/markdoc/test/fixtures/headings-custom/src/content/docs/headings-stale-cache-check.mdoc13
-rw-r--r--packages/integrations/markdoc/test/fixtures/headings-custom/src/content/docs/headings.mdoc11
-rw-r--r--packages/integrations/markdoc/test/fixtures/headings-custom/src/pages/[slug].astro34
5 files changed, 79 insertions, 0 deletions
diff --git a/packages/integrations/markdoc/test/fixtures/headings-custom/src/components/Heading.astro b/packages/integrations/markdoc/test/fixtures/headings-custom/src/components/Heading.astro
new file mode 100644
index 000000000..ec6fa8305
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/headings-custom/src/components/Heading.astro
@@ -0,0 +1,14 @@
+---
+type Props = {
+ level: number;
+ id: string;
+};
+
+const { level, id }: Props = Astro.props;
+
+const Tag = `h${level}`;
+---
+
+<Tag data-custom-heading {id}>
+ <slot />
+</Tag>
diff --git a/packages/integrations/markdoc/test/fixtures/headings-custom/src/content/config.ts b/packages/integrations/markdoc/test/fixtures/headings-custom/src/content/config.ts
new file mode 100644
index 000000000..a142ace11
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/headings-custom/src/content/config.ts
@@ -0,0 +1,7 @@
+import { defineCollection } from 'astro:content';
+
+const docs = defineCollection({});
+
+export const collections = {
+ docs,
+};
diff --git a/packages/integrations/markdoc/test/fixtures/headings-custom/src/content/docs/headings-stale-cache-check.mdoc b/packages/integrations/markdoc/test/fixtures/headings-custom/src/content/docs/headings-stale-cache-check.mdoc
new file mode 100644
index 000000000..75cd52884
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/headings-custom/src/content/docs/headings-stale-cache-check.mdoc
@@ -0,0 +1,13 @@
+Our heading ID generator can have a stale cache for duplicates. Let's check for those!
+
+# Level 1 heading
+
+## Level **2 heading**
+
+### Level _3 heading_
+
+#### Level [4 heading](/with-a-link)
+
+##### Level 5 heading with override {% #id-override %}
+
+###### Level 6 heading
diff --git a/packages/integrations/markdoc/test/fixtures/headings-custom/src/content/docs/headings.mdoc b/packages/integrations/markdoc/test/fixtures/headings-custom/src/content/docs/headings.mdoc
new file mode 100644
index 000000000..3eb66580a
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/headings-custom/src/content/docs/headings.mdoc
@@ -0,0 +1,11 @@
+# Level 1 heading
+
+## Level **2 heading**
+
+### Level _3 heading_
+
+#### Level [4 heading](/with-a-link)
+
+##### Level 5 heading with override {% #id-override %}
+
+###### Level 6 heading
diff --git a/packages/integrations/markdoc/test/fixtures/headings-custom/src/pages/[slug].astro b/packages/integrations/markdoc/test/fixtures/headings-custom/src/pages/[slug].astro
new file mode 100644
index 000000000..90b021e95
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/headings-custom/src/pages/[slug].astro
@@ -0,0 +1,34 @@
+---
+import { CollectionEntry, getCollection } from "astro:content";
+
+export async function getStaticPaths() {
+ const docs = await getCollection('docs');
+ return docs.map(doc => ({ params: { slug: doc.slug }, props: doc }));
+}
+
+type Props = CollectionEntry<'docs'>;
+
+const { Content, headings } = await Astro.props.render();
+---
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Content</title>
+</head>
+<body>
+ <nav data-toc>
+ <ul>
+ {headings.map(heading => (
+ <li>
+ <a href={`#${heading.slug}`} data-depth={heading.depth}>{heading.text}</a>
+ </li>
+ ))}
+ </ul>
+ </nav>
+ <Content />
+</body>
+</html>