> For the complete documentation index, see [llms.txt](https://docs.vale.sh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vale.sh/formats/markdoc.md). Agents can also search and read this documentation through its [MCP server](https://docs.vale.sh/~gitbook/mcp).

# Markdoc

Learn how Vale handles Markdoc content.

{% hint style="info" %}
Requires Vale v3.28.0 or later.
{% endhint %}

[Markdoc](https://markdoc.dev/) is CommonMark plus tags, annotations, variables, and functions, all written between `{%` and `%}`, which a plain Markdown parser reads as prose. Vale parses each one as the markup it is.

The supported extensions are `.mdoc` and `.markdoc`. Markdoc itself names no extension, and many projects write it in `.md` files; those opt in through a [format association](https://docs.vale.sh/topics/.vale.ini.md#format-associations):

```ini
[formats]
md = mdoc

[*.{md,mdoc}]
BasedOnStyles = Vale
```

By default, Vale ignores:

* Variables: `{% $markdoc.frontmatter.title %}`.
* Functions: `{% uppercase($name) %}`, and a function in a tag's attributes.
* Annotations: `{% #overview %}`, `{% .class %}`, and `{% width="25%" %}` after a heading, a list item, or a table cell.
* Tag attributes, whatever their type; see [attributes](#attributes) for reaching the string ones.
* Self-closing tags, such as `{% partial file="header.md" /%}` and `{% else /%}`.
* Fenced blocks, code spans, and URLs, as in [Markdown](https://docs.vale.sh/formats/markdown.md). A tag inside a fence is code.

## [Tags](#tags)

A tag's body is Markdown, and Vale lints it:

```
{% callout type="check" %}
This prose is linted. The `type` attribute is not.
{% /callout %}
```

A tag's name also becomes a [class scope](https://docs.vale.sh/topics/scopes.md#class-scopes) for everything inside it, however deeply nested:

```yaml
extends: existence
message: "Don't use '%s' in a callout."
scope: class.callout
level: error
tokens:
  - obviously
```

A tag whose content shouldn't be linted can be excluded by name:

```ini
IgnoredClasses = raw
```

The same applies inline. Here, the word "Enter" is linted as part of its sentence:

```
Press {% kbd %}Enter{% /kbd %} to continue.
```

Tags nest by name, so a `card` inside a `card` closes with its own closing tag, and a `table` tag is linted as the lists its rows are written as.

## [Attributes](#attributes)

A tag's string attributes are its data rather than its prose, so no ordinary rule reads them: `type="check"` and `file="header.md"` raise no alerts. They are collected under the [`meta`](https://docs.vale.sh/topics/scopes.md#metadata) scope, each classed with the attribute's name, so a rule can ask for the ones that hold prose:

```yaml
extends: existence
message: "Don't use '%s' in a title."
scope: meta.class.title
level: error
tokens:
  - obviously
```

`scope: meta` reaches every string attribute in the file. Like the rest of `meta`, attribute text isn't segmented into sentences, so `sentence`-scoped rules don't apply to it. Numbers, booleans, arrays, objects, variables, and function calls are never prose, and are always ignored.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.vale.sh/formats/markdoc.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
