Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-MYST-066

The governing conf.py is found and read as text

When a document is checked, the extension SHALL take its enabled MyST extensions from the governing `conf.py`, found as the nearest one in the document's folder or any folder up to the workspace root (never one above the root, and for a document outside the workspace only its own folder) or else as the single conf.py of a common Sphinx folder at the root, read as text and never run, and report nothing when no certain list results.

Step 1 of path 1 in StRS-MDOKFSTUDIO-MYST-007: from “A document uses syntax of a MyST extension” to “The enabled MyST extensions are known”.

Scenarios 8

The situations the tests check; open one to read it.

nominalThe nearest conf.py governs
Givenconf.py in two ancestor folders
Whena document below both is checked
Thenthe nearer one governs
boundaryThe workspace root bounds the search
Givena conf.py above the workspace root, or a document outside the workspace
Whena document is checked
Thenthe root-outside file is not used and the outside document gets no fallback, only its own folder is looked at
boundaryA single common-folder conf.py is the fallback

Applies when no conf.py is found above the document. The common folders at the workspace root are docs/, doc/, sphinx/, source/ and docs/source/.

InputOutcome
Only sphinx/conf.py, document at the rootthat file governs
Two or more candidate conf.py files in the common foldersno conf governs
An ancestor conf.py and a common-folder candidatethe ancestor wins
nominalA conf.py listing a MyST parser is read as text
Givena conf.py whose `extensions` contains myst_parser or myst_nb
Whena document is checked
Thenmissing extensions are reported, and the conf.py is never executed
refusalWithout a certain MyST list nothing is reported
InputOutcome
No conf.pynothing is reported and rendering is unchanged
conf.py without myst_parser or myst_nb in `extensions`nothing is reported and rendering is unchanged
An uncertain listnothing is reported and rendering is unchanged
An I/O error reading the filenothing is reported and rendering is unchanged
nominalList literal forms are read completely
Given`extensions` or `myst_enable_extensions` written as list or tuple literals with single, double and triple quotes, comments, trailing commas, implicit string joins, and backslash or bracket continuations
Whenthe file is read
Thenthe element list is complete and correct
InputOutcome
CRLF line endingsthe same elements result
r or u string prefixesthe same elements result
nominalMutations are applied in written order
Given`extensions = ["a"]`, then `.append("b")` and `+= ["c"]`
Whenthe file is read
Thenthe list is a, b, c in that order

The forms `=`, `+=`, `.append`, `.extend` and list addition are applied in order; `.extend([...])` followed by a later `=` reassignment gives the later assignment as the result.

refusalComputed values make the list uncertain
InputOutcome
`extensions = load()` (computed value)the result is uncertain and no warning is shown
An f-string elementthe same suppression applies
A bytes or other prefixed string elementthe same suppression applies
A `-=` changethe same suppression applies

Certainty is all or nothing.

Implemented in 2

Tested by 4

Replaces

SwRS-MDOKFSTUDIO-MYST-067A single conf-folder candidate governs when no ancestor conf exists superseded superseded by SwRS-MDOKFSTUDIO-MYST-066 Markdown file
SwRS-MDOKFSTUDIO-MYST-068conf.py is read as text and the check needs a MyST parser superseded superseded by SwRS-MDOKFSTUDIO-MYST-066 Markdown file
SwRS-MDOKFSTUDIO-MYST-069The conf.py reader understands list literal forms superseded superseded by SwRS-MDOKFSTUDIO-MYST-066 Markdown file
SwRS-MDOKFSTUDIO-MYST-070Uncertain conf.py lists suppress all warnings superseded superseded by SwRS-MDOKFSTUDIO-MYST-066 Markdown file
SwRS-MDOKFSTUDIO-MYST-089The conf.py reader applies list mutations in order superseded superseded by SwRS-MDOKFSTUDIO-MYST-066 Markdown file