Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Write read me for the Markdoc config. #7989

Merged
merged 8 commits into from
Aug 25, 2023
35 changes: 35 additions & 0 deletions packages/integrations/markdoc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,41 @@ 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 a [Markdoc language extension](https://marketplace.visualstudio.com/items?itemName=Stripe.markdoc-language-support). Which includes syntax highlighting and autocomplete for configured tags.
For more information, [see the language server on GitHub](https://github.com/markdoc/language-server.git).

To set up the extension, create a `markdoc.config.json` file into the project root, with following content:
ElianCodes marked this conversation as resolved.
Show resolved Hide resolved

```json
[
{
"id": "my-site",
"path": "src/content",
"schema": {
"path": "markdoc.config.mjs",
"type": "esm",
"property": "default",
"watch": true
},
"routing": {
"frontmatter": "route"
}
ElianCodes marked this conversation as resolved.
Show resolved Hide resolved
}
]
```

The `schema` property, is the most important. It contains all information to configure the language server.
It accepts following properties.

- `path`: The path to the configuration file.
- `type`: Kind of module your configuration file uses.
- `property`: The exported property name that contains the configuration object.
- `watch`: Tell the server to watch for changes in the configuration.

The global `path` property, tells the server where the content is located. You can't use a glob pattern.
ElianCodes marked this conversation as resolved.
Show resolved Hide resolved

### 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.
Expand Down
Loading