> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chromiumly.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Markdown conversion and screenshots

> Convert HTML plus Markdown to PDF or capture a screenshot with MarkdownConverter and MarkdownScreenshot.

The Markdown route needs an **`index.html`** (template/layout) and a **Markdown file**. Gotenberg supports [MathJax](https://www.mathjax.org/) for math in Markdown. Your `index.html` must include the Go template action where the content should appear: `{{ toHTML "file.md" }}` (use the actual Markdown filename). See [Gotenberg’s Markdown conversion](https://gotenberg.dev/docs/convert-with-chromium/convert-markdown-to-pdf) for template details. Gotenberg renders the Markdown into the HTML and then converts or captures.

## Convert Markdown to PDF

```typescript theme={null}
import { MarkdownConverter } from "chromiumly";

const markdownConverter = new MarkdownConverter();
const buffer = await markdownConverter.convert({
  html: "path/to/index.html",
  markdown: "path/to/document.md",
});
```

Both `html` and `markdown` can be a file path string, `Buffer`, or `ReadStream`. Add [conversion options](/chromium/options) (e.g. `properties`, `header`, `footer`) to the same object.

## Capture Markdown as screenshot

```typescript theme={null}
import { MarkdownScreenshot } from "chromiumly";

const screenshot = new MarkdownScreenshot();
const buffer = await screenshot.capture({
  html: "path/to/index.html",
  markdown: "path/to/document.md",
});
```

Use `properties` for image format and dimensions. See [Options](/chromium/options).
