diff options
author | 2023-08-25 13:06:04 -0400 | |
---|---|---|
committer | 2023-08-25 19:06:04 +0200 | |
commit | 6cfaf75af96c2b9f4be479fce535222ed16f8f08 (patch) | |
tree | 73d684c5eadb8df7e60dc58fe735f8b946afe68c | |
parent | 2b5d739bd90c5407ae2f92962930a34f0299eb3e (diff) | |
download | astro-6cfaf75af96c2b9f4be479fce535222ed16f8f08.tar.gz astro-6cfaf75af96c2b9f4be479fce535222ed16f8f08.tar.zst astro-6cfaf75af96c2b9f4be479fce535222ed16f8f08.zip |
chore: Write read me for the Markdoc config. (#7989)
Co-authored-by: Elian ☕️ <hello@elian.codes>
Co-authored-by: Ben Holmes <hey@bholmes.dev>
-rw-r--r-- | packages/integrations/markdoc/README.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/packages/integrations/markdoc/README.md b/packages/integrations/markdoc/README.md index 780b8de9a..576ad6e71 100644 --- a/packages/integrations/markdoc/README.md +++ b/packages/integrations/markdoc/README.md @@ -344,6 +344,36 @@ Now, you can call this function from any Markdoc content entry: 📚 [See the Markdoc documentation](https://markdoc.dev/docs/functions#creating-a-custom-function) for more on using variables or functions in your content. +### Markdoc Language Server + +If you are using VS Code, there is an official [Markdoc language extension](https://marketplace.visualstudio.com/items?itemName=Stripe.markdoc-language-support) that includes syntax highlighting and autocomplete for configured tags. [See the language server on GitHub](https://github.com/markdoc/language-server.git) for more information. + +To set up the extension, create a `markdoc.config.json` file into the project root with following content: + +```json +[ + { + "id": "my-site", + "path": "src/content", + "schema": { + "path": "markdoc.config.mjs", + "type": "esm", + "property": "default", + "watch": true + }, + } +] +``` + +The `schema` property contains all information to configure the language server for Astro content collections. It accepts following properties: + +- `path`: The path to the configuration file. +- `type`: The type of module your configuration file uses (`esm` allows `import` syntax). +- `property`: The exported property name that contains the configuration object. +- `watch`: Tell the server to watch for changes in the configuration. + +The top-level `path` property tells the server where content is located. Since Markdoc is specific to content collections, you can use `src/content`. + ### Pass Markdoc variables You may need to pass [variables][markdoc-variables] to your content. This is useful when passing SSR parameters like A/B tests. |