summaryrefslogtreecommitdiff
path: root/packages/integrations/markdoc/README.md
diff options
context:
space:
mode:
authorGravatar Ben Holmes <hey@bholmes.dev> 2023-03-21 09:20:23 -0400
committerGravatar GitHub <noreply@github.com> 2023-03-21 09:20:23 -0400
commitf42f47dc6a91cdb6534dab0ecbf9e8e85f00ba40 (patch)
tree52a4faec007fcdca9057b2ec702c790de3fdf6a3 /packages/integrations/markdoc/README.md
parente8b3c886a7579d6f4c307edcc3daf9eb57ad502f (diff)
downloadastro-f42f47dc6a91cdb6534dab0ecbf9e8e85f00ba40.tar.gz
astro-f42f47dc6a91cdb6534dab0ecbf9e8e85f00ba40.tar.zst
astro-f42f47dc6a91cdb6534dab0ecbf9e8e85f00ba40.zip
feat: Expose `$entry` variable to Markdoc (#6588)
* wip: dream api * deps: rollup types * feat: get entry data in there * fix: properly show mdoc errors in overlay * feat: implement with cache * fix: wait for in-flight entry resolution * test: entry properties can be rendered * chore: changeset * fix: remove rollup type import * Revert "deps: rollup types" This reverts commit 484ccb1c81fcf35e19c2b22289a3fe6b735a8135. * docs: add README reference * docs nit: missing space Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com> * refactor: split config config loading to separate helper * refactor: choose more readable variable names * refactor: store awaiting queue in existing cache * docs: add clear code comments * nit: add skip module code comment * refactor: add `idHandledByContentRenderPlugin` * nit: store chokidar modified events in const * fix: remove loop from content renderer * nit: else if -> if --------- Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>
Diffstat (limited to 'packages/integrations/markdoc/README.md')
-rw-r--r--packages/integrations/markdoc/README.md14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/integrations/markdoc/README.md b/packages/integrations/markdoc/README.md
index 2cc8f32e5..ba107ea75 100644
--- a/packages/integrations/markdoc/README.md
+++ b/packages/integrations/markdoc/README.md
@@ -237,6 +237,20 @@ const { Content } = await entry.render();
/>
```
+### Access frontmatter and content collection information from your templates
+
+You can access content collection information from your Markdoc templates using the `$entry` variable. This includes the entry `slug`, `collection` name, and frontmatter `data` parsed by your content collection schema (if any). This example renders the `title` frontmatter property as a heading:
+
+```md
+---
+title: Welcome to Markdoc 👋
+---
+
+# {% $entry.data.title %}
+```
+
+The `$entry` object matches [the `CollectionEntry` type](https://docs.astro.build/en/reference/api-reference/#collection-entry-type), excluding the `.render()` property.
+
### Markdoc config
The Markdoc integration accepts [all Markdoc configuration options](https://markdoc.dev/docs/config), including [tags](https://markdoc.dev/docs/tags) and [functions](https://markdoc.dev/docs/functions).