# Bengal 0.5.0

URL: /bengal/releases/0.5.0/
Section: releases
Description: Link integrity end to end plus a tighter authoring loop — preview drafts locally, detect broken internal links reliably, and apply fixes for typo, moved-page, and stale-anchor links, with broader autodoc and typed-collection migrations.

---

> For a complete page index, fetch /bengal/llms.txt.

**Key theme:** Link integrity end to end, plus a tighter authoring loop. Bengal 0.5.0 closes the loop on broken internal links — it now *detects* them reliably and *fixes* them for you — and adds a local draft-preview workflow so you can iterate on unpublished pages before they ship. Autodoc reaches one more CLI framework, typed collections gain a migration hook, and the dev server gets a faster static path. This is a quality and capability release, not a performance release — proportional warm rebuilds land in 0.6.

---

## Highlights

### Preview drafts locally

Mark a page `draft: true` and it stays out of your published site by default. Now you can see it while you work: run `bengal serve --drafts` or `bengal build --drafts`, or set `drafts = true` under `[build]`, and Bengal renders draft pages so you can preview unpublished content locally. Without the flag, drafts stay hidden — production output is unchanged (#488).

### Broken links, detected and fixed

Bengal now handles broken internal links end to end:

- **Detected reliably.** The internal link checker resolves relative links such as `../other/` against the page that references them and reports the broken ones, instead of silently passing them (#489). And autodoc no longer turns illustrative cross-reference and directive examples in docstrings into live (and often broken) links, so generated API pages — and the broken-link health check — stay clean (#485).
- **Fixed for you.** `bengal fix` now suggests and applies fixes for broken internal links: correcting a typo in a page path, re-pointing a link to a page that moved, and repairing a stale `#anchor`. Link rewrites are offered as confirm-before-apply fixes, so you review each one before it touches your source (#491).

### Broader autodoc: argparse CLIs

Autodoc CLI extraction now supports argparse alongside Click and Typer. Point it at an `argparse.ArgumentParser` with `framework="argparse"` and it documents subcommands, positional arguments, and options the same way (#493).

### Typed-collection migrations

`define_collection(..., transform=callable)` runs your callable on each record's frontmatter before schema validation. You can normalize legacy field names during a migration without rewriting source files first (#492).

### Dev server: faster static path

Dev-server assets now serve through the fast static path, and the hidden-buffer 404 workaround is removed. This requires bengal-pounce 0.8.0 or newer (#400).

### Honest claims

- `bengal build --memory-optimized` is now labeled experimental, and its help text and docs no longer promise a fixed memory saving — measure peak memory with and without the flag on your own site before relying on it (#487).
- The plugin documentation now lists the extension points that are actually wired, instead of over-claiming (#503).

---

## Added

- Local draft preview: `bengal serve --drafts` / `bengal build --drafts` (or `drafts = true` under `[build]`); drafts stay hidden by default (#488).
- `bengal fix` suggests and applies fixes for broken internal links — typo, moved-page, and stale-anchor corrections, confirm-before-apply (#491).
- `define_collection(..., transform=callable)` normalizes records before schema validation (#492).
- Autodoc CLI extraction supports argparse alongside Click and Typer (#493).

## Changed

- Dev-server assets serve through the fast static path; the hidden-buffer 404 workaround is removed (requires bengal-pounce 0.8.0+) (#400).
- `bengal build --memory-optimized` is labeled experimental, with no promised memory saving (#487).

## Fixed

- The internal link checker resolves relative links against the referencing page and reports broken ones, instead of silently passing them (#489).
- Autodoc no longer turns docstring cross-reference and directive examples into live (often broken) links, so generated API pages and the broken-link health check stay clean (#485).

---

## Upgrading

```bash
uv pip install --upgrade bengal
# or
pip install --upgrade bengal
```

A few things to know:

- **Drafts are opt-in to preview.** Pages marked `draft: true` are still hidden from a normal build; pass `--drafts` (or set `drafts = true` under `[build]`) to render them.
- **The dev-server fast static path needs bengal-pounce 0.8.0 or newer.** Upgrade bengal-pounce alongside Bengal.
- **`--memory-optimized` is experimental.** It no longer promises a fixed memory saving; measure peak memory on your own site before relying on it.
- **Not a performance release.** Proportional warm rebuilds are planned for 0.6; 0.5.0 focuses on link integrity and the authoring loop.
