From b64e64b1a863da0c3284532d349aeb4911749d9a Mon Sep 17 00:00:00 2001 From: bholmesdev Date: Wed, 8 Feb 2023 09:53:35 -0500 Subject: [PATCH] feat: move Renderer to markdoc, get Content component! --- .../with-markdoc/src/content/blog/test.mdoc | 29 +++++++++++++++++++ examples/with-markdoc/src/pages/index.astro | 13 ++++----- packages/astro/src/content/internal.ts | 4 +-- .../markdoc/components}/RenderNode.astro | 0 .../markdoc/components/Renderer.astro | 0 .../markdoc/components}/astroNode.ts | 4 +-- .../integrations/markdoc/components/index.ts | 1 + packages/integrations/markdoc/src/index.ts | 24 +++------------ packages/integrations/markdoc/tsconfig.json | 2 +- 9 files changed, 45 insertions(+), 32 deletions(-) rename {examples/with-markdoc/src/renderer => packages/integrations/markdoc/components}/RenderNode.astro (100%) rename examples/with-markdoc/src/renderer/RenderMarkdoc.astro => packages/integrations/markdoc/components/Renderer.astro (100%) rename {examples/with-markdoc/src/renderer => packages/integrations/markdoc/components}/astroNode.ts (93%) create mode 100644 packages/integrations/markdoc/components/index.ts diff --git a/examples/with-markdoc/src/content/blog/test.mdoc b/examples/with-markdoc/src/content/blog/test.mdoc index 2b9868202..4b1c27546 100644 --- a/examples/with-markdoc/src/content/blog/test.mdoc +++ b/examples/with-markdoc/src/content/blog/test.mdoc @@ -3,3 +3,32 @@ title: Example! --- # Hey there + +Look at this table! Built-in to Markdoc, neat. + +{% table %} +* Heading 1 +* Heading 2 +--- +* Row 1 Cell 1 +* Row 1 Cell 2 +--- +* Row 2 Cell 1 +* Row 2 cell 2 +{% /table %} + +{% if $shouldMarquee %} +{% mq direction="right" %} +Im a marquee! +{% /mq %} +{% /if %} + +{% link href=$href %}Link{% /link %} + +```js +const testing = true; +function further() { + console.log('still highlighted!') +} +``` + diff --git a/examples/with-markdoc/src/pages/index.astro b/examples/with-markdoc/src/pages/index.astro index 10fbfedb5..4e7f63365 100644 --- a/examples/with-markdoc/src/pages/index.astro +++ b/examples/with-markdoc/src/pages/index.astro @@ -1,14 +1,13 @@ --- import { Markdoc } from '@astrojs/markdoc'; -import RenderMarkdoc from '../renderer/RenderMarkdoc.astro'; - -import { getTransformed } from '../components/test.mdoc'; import { Code } from 'astro/components'; import Marquee from '../components/Marquee.astro'; import { getEntryBySlug } from 'astro:content'; +import RedP from '../components/RedP.astro'; -const mdocEntry = await getEntryBySlug('blog', 'test'); -console.log(mdocEntry); +const testEntry = await getEntryBySlug('blog', 'test'); +console.log(testEntry); +const { Content } = await testEntry.render(); --- @@ -22,10 +21,10 @@ console.log(mdocEntry);

Astro

-