# `DialectoInContext.Marker`
[🔗](https://github.com/dialecto-eu/dialecto-phoenix/blob/v0.1.0/lib/dialecto_in_context/marker.ex#L1)

The in-context marker codec v1 (spec-0016 §3), byte-identical to the
overlay's `codec.js` and the Astro add-on's encoder.

A marked text is `OPEN + header + HEADER_END + text + CLOSE`. The header is
the UTF-8 payload `domain US key US locale` (optionally `RS argsJSON`), each
byte written as four base-4 digits, most significant first. Every marker
codepoint is Default_Ignorable, so the text renders unchanged; they are
written here by number, never as literal invisible characters.

# `segment`

```elixir
@type segment() :: %{
  domain: String.t(),
  key: String.t(),
  locale: String.t(),
  args: map() | nil,
  text: String.t(),
  open: boolean()
}
```

One marked segment found by `parse/1`.

# `close`

The CLOSE codepoint.

# `digits`

The four digit codepoints, values 0–3.

# `header_end`

The HEADER_END codepoint.

# `mark`

```elixir
@spec mark(String.t(), String.t(), String.t(), String.t(), String.t() | nil) ::
  String.t()
```

`text` wrapped in a marker for `{domain, key, locale}`. `args_json`, when
given, is recorded after U+001E in the header (it must be JSON, which never
holds a raw U+001E).

# `marked?`

```elixir
@spec marked?(term()) :: boolean()
```

True when `text` holds a marker opening.

# `open`

The OPEN codepoint.

# `parse`

```elixir
@spec parse(String.t()) :: [segment()]
```

Every well-formed marked segment of `text`, outer before inner, with its
clean text. Malformed headers and unbalanced CLOSEs are ignored; an OPEN
never closed extends to the end and is flagged `open: true`.

# `prefix`

```elixir
@spec prefix(String.t(), String.t(), String.t(), String.t() | nil) :: String.t()
```

Everything that precedes the marked text: OPEN, the header digits, HEADER_END.

# `strip`

```elixir
@spec strip(String.t()) :: String.t()
```

`text` without markers. Digit codepoints outside a header (a real ZWJ in
an emoji) are kept, like the overlay's `stripMarks`.

---

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