saddle-ClankerSaddle 4e5b8e1d5f Fix stale comment in spec-test.js header after the module split пре 3 недеља
..
README.md f1a415f9e8 Split js/statum.js into core/document/markdown modules пре 3 недеља
regressions.js f1a415f9e8 Split js/statum.js into core/document/markdown modules пре 3 недеља
run.sh 5bc4af3bbf Replace the markdown renderer with a CommonMark 0.31.2 engine пре 1 месец
shim.js f1a415f9e8 Split js/statum.js into core/document/markdown modules пре 3 недеља
spec-test.js 4e5b8e1d5f Fix stale comment in spec-test.js header after the module split пре 3 недеља
spec-tests.json 5bc4af3bbf Replace the markdown renderer with a CommonMark 0.31.2 engine пре 1 месец

README.md

Markdown tests

JS tests for the stm-markdown renderer in js/statum-markdown.js (loaded after js/statum-core.js, which it requires). These are the repository's first JavaScript tests; they run under QuickJS so no Node.js is required.

Running

tests/markdown/run.sh          # regressions + spec suite, gates on 95%
tests/markdown/run.sh -v       # also list every failing spec example

run.sh builds the vendored QuickJS interpreter on first use (tools/qjs/build.sh, ~20s with gcc; the binary is gitignored) and reuses a system qjs when one is on PATH.

Suites

  • regressions.js — hand-written cases: the three reported bugs (emphasis spanning a line break, single newlines must not start paragraphs, wrapped lines must stay inside list items), the security posture (raw HTML neutralised, javascript:/data:/vbscript: URL filtering, entity smuggling), and edge cases (CRLF, empty input, tight vs loose lists, setext headings).
  • spec-test.js — the official CommonMark 0.31.2 example suite (655 examples, extracted from the spec with spec_tests.py --dump-tests into spec-tests.json), compared after cmark-style whitespace normalisation.

Scope and expected diffs

The renderer keeps Statum's escape-first security posture, so two spec sections are out of scope and excluded from the denominator:

  • HTML blocks (46 examples) and Raw HTML (21): raw HTML in the source renders as escaped text, never markup.

A handful of in-scope examples also differ by design:

  • autolinks with schemes outside http/https/mailto/ftp keep their text but the href is replaced with # (<irc://…>, <made-up-scheme:…>).

Current score: 96.4% of the 588 in-scope examples.

Regenerating the spec data

git clone https://github.com/commonmark/commonmark-spec /tmp/cmspec
python3 /tmp/cmspec/test/spec_tests.py -s /tmp/cmspec/spec.txt --dump-tests \
  > tests/markdown/spec-tests.json