## Documentation index

This index lists every available documentation page and its Markdown source.

- [Documentation](https://veta.varavel.com/docs/index.md)
  - [Getting Started](https://veta.varavel.com/docs/getting-started/index.md)
  - [Installation](https://veta.varavel.com/docs/installation/index.md)
  - [Guides](https://veta.varavel.com/docs/guides/index.md)
    - [Project Structure](https://veta.varavel.com/docs/guides/project-structure/index.md)
    - [Configuration](https://veta.varavel.com/docs/guides/configuration/index.md)
    - [Pages](https://veta.varavel.com/docs/guides/pages/index.md)
    - [Data](https://veta.varavel.com/docs/guides/data/index.md)
    - [Markdown](https://veta.varavel.com/docs/guides/markdown/index.md)
    - [Templates](https://veta.varavel.com/docs/guides/templates/index.md)
    - [Components](https://veta.varavel.com/docs/guides/components/index.md)
    - [Filters](https://veta.varavel.com/docs/guides/filters/index.md)
    - [Assets And Tailwind CSS](https://veta.varavel.com/docs/guides/assets-and-tailwind/index.md)
    - [Themes](https://veta.varavel.com/docs/guides/themes/index.md)
    - [Development Server](https://veta.varavel.com/docs/guides/development-server/index.md)
    - [Build And Output](https://veta.varavel.com/docs/guides/build-and-output/index.md)
    - [Deployment](https://veta.varavel.com/docs/guides/deployment/index.md)
  - [Reference](https://veta.varavel.com/docs/reference/index.md)
    - [CLI Reference](https://veta.varavel.com/docs/reference/cli/index.md)
    - [Config Reference](https://veta.varavel.com/docs/reference/config/index.md)
    - [Page Generators Reference](https://veta.varavel.com/docs/reference/page-generators/index.md)
    - [Template Context Reference](https://veta.varavel.com/docs/reference/template-context/index.md)
    - [Troubleshooting](https://veta.varavel.com/docs/reference/troubleshooting/index.md)
  - [API](https://veta.varavel.com/docs/api/index.md)
    - [JavaScript API](https://veta.varavel.com/docs/api/javascript/index.md)
    - [File API](https://veta.varavel.com/docs/api/files/index.md)
    - [HTTP Client](https://veta.varavel.com/docs/api/http-client/index.md)
    - [Parse API](https://veta.varavel.com/docs/api/parse/index.md)
    - [Template Functions](https://veta.varavel.com/docs/api/template-functions/index.md)
    - [Environment And Console](https://veta.varavel.com/docs/api/environment-and-console/index.md)
    - [Markdown Frontmatter](https://veta.varavel.com/docs/api/frontmatter/index.md)


## Documentation content

The documentation for the current page follows, reproduced verbatim.


# Parse API

The parse API is available as `parse` in JavaScript context objects. It parses structured text, renders Markdown bodies, and explicitly resolves component tags. File and HTTP APIs return text; call the required operations in the order your output needs.

```js
export default function({ files, parse }) {
  const { frontmatter, html } = parse.markdown(
    files.readFile("content/posts/hello.md"),
  );
  const content = parse.renderComponents(html);

  return [
    {
      permalink: "/posts/hello/",
      template: "post",
      title: frontmatter.title,
      content,
    },
  ];
}
```

## `parse.json(text)`

Parses one JSON value. Multiple JSON values are rejected.

```js
const site = parse.json("{\"title\":\"Veta\"}");
```

## `parse.yaml(text)`

Parses one YAML document. Multiple YAML documents are rejected.

```js
const navigation = parse.yaml("items:\n  - label: Docs\n");
```

## `parse.toml(text)`

Parses one TOML document.

```js
const theme = parse.toml("name = \"Clean\"\n");
```

## `parse.markdown(text)`

Parses optional YAML or TOML frontmatter and renders the Markdown body to HTML.

```js
const post = parse.markdown(files.readFile("content/posts/hello.md"));
```

Return shape:

```js
{
  frontmatter: { title: "Hello" },
  content: "# Hello\n\nPost body.\n",
  html: "<h1>Hello</h1>\n<p>Post body.</p>\n"
}
```

- `frontmatter` is the parsed object.
- `content` is the raw body after frontmatter is removed.
- `html` is the Markdown-rendered body.

Without frontmatter, `frontmatter` is `{}`, `content` is the full input, and `html` is the full input rendered as Markdown.

Raw HTML is preserved as trusted author content. HTML-like opening tags may span lines and can end with either `>` or `/>`; quoted `>` characters inside attributes do not end the tag. This allows paired and self-closing component invocations to survive until an explicit `parse.renderComponents` call.

## `parse.renderComponents(text)`

Resolves registered component tags in any supplied string and returns the transformed string:

```js
const content = parse.renderComponents(
  "<callout kind=\"warning\">Check the configuration.</callout>",
);
```

Only registered tags are resolved; other tags remain unchanged. Props, slot content, nested components, Pongo component context, includes, and inheritance work as they do elsewhere. This operation does not render Markdown.

Component-like text remains unchanged inside HTML attributes, comments, raw-text and code elements such as `script`, `style`, `code`, `pre`, `textarea`, and `title`, as well as Markdown inline code and fenced code blocks. Component template output is not scanned again, which keeps rendering a bounded, one-pass transformation. Excessively deep input or recursive calls from component template functions fail with a controlled render-limit error.

The caller controls ordering. For a Markdown file that may contain component tags, the recommended page-generator flow is:

```js
const { frontmatter, html } = parse.markdown(files.readFile(path));
const content = parse.renderComponents(html);

return {
  permalink: files.toPermalink(path, { stripPrefix: "content" }),
  template: "post",
  title: frontmatter.title,
  content,
};
```

When called by a page generator, component templates receive global `data`; `page` and `pages` do not exist yet because the generator is creating the page list. When a context-bound JavaScript template function calls it, available runtime `page` and `pages` values can flow into component rendering. Props come from each tag's attributes and slot content.

## Pongo Filter Distinction

The Pongo `parse_markdown` filter is unchanged: it returns `{ content, frontmatter }` and does not render Markdown. Use Pongo's separate `markdown` filter to render that `content`. JavaScript `parse.markdown(text)` returns the additional `html` field described above.

Parsed values are normalized into JavaScript-compatible values. Dates are exposed as strings.
