Behaviour SwRS-MDOKFSTUDIO-CORE-070
Parsing a document with many directives stays fast and keeps the blank lines around each directive
When a document is parsed, the MyST parser SHALL take a time that does not grow with the number of directives times the size of the document, and the blank lines before and after each directive (its tightness) SHALL stay unchanged.
Part of StRS-MDOKFSTUDIO-CORE-001, outside the paths drawn on its map.
Scenarios 3
The situations the tests check; open one to read it.
nominalThe parse time does not grow with the directives
Givena document with five directive fences, some with a blank line before, after, both or neither, and a long document with many directive fences
Whenit is parsed with markdown-it-myst patched in memory (the esbuild bundle plugin, or the Node load hook of Node-run code)
Theneach directive reports the same tightness as the unpatched package: false, "before", "after" or true
the parse cost does not grow with the number of directives times the size of the document: the test counts the splits of the source into lines, which is one for the parse instead of one per directive fence
the parse cost does not grow with the number of directives times the size of the document: the test counts the splits of the source into lines, which is one for the parse instead of one per directive fence
boundaryThe packages on disk stay untouched
Givenan install of the pristine MyST packages
Whenthe bundle is built or Node-run code parses a document
Thenthe patches are applied to the source in memory, no file of node_modules is written, and the install has no postinstall script
refusalAn unknown package version
Givena markdown-it-myst version other than 1.0.19, or a file that does not match the expected code
Whenthe bundle is built or the package is loaded
Thenit fails with a message asking for a review of the patch, instead of patching blindly
Implemented in 1
Tested by 1
Known limits (1)
- the in-memory patch (scripts/myst-patches.mjs) is needed until the upstream package splits the source once per parse; the pull request text is prepared and not yet sent.