# `Brix.Reader`
[🔗](https://github.com/LoamStudios/brix/blob/main/lib/brix/reader.ex#L1)

Reads content files from the filesystem into Brix structs.

All functions take a `content_dir` path as the root of the content tree.

# `format_compact_iso`

```elixir
@spec format_compact_iso(DateTime.t()) :: String.t()
```

Formats a DateTime as a compact ISO string like "20241001T080000Z".

# `parse_compact_iso`

```elixir
@spec parse_compact_iso(String.t() | nil) :: DateTime.t() | nil
```

Parses a compact ISO timestamp directory name like "20241001T080000Z"
into a DateTime. Returns nil if the format doesn't match.

# `read_authors`

```elixir
@spec read_authors(String.t()) :: [Brix.Author.t()]
```

Reads all author YAML files from `authors/` and returns a sorted list of `Brix.Author` structs.

# `read_collections`

```elixir
@spec read_collections(String.t()) :: [Brix.Collection.t()]
```

Reads all collection YAML files from `collections/` and returns a sorted list.

# `read_layouts`

```elixir
@spec read_layouts(String.t()) :: [Brix.Layout.t()]
```

Reads all layout YAML files from `layouts/` and returns a sorted list of `Brix.Layout` structs.

# `read_media`

```elixir
@spec read_media(String.t()) :: [Brix.Media.t()]
```

Reads all media YAML files from `media/` and returns a sorted list of `Brix.Media` structs.

# `read_pages`

```elixir
@spec read_pages(String.t()) :: [Brix.Page.t()]
```

Reads all page directories from `pages/` and returns a sorted list of `Brix.Page` structs.

# `read_section_templates`

```elixir
@spec read_section_templates(String.t()) :: [Brix.SectionTemplate.t()]
```

Reads all section template YAML files from `templates/sections/` and returns a sorted list.

# `read_sections`

```elixir
@spec read_sections(String.t()) :: [Brix.Section.t()]
```

Reads all sections from a directory. Supports `.yml`, standalone `.md`, and
mixed `.field.md` files (where a markdown file provides a single field value
that is merged into its companion `.yml` section). Returns sections sorted by position.

# `read_shared_sections`

```elixir
@spec read_shared_sections(String.t()) :: [Brix.SharedSection.t()]
```

Reads all shared section YAML files from `shared_sections/` and returns a sorted list.

# `read_site`

```elixir
@spec read_site(String.t()) :: {:ok, Brix.Site.t()} | {:error, term()}
```

Reads `site.yml` from the content directory and returns a `Brix.Site` struct.

# `read_tags`

```elixir
@spec read_tags(String.t()) :: [Brix.Tag.t()]
```

Reads all tag YAML files from `tags/` and returns a sorted list of `Brix.Tag` structs.

# `resolve_sections`

```elixir
@spec resolve_sections([Brix.Section.t()], %{
  required(String.t()) =&gt; Brix.SharedSection.t()
}) :: [
  Brix.Section.t()
]
```

Resolves shared section references in a list of sections.
Takes a map of shared section name => %SharedSection{}.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
