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

Veta provides explicit Markdown parsing through JavaScript and Pongo filters. It uses GitHub Flavored Markdown features and allows inline HTML. Page content is never rendered as Markdown automatically.

## Markdown In Page Content

Call `parse.markdown(text)` in a page generator and pass its `html` result to the page:

```js
export default function({ parse }) {
  const { html } = parse.markdown("# About\n\nThis is **Markdown**.");

  return [
    {
      permalink: "/about/",
      template: "base",
      title: "About",
      content: html,
    },
  ];
}
```

The template outputs that HTML:

```html
<main>{{ page.content }}</main>
```

Templated `page.content` is passed unchanged and trusted to the selected template, so Pongo does not escape it. The generator is responsible for producing the expected final format. Template-less content is also unchanged and is written as raw output, which makes raw Markdown pages possible.

## Markdown And Components

Markdown rendering and component resolution are independent operations. Call them explicitly in the order required by the source. The recommended generator flow is:

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

`parse.renderComponents(text)` resolves registered component tags but does not render Markdown. For example:

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

  return [
    {
      permalink: "/about/",
      template: "base",
      title: frontmatter.title,
      content,
    },
  ];
}
```

Component slot content is not given an additional Markdown pass. See [Components](/docs/guides/components/) for component behavior and context.

Raw HTML and HTML-like component tags are preserved, including opening tags whose quoted attributes span multiple lines. Both paired tags and self-closing tags therefore remain available to the following component pass. Markdown and HTML files are trusted author input in Veta; this rendering step does not sanitize scripts, event attributes, or other raw HTML.

## Markdown Files

Veta does not automatically discover Markdown pages. Use JavaScript generators to read files and create pages:

```js
export default function({ files, parse }) {
  return files.listFiles("content/posts/**/*.md").map((path) => {
    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,
    };
  });
}
```

This keeps routing explicit and lets you decide how collections are sorted, filtered, paginated, or grouped.

## YAML Frontmatter

YAML frontmatter uses `---` delimiters:

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

# Hello World

Post body.
```

## TOML Frontmatter

TOML frontmatter uses `+++` delimiters:

```md
+++
title = "Release Notes"
draft = false
tags = ["release", "notes"]

[meta]
author = "Veta"
+++

# Release Notes

Post body.
```

## `parse.markdown` Return Value

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

Returns:

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

`content` is the raw Markdown body and `html` is that body rendered as Markdown. If a Markdown file has no frontmatter, `frontmatter` is an empty object and `content` is the full input.

Frontmatter is detected only at the first line of the file. A `---` or `+++` line later in the document is treated as normal Markdown content.

## Pongo Markdown Filters

The Pongo `parse_markdown` filter keeps its template-specific return shape, `{ content, frontmatter }`, and does not render Markdown. Pipe `content` through the separate `markdown` filter when HTML is required:

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

This differs from JavaScript `parse.markdown(text)`, which also returns `html`.
