What version of myst-parser are you using?
5.1.0
What version dependencies are you using?
Sphinx 8.2.3, docutils 0.21.2, Python 3.12
What operating system are you using?
Windows
Describe the Bug
A YAML date nested inside a dict or a list in the front matter stops the whole Sphinx build:
File "myst_parser/mdit_to_docutils/base.py", line 1390, in dict_to_fm_field_list
value = json.dumps(value)
TypeError: Object of type date is not JSON serializable
dict_to_fm_field_list lets top-level date / datetime values through the isinstance check
(this was the fix for #252), but a date one level down reaches json.dumps(value) with no
default=. The except (ValueError, RecursionError) around that call does not catch TypeError,
so this is an exception, not a warning, and --keep-going does not help.
Expected Behavior
The build succeeds. Either of these one-line changes fits the existing code:
json.dumps(value, default=str) - the nested date becomes an ISO string, the same as a
top-level date after str(value).
- Add
TypeError to the existing except (ValueError, RecursionError), so the field is skipped
with the same MD_TOPMATTER warning.
I tested the first one on master (Linux and Windows): all four cases below then build with no
warnings.
To Reproduce
conf.py:
extensions = ["myst_parser"]
index.md:
---
review:
date: 2026-08-03
---
# Test
Run sphinx-build -b html . _build. The build stops with the TypeError above.
Results for four variants (same result on 5.1.0 and on master, on Linux and on Windows):
| Front matter |
Result |
last_updated: 2026-08-03 (top level) |
builds |
review: {date: 2026-08-03} (nested in a dict) |
TypeError |
reviewed: [2026-08-03] (nested in a list) |
TypeError |
review: {date: "2026-08-03"} (nested, quoted) |
builds |
What version of
myst-parserare you using?5.1.0
What version dependencies are you using?
Sphinx 8.2.3, docutils 0.21.2, Python 3.12
What operating system are you using?
Windows
Describe the Bug
A YAML date nested inside a dict or a list in the front matter stops the whole Sphinx build:
dict_to_fm_field_listlets top-leveldate/datetimevalues through theisinstancecheck(this was the fix for #252), but a date one level down reaches
json.dumps(value)with nodefault=. Theexcept (ValueError, RecursionError)around that call does not catchTypeError,so this is an exception, not a warning, and
--keep-goingdoes not help.Expected Behavior
The build succeeds. Either of these one-line changes fits the existing code:
json.dumps(value, default=str)- the nested date becomes an ISO string, the same as atop-level date after
str(value).TypeErrorto the existingexcept (ValueError, RecursionError), so the field is skippedwith the same
MD_TOPMATTERwarning.I tested the first one on
master(Linux and Windows): all four cases below then build with nowarnings.
To Reproduce
conf.py:index.md:Run
sphinx-build -b html . _build. The build stops with theTypeErrorabove.Results for four variants (same result on 5.1.0 and on
master, on Linux and on Windows):last_updated: 2026-08-03(top level)review: {date: 2026-08-03}(nested in a dict)TypeErrorreviewed: [2026-08-03](nested in a list)TypeErrorreview: {date: "2026-08-03"}(nested, quoted)