// Seeded Markdown generator and mutator for differential fuzzing against commonmark.js (core) and // micromark + micromark-extension-gfm (GFM). Biased toward nesting, lists, emphasis, fences, and tables. import * as commonmark from "commonmark" import { tests as specTests } from "commonmark-spec" import { micromark } from "micromark" import { gfm, gfmHtml } from "micromark-extension-gfm" import { createMarkdownStream, renderBlocksToHtml } from "../src/index" export function rng(seed: number) { let s = seed >>> 0 || 1 return () => { s ^= s << 13 s >>>= 0 s ^= s >>> 17 s ^= s << 5 s >>>= 0 return s / 0x100000000 } } const PREFIXES = ["", "", "", "- ", "* ", "+ ", "1. ", "2) ", "10. ", "> ", " ", " ", " ", "\t", "- ", "1. "] const LEADERS = [ "# ", "## ", "###### ", "```", "~~~", "````js", "```py x", "---", "***", "___", "===", "- - -", "
", "", "[x]: /url", '[y]: "t"', "[Foo bar]:\n/u", " code", "", ] const TABLE = ["| a | b |", "|---|---|", "| - | :-: |", "a | b", "--|--", "| x |", "|:--|", "| `c|d` | e\\|f |"] const INLINE = [ "foo", "bar", "baz", "*", "**", "***", "_", "__", "`", "``", "[", "]", "(", ")", "![", "<", ">", "&", "#", "&nope;", "\\", "\\*", "\\_", "~", "~~", "~~~", "http://a.b/c", "www.x.com", "a@b.co", "