From 2a4bb23b2f7f82b3fabdad4d64101fcc778acaa4 Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Tue, 6 Jun 2023 13:40:04 -0400 Subject: [PATCH 1/4] Fix missing styles and scripts on `document: {render:null}` (#7309) * fix: propagate assets when using document `render: null` * fix: reverse spread order * refactor: use README rec in test * chore: changeset * chore: revert unneeded changes --- .changeset/shaggy-deers-end.md | 5 +++++ packages/integrations/markdoc/README.md | 8 +++----- .../markdoc/components/Renderer.astro | 8 +++++++- .../markdoc/components/TreeNode.ts | 14 +++---------- .../fixtures/render-null/markdoc.config.mjs | 20 ++----------------- 5 files changed, 20 insertions(+), 35 deletions(-) create mode 100644 .changeset/shaggy-deers-end.md diff --git a/.changeset/shaggy-deers-end.md b/.changeset/shaggy-deers-end.md new file mode 100644 index 0000000000000..2c8be9bde568e --- /dev/null +++ b/.changeset/shaggy-deers-end.md @@ -0,0 +1,5 @@ +--- +'@astrojs/markdoc': patch +--- + +Fix missing styles and scripts for components when using `document: { render: null }` in the Markdoc config. diff --git a/packages/integrations/markdoc/README.md b/packages/integrations/markdoc/README.md index da5aeb46ae15d..ee110f37392be 100644 --- a/packages/integrations/markdoc/README.md +++ b/packages/integrations/markdoc/README.md @@ -151,9 +151,8 @@ import Heading from './src/components/Heading.astro'; export default defineMarkdocConfig({ nodes: { heading: { + ...nodes.heading, // Preserve default anchor link generation render: Heading, - // Preserve default anchor link generation - ...nodes.heading, }, }, }) @@ -225,8 +224,8 @@ import { defineMarkdocConfig, nodes } from '@astrojs/markdoc/config'; export default defineMarkdocConfig({ nodes: { document: { - render: null, // default 'article' ...nodes.document, // Apply defaults for other options + render: null, // default 'article' }, }, }) @@ -246,9 +245,8 @@ import Quote from './src/components/Quote.astro'; export default defineMarkdocConfig({ nodes: { blockquote: { + ...nodes.blockquote, // Apply Markdoc's defaults for other options render: Quote, - // Apply Markdoc's defaults for other options - ...nodes.blockquote, }, }, }) diff --git a/packages/integrations/markdoc/components/Renderer.astro b/packages/integrations/markdoc/components/Renderer.astro index 6571e8c7175fc..4b0dbb3a09fab 100644 --- a/packages/integrations/markdoc/components/Renderer.astro +++ b/packages/integrations/markdoc/components/Renderer.astro @@ -15,4 +15,10 @@ const ast = Markdoc.Ast.fromJSON(stringifiedAst); const content = Markdoc.transform(ast, config); --- - +{ + Array.isArray(content) ? ( + content.map(async (c) => ) + ) : ( + + ) +} diff --git a/packages/integrations/markdoc/components/TreeNode.ts b/packages/integrations/markdoc/components/TreeNode.ts index 8ad7780632858..082495a87f24c 100644 --- a/packages/integrations/markdoc/components/TreeNode.ts +++ b/packages/integrations/markdoc/components/TreeNode.ts @@ -1,5 +1,4 @@ import type { AstroInstance } from 'astro'; -import { Fragment } from 'astro/jsx-runtime'; import type { RenderableTreeNode } from '@markdoc/markdoc'; import Markdoc from '@markdoc/markdoc'; import { @@ -106,18 +105,11 @@ export const ComponentNode = createComponent({ propagation: 'self', }); -export async function createTreeNode(node: RenderableTreeNode | RenderableTreeNode[]): TreeNode { +export async function createTreeNode(node: RenderableTreeNode): Promise { if (isHTMLString(node)) { return { type: 'text', content: node as HTMLString }; } else if (typeof node === 'string' || typeof node === 'number') { return { type: 'text', content: String(node) }; - } else if (Array.isArray(node)) { - return { - type: 'component', - component: Fragment, - props: {}, - children: await Promise.all(node.map((child) => createTreeNode(child))), - }; } else if (node === null || typeof node !== 'object' || !Markdoc.Tag.isTag(node)) { return { type: 'text', content: '' }; } @@ -136,7 +128,7 @@ export async function createTreeNode(node: RenderableTreeNode | RenderableTreeNo }; } else if (isPropagatedAssetsModule(node.name)) { const { collectedStyles, collectedLinks, collectedScripts } = node.name; - const component = (await node.name.getMod())?.default ?? Fragment; + const component = (await node.name.getMod()).default; const props = node.attributes; return { @@ -160,7 +152,7 @@ export async function createTreeNode(node: RenderableTreeNode | RenderableTreeNo type PropagatedAssetsModule = { __astroPropagation: true; - getMod: () => Promise; + getMod: () => Promise; collectedStyles: string[]; collectedLinks: string[]; collectedScripts: string[]; diff --git a/packages/integrations/markdoc/test/fixtures/render-null/markdoc.config.mjs b/packages/integrations/markdoc/test/fixtures/render-null/markdoc.config.mjs index 2f87f6de0bc13..01082bfacd020 100644 --- a/packages/integrations/markdoc/test/fixtures/render-null/markdoc.config.mjs +++ b/packages/integrations/markdoc/test/fixtures/render-null/markdoc.config.mjs @@ -1,26 +1,10 @@ -import { defineMarkdocConfig } from '@astrojs/markdoc/config'; +import { defineMarkdocConfig, nodes } from '@astrojs/markdoc/config'; export default defineMarkdocConfig({ nodes: { document: { + ...nodes.document, render: null, - - // Defaults from `Markdoc.nodes.document` - children: [ - 'heading', - 'paragraph', - 'image', - 'table', - 'tag', - 'fence', - 'blockquote', - 'comment', - 'list', - 'hr', - ], - attributes: { - frontmatter: { render: false }, - }, } } }) From 8034edd9ecf805073395ba7f68f73cd5fc4d2c73 Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Tue, 6 Jun 2023 13:48:10 -0400 Subject: [PATCH 2/4] Fix [Object AsyncGenerator] logging for Markdoc components (#7307) * Revert "Bug 6672 (#7062)" This reverts commit cf621340b00fda441f4ef43196c0363d09eae70c. * chore: remove unused test * chore: changeset --- .changeset/nice-falcons-flash.md | 6 +++ .../runtime/server/render/astro/instance.ts | 3 -- .../mdx/test/astro-content-css.test.js | 49 ------------------- .../astro-content-css/astro.config.mjs | 11 ----- .../fixtures/astro-content-css/package.json | 9 ---- .../astro-content-css/src/content/config.ts | 12 ----- .../dynamic/FirstComponentWithJS.astro | 18 ------- .../dynamic/first-component-with-js.mdx | 9 ---- .../astro-content-css/src/pages/index.astro | 16 ------ pnpm-lock.yaml | 9 ---- 10 files changed, 6 insertions(+), 136 deletions(-) create mode 100644 .changeset/nice-falcons-flash.md delete mode 100644 packages/integrations/mdx/test/astro-content-css.test.js delete mode 100644 packages/integrations/mdx/test/fixtures/astro-content-css/astro.config.mjs delete mode 100644 packages/integrations/mdx/test/fixtures/astro-content-css/package.json delete mode 100644 packages/integrations/mdx/test/fixtures/astro-content-css/src/content/config.ts delete mode 100644 packages/integrations/mdx/test/fixtures/astro-content-css/src/content/dynamic/FirstComponentWithJS.astro delete mode 100644 packages/integrations/mdx/test/fixtures/astro-content-css/src/content/dynamic/first-component-with-js.mdx delete mode 100644 packages/integrations/mdx/test/fixtures/astro-content-css/src/pages/index.astro diff --git a/.changeset/nice-falcons-flash.md b/.changeset/nice-falcons-flash.md new file mode 100644 index 0000000000000..7731f18a6a838 --- /dev/null +++ b/.changeset/nice-falcons-flash.md @@ -0,0 +1,6 @@ +--- +'astro': patch +'@astrojs/mdx': patch +--- + +Fix [Object AsyncGenerator] appearing in markup for Markdoc documents diff --git a/packages/astro/src/runtime/server/render/astro/instance.ts b/packages/astro/src/runtime/server/render/astro/instance.ts index abfcd94e89eb8..ed5044575ae56 100644 --- a/packages/astro/src/runtime/server/render/astro/instance.ts +++ b/packages/astro/src/runtime/server/render/astro/instance.ts @@ -50,9 +50,6 @@ export class AstroComponentInstance { value = await value; } if (isHeadAndContent(value)) { - if (this.result.extraHead.length === 0 && value.head) { - yield renderChild(value.head); - } yield* value.content; } else { yield* renderChild(value); diff --git a/packages/integrations/mdx/test/astro-content-css.test.js b/packages/integrations/mdx/test/astro-content-css.test.js deleted file mode 100644 index 712aaf54771b0..0000000000000 --- a/packages/integrations/mdx/test/astro-content-css.test.js +++ /dev/null @@ -1,49 +0,0 @@ -import { expect } from 'chai'; -import * as cheerio from 'cheerio'; -import { loadFixture } from '../../../astro/test/test-utils.js'; -import mdx from '@astrojs/mdx'; - -describe('build css from the component', async () => { - let fixture; - - before(async () => { - fixture = await loadFixture({ - root: new URL('./fixtures/astro-content-css/', import.meta.url), - integrations: [mdx()], - }); - await fixture.build(); - }); - - describe('Build', () => { - before(async () => { - await fixture.build(); - }); - - it('including css and js from the component in pro', async () => { - const html = await fixture.readFile('/index.html'); - const $ = cheerio.load(html); - expect($('link[href$=".css"]').attr('href')).to.match(/^\/_astro\//); - expect($('script[src$=".js"]').attr('src')).to.match(/^\/_astro\//); - }); - }); - - describe('Dev', () => { - let devServer; - before(async () => { - devServer = await fixture.startDevServer(); - }); - - after(async () => { - devServer.stop(); - }); - - it('ncluding css and js from the component in Dev', async () => { - let res = await fixture.fetch(`/`); - expect(res.status).to.equal(200); - const html = await res.text(); - const $ = cheerio.load(html); - expect($.html()).to.include('CornflowerBlue'); - expect($('script[src$=".js"]').attr('src')).to.include('astro'); - }); - }); -}); diff --git a/packages/integrations/mdx/test/fixtures/astro-content-css/astro.config.mjs b/packages/integrations/mdx/test/fixtures/astro-content-css/astro.config.mjs deleted file mode 100644 index b67da09a917ed..0000000000000 --- a/packages/integrations/mdx/test/fixtures/astro-content-css/astro.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -import { defineConfig } from 'astro/config'; - -import mdx from "@astrojs/mdx"; - -// https://astro.build/config -export default defineConfig({ - build: { - format: 'file' - }, - integrations: [mdx()] -}); diff --git a/packages/integrations/mdx/test/fixtures/astro-content-css/package.json b/packages/integrations/mdx/test/fixtures/astro-content-css/package.json deleted file mode 100644 index 8d436998c640e..0000000000000 --- a/packages/integrations/mdx/test/fixtures/astro-content-css/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "@test/astro-content-css", - "version": "0.0.0", - "private": true, - "dependencies": { - "astro": "workspace:*", - "@astrojs/mdx": "workspace:*" - } -} diff --git a/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/config.ts b/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/config.ts deleted file mode 100644 index bf1a34c0528f7..0000000000000 --- a/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/config.ts +++ /dev/null @@ -1,12 +0,0 @@ -// 1. Import utilities from `astro:content` -import { z, defineCollection } from 'astro:content'; -// 2. Define a schema for each collection you'd like to validate. -const dynamicCollection = defineCollection({ - schema: z.object({ - title: z.string(), - }), -}); -// 3. Export a single `collections` object to register your collection(s) -export const collections = { - dynamic: dynamicCollection, -}; diff --git a/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/dynamic/FirstComponentWithJS.astro b/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/dynamic/FirstComponentWithJS.astro deleted file mode 100644 index f3b588b427137..0000000000000 --- a/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/dynamic/FirstComponentWithJS.astro +++ /dev/null @@ -1,18 +0,0 @@ ---- -const { text } = Astro.props; ---- - - - - -
1st components with js. Props: {text}. Styles. JS:
- - - - \ No newline at end of file diff --git a/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/dynamic/first-component-with-js.mdx b/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/dynamic/first-component-with-js.mdx deleted file mode 100644 index 0abdfbe3a4f82..0000000000000 --- a/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/dynamic/first-component-with-js.mdx +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: 'First component' ---- - -import FirstDynamicComponentWithJS from './FirstComponentWithJS.astro'; - - - -Additional text from mdx 'first-component-with-js' diff --git a/packages/integrations/mdx/test/fixtures/astro-content-css/src/pages/index.astro b/packages/integrations/mdx/test/fixtures/astro-content-css/src/pages/index.astro deleted file mode 100644 index 63ea9ddbb41b3..0000000000000 --- a/packages/integrations/mdx/test/fixtures/astro-content-css/src/pages/index.astro +++ /dev/null @@ -1,16 +0,0 @@ ---- -import { getCollection } from 'astro:content'; - -const entries = await getCollection('dynamic'); ---- - - - - - - {entries.map(async entry => { - const { Content } = await entry.render(); - return ; - })} - - diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 29d4f497a3473..63bb9e6f09b9c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4259,15 +4259,6 @@ importers: specifier: ^4.3.1 version: 4.3.1(@types/node@18.16.3)(sass@1.52.2) - packages/integrations/mdx/test/fixtures/astro-content-css: - dependencies: - '@astrojs/mdx': - specifier: workspace:* - version: link:../../.. - astro: - specifier: workspace:* - version: link:../../../../../astro - packages/integrations/mdx/test/fixtures/css-head-mdx: dependencies: '@astrojs/mdx': From a11b62ee1f5d524b0ba942818525b623a6d6eb99 Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Tue, 6 Jun 2023 14:48:54 -0400 Subject: [PATCH 3/4] Fix: Markdoc type errors (#7311) * fix: config, prism, shiki exports * fix: type error for `render` property * chore: use `.ts` files in select tests for type checks * fix: type error on shiki() promise * chore: changeset --- .changeset/khaki-dolls-nail.md | 5 ++++ packages/integrations/markdoc/package.json | 28 +++++++++++++++++-- packages/integrations/markdoc/src/config.ts | 26 +++++++++++++---- .../integrations/markdoc/src/heading-ids.ts | 13 +++++---- packages/integrations/markdoc/src/index.ts | 8 ++++-- .../integrations/markdoc/src/load-config.ts | 8 +++--- .../{markdoc.config.mjs => markdoc.config.ts} | 0 .../{markdoc.config.mjs => markdoc.config.ts} | 0 8 files changed, 68 insertions(+), 20 deletions(-) create mode 100644 .changeset/khaki-dolls-nail.md rename packages/integrations/markdoc/test/fixtures/render-with-components/{markdoc.config.mjs => markdoc.config.ts} (100%) rename packages/integrations/markdoc/test/fixtures/render-with-config/{markdoc.config.mjs => markdoc.config.ts} (100%) diff --git a/.changeset/khaki-dolls-nail.md b/.changeset/khaki-dolls-nail.md new file mode 100644 index 0000000000000..2d5328b06c74a --- /dev/null +++ b/.changeset/khaki-dolls-nail.md @@ -0,0 +1,5 @@ +--- +'@astrojs/markdoc': patch +--- + +Fix Markdoc type errors for `render` and `defineMarkdocConfig()` when using a TypeScript Markdoc config file. diff --git a/packages/integrations/markdoc/package.json b/packages/integrations/markdoc/package.json index 14fd1dbf32f9a..9049c52b538de 100644 --- a/packages/integrations/markdoc/package.json +++ b/packages/integrations/markdoc/package.json @@ -19,15 +19,37 @@ "bugs": "https://github.com/withastro/astro/issues", "homepage": "https://docs.astro.build/en/guides/integrations-guide/markdoc/", "exports": { - "./prism": "./dist/extensions/prism.js", - "./shiki": "./dist/extensions/shiki.js", + "./prism": { + "types": "./dist/extensions/prism.d.ts", + "node": "./dist/extensions/prism.js" + }, + "./shiki": { + "types": "./dist/extensions/shiki.d.ts", + "node": "./dist/extensions/shiki.js" + }, + "./config": { + "types": "./dist/config.d.ts", + "node": "./dist/config.js" + }, ".": "./dist/index.js", "./components": "./components/index.ts", "./runtime": "./dist/runtime.js", - "./config": "./dist/config.js", "./experimental-assets-config": "./dist/experimental-assets-config.js", "./package.json": "./package.json" }, + "typesVersions": { + "*": { + "config": [ + "./dist/config.d.ts" + ], + "prism": [ + "./dist/extensions/prism.d.ts" + ], + "shiki": [ + "./dist/extensions/shiki.d.ts" + ] + } + }, "files": [ "components", "dist", diff --git a/packages/integrations/markdoc/src/config.ts b/packages/integrations/markdoc/src/config.ts index 23ff744f79c7a..2c2f2c677d437 100644 --- a/packages/integrations/markdoc/src/config.ts +++ b/packages/integrations/markdoc/src/config.ts @@ -1,12 +1,26 @@ -import type { ConfigType as MarkdocConfig } from '@markdoc/markdoc'; +import type { AstroInstance } from 'astro'; +import type { + ConfigType as MarkdocConfig, + Config, + NodeType, + Schema, + MaybePromise, +} from '@markdoc/markdoc'; import _Markdoc from '@markdoc/markdoc'; import { heading } from './heading-ids.js'; -export type AstroMarkdocConfig = Record> = - MarkdocConfig & { - ctx?: C; - extends?: ResolvedAstroMarkdocConfig[]; - }; +type Render = AstroInstance['default'] | string; + +export type AstroMarkdocConfig = Record> = Omit< + MarkdocConfig, + 'tags' | 'nodes' +> & + Partial<{ + tags: Record>; + nodes: Partial>>; + ctx: C; + extends: MaybePromise[]; + }>; export type ResolvedAstroMarkdocConfig = Omit; diff --git a/packages/integrations/markdoc/src/heading-ids.ts b/packages/integrations/markdoc/src/heading-ids.ts index 5e54af9a78e3b..41773250eb2fe 100644 --- a/packages/integrations/markdoc/src/heading-ids.ts +++ b/packages/integrations/markdoc/src/heading-ids.ts @@ -1,6 +1,9 @@ -import Markdoc, { type RenderableTreeNode, type Schema } from '@markdoc/markdoc'; +import Markdoc, { + type RenderableTreeNode, + type Schema, + type Config as MarkdocConfig, +} from '@markdoc/markdoc'; import Slugger from 'github-slugger'; -import type { AstroMarkdocConfig } from './config.js'; import { getTextContent } from './runtime.js'; import { MarkdocError } from './utils.js'; @@ -19,9 +22,9 @@ function getSlug( return slug; } -type HeadingIdConfig = AstroMarkdocConfig<{ - headingSlugger: Slugger; -}>; +type HeadingIdConfig = MarkdocConfig & { + ctx: { headingSlugger: Slugger }; +}; /* Expose standalone node for users to import in their config. diff --git a/packages/integrations/markdoc/src/index.ts b/packages/integrations/markdoc/src/index.ts index c2d3e8734a8ab..781ae392eff80 100644 --- a/packages/integrations/markdoc/src/index.ts +++ b/packages/integrations/markdoc/src/index.ts @@ -1,5 +1,5 @@ /* eslint-disable no-console */ -import type { Node } from '@markdoc/markdoc'; +import type { Config as MarkdocConfig, Node } from '@markdoc/markdoc'; import Markdoc from '@markdoc/markdoc'; import type { AstroConfig, AstroIntegration, ContentEntryType, HookParameters } from 'astro'; import fs from 'node:fs'; @@ -85,7 +85,11 @@ export default function markdocIntegration(legacyConfig?: any): AstroIntegration const filePath = fileURLToPath(fileUrl); - const validationErrors = Markdoc.validate(ast, markdocConfig).filter((e) => { + const validationErrors = Markdoc.validate( + ast, + /* Raised generics issue with Markdoc core https://github.com/markdoc/markdoc/discussions/400 */ + markdocConfig as MarkdocConfig + ).filter((e) => { return ( // Ignore `variable-undefined` errors. // Variables can be configured at runtime, diff --git a/packages/integrations/markdoc/src/load-config.ts b/packages/integrations/markdoc/src/load-config.ts index 4a8b2f9cdfa33..e04cc441bb936 100644 --- a/packages/integrations/markdoc/src/load-config.ts +++ b/packages/integrations/markdoc/src/load-config.ts @@ -1,8 +1,8 @@ -import type { Config as MarkdocConfig } from '@markdoc/markdoc'; import type { AstroConfig } from 'astro'; import { build as esbuild } from 'esbuild'; import * as fs from 'node:fs'; import { fileURLToPath } from 'node:url'; +import type { AstroMarkdocConfig } from './config.js'; const SUPPORTED_MARKDOC_CONFIG_FILES = [ 'markdoc.config.js', @@ -12,7 +12,7 @@ const SUPPORTED_MARKDOC_CONFIG_FILES = [ ]; export type MarkdocConfigResult = { - config: MarkdocConfig; + config: AstroMarkdocConfig; fileUrl: URL; }; @@ -33,7 +33,7 @@ export async function loadMarkdocConfig( markdocConfigUrl, astroConfig, }); - const config: MarkdocConfig = await loadConfigFromBundledFile(astroConfig.root, code); + const config: AstroMarkdocConfig = await loadConfigFromBundledFile(astroConfig.root, code); return { config, @@ -93,7 +93,7 @@ async function bundleConfigFile({ * with ESM only * @see https://github.com/vitejs/vite/blob/main/packages/vite/src/node/config.ts#L1074 */ -async function loadConfigFromBundledFile(root: URL, code: string): Promise { +async function loadConfigFromBundledFile(root: URL, code: string): Promise { // Write it to disk, load it with native Node ESM, then delete the file. const tmpFileUrl = new URL(`markdoc.config.timestamp-${Date.now()}.mjs`, root); fs.writeFileSync(tmpFileUrl, code); diff --git a/packages/integrations/markdoc/test/fixtures/render-with-components/markdoc.config.mjs b/packages/integrations/markdoc/test/fixtures/render-with-components/markdoc.config.ts similarity index 100% rename from packages/integrations/markdoc/test/fixtures/render-with-components/markdoc.config.mjs rename to packages/integrations/markdoc/test/fixtures/render-with-components/markdoc.config.ts diff --git a/packages/integrations/markdoc/test/fixtures/render-with-config/markdoc.config.mjs b/packages/integrations/markdoc/test/fixtures/render-with-config/markdoc.config.ts similarity index 100% rename from packages/integrations/markdoc/test/fixtures/render-with-config/markdoc.config.mjs rename to packages/integrations/markdoc/test/fixtures/render-with-config/markdoc.config.ts From 8b5c311b3437ac8a6491ebda813721900d2fa140 Mon Sep 17 00:00:00 2001 From: bholmesdev Date: Tue, 6 Jun 2023 18:51:14 +0000 Subject: [PATCH 4/4] [ci] format --- packages/integrations/markdoc/src/config.ts | 6 +++--- packages/integrations/markdoc/src/heading-ids.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/integrations/markdoc/src/config.ts b/packages/integrations/markdoc/src/config.ts index 2c2f2c677d437..04a81c6120498 100644 --- a/packages/integrations/markdoc/src/config.ts +++ b/packages/integrations/markdoc/src/config.ts @@ -1,12 +1,12 @@ -import type { AstroInstance } from 'astro'; import type { - ConfigType as MarkdocConfig, Config, + ConfigType as MarkdocConfig, + MaybePromise, NodeType, Schema, - MaybePromise, } from '@markdoc/markdoc'; import _Markdoc from '@markdoc/markdoc'; +import type { AstroInstance } from 'astro'; import { heading } from './heading-ids.js'; type Render = AstroInstance['default'] | string; diff --git a/packages/integrations/markdoc/src/heading-ids.ts b/packages/integrations/markdoc/src/heading-ids.ts index 41773250eb2fe..d0d14f2b12b4f 100644 --- a/packages/integrations/markdoc/src/heading-ids.ts +++ b/packages/integrations/markdoc/src/heading-ids.ts @@ -1,7 +1,7 @@ import Markdoc, { + type Config as MarkdocConfig, type RenderableTreeNode, type Schema, - type Config as MarkdocConfig, } from '@markdoc/markdoc'; import Slugger from 'github-slugger'; import { getTextContent } from './runtime.js';