## 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.


# Markdown Frontmatter

`parse.markdown(text)` in JavaScript and `parse_markdown` in Pongo templates support optional frontmatter at the start of a Markdown string. Their return shapes differ: JavaScript also renders the body into an `html` field, while the Pongo filter keeps `{ content, frontmatter }`.

Supported delimiters:

```txt
---   YAML
+++   TOML
```

Frontmatter is detected only when the first line is exactly `---` or `+++`.

## YAML Frontmatter

```md
---
title: Hello
draft: false
tags:
  - guide
  - intro
---

# Hello

Body.
```

## TOML Frontmatter

```md
+++
title = "Hello"
draft = false
tags = ["guide", "intro"]

[meta]
author = "Veta"
+++

# Hello

Body.
```

## Return Shape

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

```js
{
  frontmatter: { title: "Hello", draft: false, tags: ["guide", "intro"] },
  content: "# Hello\n\nBody.\n",
  html: "<h1>Hello</h1>\n<p>Body.</p>\n"
}
```

`content` is the raw body, and `html` is the Markdown-rendered body. One blank line immediately after the closing delimiter is removed from `content` before `html` is rendered.

## Files Without Frontmatter

```md
# Plain Markdown

No frontmatter.
```

Returns:

```js
{
  frontmatter: {},
  content: "# Plain Markdown\n\nNo frontmatter.\n",
  html: "<h1>Plain Markdown</h1>\n<p>No frontmatter.</p>\n"
}
```

Without frontmatter, `content` is the full input.

## Pongo `parse_markdown`

The Pongo filter remains a frontmatter parser only:

```html
{% set post = load_data("content/posts/hello.md")|parse_markdown %}
{{ post.content|markdown }}
```

It returns `{ content, frontmatter }`; use the separate `markdown` filter to produce HTML.

## Validation

Veta rejects:

- missing closing delimiters
- malformed YAML
- malformed TOML
- frontmatter that does not parse to an object
- multiple YAML documents
- non-finite numbers such as `NaN` or `Inf`
- maps with non-string keys

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