From 7c439868a3bc7d466418da9af669966014f3d9fe Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Mon, 27 Mar 2023 18:04:37 -0400 Subject: [Markdoc] New config format with runtime variable support! (#6653) * deps: esbuild * feat: support direct component imports for render! * deps: add devalue back * refactor: remove unused components prop * refactor: load experimental assets config separately * fix: upate Content type def to support props * refactor: replace astro stub with inline data * feat: pass through viteId to getRenderMod * fix: add back $entry var with defaults convention * chore: remove unneeded validateRenderProps * chore: remove uneeded validateComponents * fix: remove userMarkdocConfig prop * chore: add helpful error for legacy config * deps: kleur * fix: add back `isCapitalized` * fix: log instead of throw to avoid scary stacktrace * chore: delete more old logic (nice) * chore: delete MORE unused utils * chore: comment on separate assets config * chore: remove console.log * chore: general code cleanup * test: new render config * docs: new README * fix: add expect-error on astro:assets * feat: add defineMarkdocConfig helper * docs: update example README * test: add runtime variable * chore: lint * chore: changeset * chore: add component import deletion * docs: add notes on Vite fork * fix: astro check * chore: add `.mts` to markdoc config formats --- .../with-markdoc/src/components/DocsContent.astro | 32 ---------------------- examples/with-markdoc/src/pages/index.astro | 19 +++++++++---- 2 files changed, 13 insertions(+), 38 deletions(-) delete mode 100644 examples/with-markdoc/src/components/DocsContent.astro (limited to 'examples/with-markdoc/src') diff --git a/examples/with-markdoc/src/components/DocsContent.astro b/examples/with-markdoc/src/components/DocsContent.astro deleted file mode 100644 index 162c1fc6d..000000000 --- a/examples/with-markdoc/src/components/DocsContent.astro +++ /dev/null @@ -1,32 +0,0 @@ ---- -import Aside from './Aside.astro'; -import type { CollectionEntry } from 'astro:content'; - -type Props = { - entry: CollectionEntry<'docs'>; -}; - -const { entry } = Astro.props; -const { Content } = await entry.render(); ---- - - - - diff --git a/examples/with-markdoc/src/pages/index.astro b/examples/with-markdoc/src/pages/index.astro index 01412cce1..7efcbeda8 100644 --- a/examples/with-markdoc/src/pages/index.astro +++ b/examples/with-markdoc/src/pages/index.astro @@ -1,18 +1,25 @@ --- import { getEntryBySlug } from 'astro:content'; -import DocsContent from '../components/DocsContent.astro'; import Layout from '../layouts/Layout.astro'; const intro = await getEntryBySlug('docs', 'intro'); +const { Content } = await intro.render(); ---

{intro.data.title}

- - - - - +
+ + -- cgit v1.2.3