docs(settings): render field constraints as code spans in the reference

The docs site failed to build: a bare "<= 1" in the prose of the
generated page is parsed by MDX as the start of a JSX tag ("Unexpected
character '=' before name"). Constraints are rendered as code spans now,
where MDX leaves them alone, and a test rejects any bare <, { or } outside
a code span so a future description cannot reintroduce the failure.
Verified with a local next build of the docs site.
This commit is contained in:
arc53-machine committed 2026-09-17 13:05:01 +01:00
1 parent 41135fc894
commit a47a2c34ec
3 files changed
+51 -41

No files matched your search

+2 -1
View File
@@ -104,7 +104,8 @@ def _render_field(name: str, field: FieldInfo) -> str:
facts = [f"Type `{_type_name(field.annotation)}`", f"default {_default_text(field)}"]
constraints = _constraints(field)
if constraints:
facts.append("must be " + " and ".join(constraints))
# Code spans: a bare ``<=`` in MDX prose is parsed as the start of a JSX tag.
facts.append("must be " + " and ".join(f"`{c}`" for c in constraints))
aliases = _aliases(name, field)
if aliases:
facts.append("also read from " + ", ".join(f"`{a}`" for a in aliases))