From 6c339cd882bfa735bb574358f31225faff1477d9 Mon Sep 17 00:00:00 2001
From: fisker Cheung
Date: Fri, 26 Dec 2025 19:43:49 +0800
Subject: [PATCH] Upgrade to latest micromark (markdown only) (#18277)
Co-authored-by: fisker Cheung
Co-authored-by: fisker
Co-authored-by: Jed Fox
Co-authored-by: seiya <20365512+seiyab@users.noreply.github.com>
---
.github/renovate.json5 | 6 +-
changelog_unreleased/markdown/18277.md | 5 +
changelog_unreleased/markdown/18473.md | 39 +
cspell.json | 5 +-
jest.config.js | 3 +
package.json | 11 +
scripts/build/packages/prettier.js | 4 +
src/language-markdown/clean.js | 12 +-
src/language-markdown/embed.js | 4 +-
src/language-markdown/parse/index.js | 3 +-
.../parse/micromark/mdast-util-gfm.js | 33 +
.../micromark-extension-html-text.js | 812 ++++++++++++
.../micromark/micromark-extension-liquid.js | 112 ++
src/language-markdown/parse/parse-markdown.js | 58 +
.../parse/{parse.js => parse-mdx.js} | 38 +-
src/language-markdown/print/children.js | 87 +-
src/language-markdown/print/heading.js | 31 +
src/language-markdown/print/ignored.js | 35 +
src/language-markdown/print/index.js | 1 +
src/language-markdown/print/list.js | 129 +-
src/language-markdown/print/mdast.js | 90 +-
src/language-markdown/print/preprocess.js | 356 ++++-
src/language-markdown/print/table.js | 21 +-
src/language-markdown/print/whitespace.js | 24 +-
src/language-markdown/print/word.js | 98 +-
src/language-markdown/printers.js | 3 +-
src/language-markdown/utilities.js | 19 +-
src/main/front-matter/parse.js | 8 +-
tests/config/run-format-test.js | 3 +-
.../__snapshots__/format.test.js.snap | 350 ++---
.../__snapshots__/format.test.js.snap | 291 ++++
.../markdown/blockquote/check-accidental.md | 1 +
.../markdown/blockquote/interrupt-others.md | 11 +
tests/format/markdown/blockquote/list.md | 17 +
.../break/__snapshots__/format.test.js.snap | 3 +-
.../__snapshots__/format.test.js.snap | 41 +
.../markdown/break/list-item/format.test.js | 2 +
.../markdown/break/list-item/list-item.md | 4 +
.../code/__snapshots__/format.test.js.snap | 5 +-
.../__snapshots__/format.test.js.snap | 20 +-
.../__snapshots__/format.test.js.snap | 475 ++++---
.../commonmark-test-suite/format.test.js | 7 -
.../__snapshots__/format.test.js.snap | 14 +-
tests/format/markdown/emphasis/special.md | 4 +-
.../__snapshots__/format.test.js.snap | 43 +-
.../markdown/gfm-test-suite/format.test.js | 2 +-
.../heading/__snapshots__/format.test.js.snap | 21 -
.../setext/__snapshots__/format.test.js.snap | 185 +++
tests/format/markdown/heading/setext/child.md | 10 +
.../heading/setext/definition-before.md | 11 +
.../markdown/heading/setext/format.test.js | 30 +
.../markdown/heading/setext/issue-6013-2.md | 3 +
.../markdown/heading/setext/issue-6013.md | 7 +
.../markdown/heading/{ => setext}/setext.md | 0
.../html/__snapshots__/format.test.js.snap | 882 ++++++++++++
tests/format/markdown/html/format.test.js | 2 +
tests/format/markdown/html/inline-html.md | 28 +
tests/format/markdown/html/inline-vs-block.md | 2 +
.../markdown/html/multiline-attribute.md | 33 +
.../image/__snapshots__/format.test.js.snap | 49 +
tests/format/markdown/image/alt.md | 17 +
.../link/__snapshots__/format.test.js.snap | 47 +-
tests/format/markdown/link/escape-in-link.md | 1 +
.../__snapshots__/format.test.js.snap | 63 +-
.../__snapshots__/format.test.js.snap | 8 +
.../case-and-space/case-and-space.md | 4 +
tests/format/markdown/linkReference/cjk.md | 2 +
.../liquid/__snapshots__/format.test.js.snap | 6 +-
.../list/__snapshots__/format.test.js.snap | 1179 ++++++++++++++++-
.../list/followed-by-indented-things.md | 127 ++
.../__snapshots__/format.test.js.snap | 37 +
.../markdown/list/task-list/format.test.js | 1 +
.../format/markdown/list/task-list/in-html.md | 11 +
.../__snapshots__/format.test.js.snap | 12 +-
.../math/__snapshots__/format.test.js.snap | 5 +-
.../__snapshots__/format.test.js.snap | 6 +-
.../__snapshots__/format.test.js.snap | 8 +-
tests/format/markdown/splitCjkText/link.md | 2 +
.../table/__snapshots__/format.test.js.snap | 18 +
tests/format/markdown/table/escape.md | 9 +
.../__snapshots__/format.test.js.snap | 547 +++++++-
tests/format/markdown/wiki-link/multi-line.md | 66 +
.../word/__snapshots__/format.test.js.snap | 4 +-
yarn.lock | 757 ++++++++++-
84 files changed, 6944 insertions(+), 596 deletions(-)
create mode 100644 changelog_unreleased/markdown/18277.md
create mode 100644 changelog_unreleased/markdown/18473.md
create mode 100644 src/language-markdown/parse/micromark/mdast-util-gfm.js
create mode 100644 src/language-markdown/parse/micromark/micromark-extension-html-text.js
create mode 100644 src/language-markdown/parse/micromark/micromark-extension-liquid.js
create mode 100644 src/language-markdown/parse/parse-markdown.js
rename src/language-markdown/parse/{parse.js => parse-mdx.js} (60%)
create mode 100644 src/language-markdown/print/heading.js
create mode 100644 src/language-markdown/print/ignored.js
create mode 100644 tests/format/markdown/blockquote/check-accidental.md
create mode 100644 tests/format/markdown/blockquote/interrupt-others.md
create mode 100644 tests/format/markdown/blockquote/list.md
create mode 100644 tests/format/markdown/break/list-item/__snapshots__/format.test.js.snap
create mode 100644 tests/format/markdown/break/list-item/format.test.js
create mode 100644 tests/format/markdown/break/list-item/list-item.md
create mode 100644 tests/format/markdown/heading/setext/__snapshots__/format.test.js.snap
create mode 100644 tests/format/markdown/heading/setext/child.md
create mode 100644 tests/format/markdown/heading/setext/definition-before.md
create mode 100644 tests/format/markdown/heading/setext/format.test.js
create mode 100644 tests/format/markdown/heading/setext/issue-6013-2.md
create mode 100644 tests/format/markdown/heading/setext/issue-6013.md
rename tests/format/markdown/heading/{ => setext}/setext.md (100%)
create mode 100644 tests/format/markdown/html/inline-html.md
create mode 100644 tests/format/markdown/html/inline-vs-block.md
create mode 100644 tests/format/markdown/html/multiline-attribute.md
create mode 100644 tests/format/markdown/image/alt.md
create mode 100644 tests/format/markdown/link/escape-in-link.md
create mode 100644 tests/format/markdown/list/followed-by-indented-things.md
create mode 100644 tests/format/markdown/list/task-list/__snapshots__/format.test.js.snap
create mode 100644 tests/format/markdown/list/task-list/format.test.js
create mode 100644 tests/format/markdown/list/task-list/in-html.md
diff --git a/.github/renovate.json5 b/.github/renovate.json5
index 781717cc7..2cdc58bc7 100644
--- a/.github/renovate.json5
+++ b/.github/renovate.json5
@@ -75,9 +75,13 @@
matchManagers: ["github-actions"],
},
{
- groupName: "docusaurus",
+ groupName: "Docusaurus",
matchPackageNames: ["@docusaurus/*"],
},
+ {
+ groupName: "Markdown dependencies",
+ matchPackageNames: ["micromark-*", "mdast-", "remark-", "unified"],
+ },
],
ignoreDeps: [
// It's a dependency of `remark-parse`, use same version to reduce size
diff --git a/changelog_unreleased/markdown/18277.md b/changelog_unreleased/markdown/18277.md
new file mode 100644
index 000000000..6abef72af
--- /dev/null
+++ b/changelog_unreleased/markdown/18277.md
@@ -0,0 +1,5 @@
+#### [HIGHLIGHT] Upgrade parser to latest micromark (#18277 by @seiyab, @j-f1, @fisker)
+
+We've upgraded Prettier's Markdown parser from the outdated remark-parse v8 to the modern micromark v4. This upgrade significantly enhances CommonMark and GFM compliance, resolves numerous long-standing parsing bugs, and lays a stronger foundation for future enhancements.
+
+A huge thank you to @seiyab for their tremendous effort in driving this major upgrade!
diff --git a/changelog_unreleased/markdown/18473.md b/changelog_unreleased/markdown/18473.md
new file mode 100644
index 000000000..0b697d4bf
--- /dev/null
+++ b/changelog_unreleased/markdown/18473.md
@@ -0,0 +1,39 @@
+#### Support setext headings (#18473 by @fisker)
+
+
+```md
+
+Setext Heading 1
+================
+
+Setext Heading 2
+----------------
+
+Multiline
+Setext
+Heading
+-------
+
+
+# Setext Heading 1
+
+## Setext Heading 2
+
+Multiline
+Setext
+Heading
+
+---
+
+
+Setext Heading 1
+================
+
+Setext Heading 2
+----------------
+
+Multiline
+Setext
+Heading
+-------
+```
diff --git a/cspell.json b/cspell.json
index bb540d307..856d5e60e 100644
--- a/cspell.json
+++ b/cspell.json
@@ -153,8 +153,8 @@
"llms",
"lydell",
"Marek",
- "marko",
"Mariusz",
+ "marko",
"Masad",
"Matejka",
"Mateusz",
@@ -162,6 +162,7 @@
"Memberish",
"meriyah",
"Michał",
+ "micromark",
"Microsyntax",
"Mikael",
"minimise",
@@ -231,6 +232,8 @@
"sbdchd",
"scandir",
"sdbm",
+ "seiyab",
+ "Setext",
"setlocal",
"setq",
"shellsession",
diff --git a/jest.config.js b/jest.config.js
index 49fbbb8a7..9849f485e 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -84,6 +84,9 @@ const config = {
"/tests/integration/integration-test-setup.js",
],
runner: "jest-light-runner/child-process",
+ testEnvironmentOptions: {
+ customExportConditions: ["development"],
+ },
snapshotSerializers: [
"jest-snapshot-serializer-raw",
"jest-snapshot-serializer-ansi",
diff --git a/package.json b/package.json
index 7808baec3..258b4b355 100644
--- a/package.json
+++ b/package.json
@@ -88,7 +88,18 @@
"json5": "2.2.3",
"leven": "4.1.0",
"linguist-languages": "9.1.11",
+ "mdast-util-from-markdown": "2.0.2",
+ "mdast-util-gfm": "3.1.0",
+ "mdast-util-math": "3.0.0",
+ "mdast-util-wiki-link": "0.1.2",
"meriyah": "7.0.0",
+ "micromark-extension-gfm": "3.0.0",
+ "micromark-extension-math": "3.1.0",
+ "micromark-extension-wiki-link": "0.0.4",
+ "micromark-factory-space": "2.0.1",
+ "micromark-util-character": "2.1.1",
+ "micromark-util-symbol": "2.0.1",
+ "micromark-util-types": "2.0.2",
"micromatch": "4.0.8",
"minimist": "1.2.8",
"n-readlines": "3.4.0",
diff --git a/scripts/build/packages/prettier.js b/scripts/build/packages/prettier.js
index 080205dfe..9c4ac206e 100644
--- a/scripts/build/packages/prettier.js
+++ b/scripts/build/packages/prettier.js
@@ -725,6 +725,10 @@ const pluginFiles = [
{
input: "src/plugins/markdown.js",
replaceModule: [
+ {
+ module: getPackageFile("decode-named-character-reference/index.dom.js"),
+ path: getPackageFile("decode-named-character-reference"),
+ },
{
module: getPackageFile("parse-entities/decode-entity.browser.js"),
path: getPackageFile("parse-entities/decode-entity.js"),
diff --git a/src/language-markdown/clean.js b/src/language-markdown/clean.js
index 031283dd4..a3a0d1ee1 100644
--- a/src/language-markdown/clean.js
+++ b/src/language-markdown/clean.js
@@ -35,10 +35,6 @@ function clean(original, cloned, parent) {
cloned.value = original.value.replaceAll("\n", " ");
}
- if (original.type === "wikiLink") {
- cloned.value = original.value.trim().replaceAll(/[\t\n]+/g, " ");
- }
-
if (
original.type === "definition" ||
original.type === "linkReference" ||
@@ -47,6 +43,14 @@ function clean(original, cloned, parent) {
cloned.label = collapseWhiteSpace(original.label);
}
+ // Maybe we should fix this
+ if (
+ original.type === "imageReference" &&
+ original.referenceType === "collapsed"
+ ) {
+ cloned.alt = collapseWhiteSpace(original.alt);
+ }
+
if (
(original.type === "link" || original.type === "image") &&
original.url &&
diff --git a/src/language-markdown/embed.js b/src/language-markdown/embed.js
index 19cbe6f19..7e0d8aea8 100644
--- a/src/language-markdown/embed.js
+++ b/src/language-markdown/embed.js
@@ -41,7 +41,9 @@ function embed(path, options) {
}
const doc = await textToDoc(
- getFencedCodeBlockValue(node, options.originalText),
+ options.parser === "mdx"
+ ? getFencedCodeBlockValue(node, options.originalText)
+ : node.value,
textToDocOptions,
);
diff --git a/src/language-markdown/parse/index.js b/src/language-markdown/parse/index.js
index 21ae39b9a..67f8042e9 100644
--- a/src/language-markdown/parse/index.js
+++ b/src/language-markdown/parse/index.js
@@ -1 +1,2 @@
-export { parseMarkdown, parseMdx } from "./parse.js";
+export { parseMarkdown } from "./parse-markdown.js";
+export { parseMdx } from "./parse-mdx.js";
diff --git a/src/language-markdown/parse/micromark/mdast-util-gfm.js b/src/language-markdown/parse/micromark/mdast-util-gfm.js
new file mode 100644
index 000000000..616ba02e1
--- /dev/null
+++ b/src/language-markdown/parse/micromark/mdast-util-gfm.js
@@ -0,0 +1,33 @@
+// There is no way to disable autolink
+// Hackly find and replace `gfm-autolink-literal`
+// https://github.com/remarkjs/remark-gfm/issues/16#issuecomment-899046315
+
+import { gfmFromMarkdown as originalGfmFromMarkdown } from "mdast-util-gfm";
+import * as assert from "#universal/assert";
+
+/**
+@import {Extension} from "mdast-util-from-markdown";
+*/
+
+/**
+@returns {Extension[]}
+*/
+export function gfmFromMarkdown() {
+ const mdastExtensions = originalGfmFromMarkdown();
+ const autolinkExtension = mdastExtensions.find((extension) =>
+ Boolean(extension.enter.literalAutolink),
+ );
+
+ if (process.env.NODE_ENV !== "production") {
+ assert.ok(
+ autolinkExtension &&
+ Array.isArray(autolinkExtension.transforms) &&
+ autolinkExtension.transforms.length === 1,
+ );
+ }
+
+ // Prevent the autolink extension generate nodes without position
+ autolinkExtension.transforms = [];
+
+ return mdastExtensions;
+}
diff --git a/src/language-markdown/parse/micromark/micromark-extension-html-text.js b/src/language-markdown/parse/micromark/micromark-extension-html-text.js
new file mode 100644
index 000000000..e0a09be25
--- /dev/null
+++ b/src/language-markdown/parse/micromark/micromark-extension-html-text.js
@@ -0,0 +1,812 @@
+// copied from https://github.com/micromark/micromark/blob/774a70c6bae6dd94486d3385dbd9a0f14550b709/packages/micromark-core-commonmark/dev/lib/html-text.js
+// and modified to preserve whitespace inside quoted attribute values
+
+/**
+ * @import {
+ * Code,
+ * Construct,
+ * State,
+ * TokenizeContext,
+ * Tokenizer
+ * } from 'micromark-util-types'
+ */
+
+import { factorySpace } from "micromark-factory-space";
+import {
+ asciiAlpha,
+ asciiAlphanumeric,
+ markdownLineEnding,
+ markdownLineEndingOrSpace,
+ markdownSpace,
+} from "micromark-util-character";
+import { codes, constants, types } from "micromark-util-symbol";
+
+/** @type {Construct} */
+const htmlText = {
+ name: "htmlText",
+ tokenize: tokenizeHtmlText,
+ add: "before",
+};
+
+/**
+ * @this {TokenizeContext}
+ * Context.
+ * @type {Tokenizer}
+ */
+function tokenizeHtmlText(effects, ok, nok) {
+ // eslint-disable-next-line unicorn/no-this-assignment
+ const self = this;
+ /** @type {NonNullable | undefined} */
+ let marker;
+ /** @type {number} */
+ let index;
+ /** @type {State} */
+ let returnState;
+
+ return start;
+
+ /**
+ * Start of HTML (text).
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function start(code) {
+ assert(code === codes.lessThan, "expected `<`");
+ effects.enter(types.htmlText);
+ effects.enter(types.htmlTextData);
+ effects.consume(code);
+ return open;
+ }
+
+ /**
+ * After `<`, at tag name or other stuff.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * > | a c
+ * ^
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function open(code) {
+ if (code === codes.exclamationMark) {
+ effects.consume(code);
+ return declarationOpen;
+ }
+
+ if (code === codes.slash) {
+ effects.consume(code);
+ return tagCloseStart;
+ }
+
+ if (code === codes.questionMark) {
+ effects.consume(code);
+ return instruction;
+ }
+
+ // ASCII alphabetical.
+ if (asciiAlpha(code)) {
+ effects.consume(code);
+ return tagOpen;
+ }
+
+ return nok(code);
+ }
+
+ /**
+ * After ` | a c
+ * ^
+ * > | a c
+ * ^
+ * > | a &<]]> c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function declarationOpen(code) {
+ if (code === codes.dash) {
+ effects.consume(code);
+ return commentOpenInside;
+ }
+
+ if (code === codes.leftSquareBracket) {
+ effects.consume(code);
+ index = 0;
+ return cdataOpenInside;
+ }
+
+ if (asciiAlpha(code)) {
+ effects.consume(code);
+ return declaration;
+ }
+
+ return nok(code);
+ }
+
+ /**
+ * In a comment, after ` | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function commentOpenInside(code) {
+ if (code === codes.dash) {
+ effects.consume(code);
+ return commentEnd;
+ }
+
+ return nok(code);
+ }
+
+ /**
+ * In comment.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function comment(code) {
+ if (code === codes.eof) {
+ return nok(code);
+ }
+
+ if (code === codes.dash) {
+ effects.consume(code);
+ return commentClose;
+ }
+
+ if (markdownLineEnding(code)) {
+ returnState = comment;
+ return lineEndingBefore(code);
+ }
+
+ effects.consume(code);
+ return comment;
+ }
+
+ /**
+ * In comment, after `-`.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function commentClose(code) {
+ if (code === codes.dash) {
+ effects.consume(code);
+ return commentEnd;
+ }
+
+ return comment(code);
+ }
+
+ /**
+ * In comment, after `--`.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function commentEnd(code) {
+ return code === codes.greaterThan
+ ? end(code)
+ : code === codes.dash
+ ? commentClose(code)
+ : comment(code);
+ }
+
+ /**
+ * After ` | a &<]]> b
+ * ^^^^^^
+ * ```
+ *
+ * @type {State}
+ */
+ function cdataOpenInside(code) {
+ const value = constants.cdataOpeningString;
+
+ if (code === value.charCodeAt(index++)) {
+ effects.consume(code);
+ return index === value.length ? cdata : cdataOpenInside;
+ }
+
+ return nok(code);
+ }
+
+ /**
+ * In CDATA.
+ *
+ * ```markdown
+ * > | a &<]]> b
+ * ^^^
+ * ```
+ *
+ * @type {State}
+ */
+ function cdata(code) {
+ if (code === codes.eof) {
+ return nok(code);
+ }
+
+ if (code === codes.rightSquareBracket) {
+ effects.consume(code);
+ return cdataClose;
+ }
+
+ if (markdownLineEnding(code)) {
+ returnState = cdata;
+ return lineEndingBefore(code);
+ }
+
+ effects.consume(code);
+ return cdata;
+ }
+
+ /**
+ * In CDATA, after `]`, at another `]`.
+ *
+ * ```markdown
+ * > | a &<]]> b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function cdataClose(code) {
+ if (code === codes.rightSquareBracket) {
+ effects.consume(code);
+ return cdataEnd;
+ }
+
+ return cdata(code);
+ }
+
+ /**
+ * In CDATA, after `]]`, at `>`.
+ *
+ * ```markdown
+ * > | a &<]]> b
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function cdataEnd(code) {
+ if (code === codes.greaterThan) {
+ return end(code);
+ }
+
+ if (code === codes.rightSquareBracket) {
+ effects.consume(code);
+ return cdataEnd;
+ }
+
+ return cdata(code);
+ }
+
+ /**
+ * In declaration.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function declaration(code) {
+ if (code === codes.eof || code === codes.greaterThan) {
+ return end(code);
+ }
+
+ if (markdownLineEnding(code)) {
+ returnState = declaration;
+ return lineEndingBefore(code);
+ }
+
+ effects.consume(code);
+ return declaration;
+ }
+
+ /**
+ * In instruction.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function instruction(code) {
+ if (code === codes.eof) {
+ return nok(code);
+ }
+
+ if (code === codes.questionMark) {
+ effects.consume(code);
+ return instructionClose;
+ }
+
+ if (markdownLineEnding(code)) {
+ returnState = instruction;
+ return lineEndingBefore(code);
+ }
+
+ effects.consume(code);
+ return instruction;
+ }
+
+ /**
+ * In instruction, after `?`, at `>`.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function instructionClose(code) {
+ return code === codes.greaterThan ? end(code) : instruction(code);
+ }
+
+ /**
+ * After ``, in closing tag, at tag name.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagCloseStart(code) {
+ // ASCII alphabetical.
+ if (asciiAlpha(code)) {
+ effects.consume(code);
+ return tagClose;
+ }
+
+ return nok(code);
+ }
+
+ /**
+ * After ` | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagClose(code) {
+ // ASCII alphanumerical and `-`.
+ if (code === codes.dash || asciiAlphanumeric(code)) {
+ effects.consume(code);
+ return tagClose;
+ }
+
+ return tagCloseBetween(code);
+ }
+
+ /**
+ * In closing tag, after tag name.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagCloseBetween(code) {
+ if (markdownLineEnding(code)) {
+ returnState = tagCloseBetween;
+ return lineEndingBefore(code);
+ }
+
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return tagCloseBetween;
+ }
+
+ return end(code);
+ }
+
+ /**
+ * After ` | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpen(code) {
+ // ASCII alphanumerical and `-`.
+ if (code === codes.dash || asciiAlphanumeric(code)) {
+ effects.consume(code);
+ return tagOpen;
+ }
+
+ if (
+ code === codes.slash ||
+ code === codes.greaterThan ||
+ markdownLineEndingOrSpace(code)
+ ) {
+ return tagOpenBetween(code);
+ }
+
+ return nok(code);
+ }
+
+ /**
+ * In opening tag, after tag name.
+ *
+ * ```markdown
+ * > | a c
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenBetween(code) {
+ if (code === codes.slash) {
+ effects.consume(code);
+ return end;
+ }
+
+ // ASCII alphabetical and `:` and `_`.
+ if (code === codes.colon || code === codes.underscore || asciiAlpha(code)) {
+ effects.consume(code);
+ return tagOpenAttributeName;
+ }
+
+ if (markdownLineEnding(code)) {
+ returnState = tagOpenBetween;
+ return lineEndingBefore(code);
+ }
+
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return tagOpenBetween;
+ }
+
+ return end(code);
+ }
+
+ /**
+ * In attribute name.
+ *
+ * ```markdown
+ * > | a d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeName(code) {
+ // ASCII alphabetical and `-`, `.`, `:`, and `_`.
+ if (
+ code === codes.dash ||
+ code === codes.dot ||
+ code === codes.colon ||
+ code === codes.underscore ||
+ asciiAlphanumeric(code)
+ ) {
+ effects.consume(code);
+ return tagOpenAttributeName;
+ }
+
+ return tagOpenAttributeNameAfter(code);
+ }
+
+ /**
+ * After attribute name, before initializer, the end of the tag, or
+ * whitespace.
+ *
+ * ```markdown
+ * > | a d
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeNameAfter(code) {
+ if (code === codes.equalsTo) {
+ effects.consume(code);
+ return tagOpenAttributeValueBefore;
+ }
+
+ if (markdownLineEnding(code)) {
+ returnState = tagOpenAttributeNameAfter;
+ return lineEndingBefore(code);
+ }
+
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return tagOpenAttributeNameAfter;
+ }
+
+ return tagOpenBetween(code);
+ }
+
+ /**
+ * Before unquoted, double quoted, or single quoted attribute value, allowing
+ * whitespace.
+ *
+ * ```markdown
+ * > | a e
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeValueBefore(code) {
+ if (
+ code === codes.eof ||
+ code === codes.lessThan ||
+ code === codes.equalsTo ||
+ code === codes.greaterThan ||
+ code === codes.graveAccent
+ ) {
+ return nok(code);
+ }
+
+ if (code === codes.quotationMark || code === codes.apostrophe) {
+ effects.consume(code);
+ marker = code;
+ return tagOpenAttributeValueQuoted;
+ }
+
+ if (markdownLineEnding(code)) {
+ returnState = tagOpenAttributeValueBefore;
+ return lineEndingBefore(code);
+ }
+
+ if (markdownSpace(code)) {
+ effects.consume(code);
+ return tagOpenAttributeValueBefore;
+ }
+
+ effects.consume(code);
+ return tagOpenAttributeValueUnquoted;
+ }
+
+ /**
+ * In double or single quoted attribute value.
+ *
+ * ```markdown
+ * > | a e
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeValueQuoted(code) {
+ if (code === marker) {
+ effects.consume(code);
+ marker = undefined;
+ return tagOpenAttributeValueQuotedAfter;
+ }
+
+ if (code === codes.eof) {
+ return nok(code);
+ }
+
+ if (markdownLineEnding(code)) {
+ returnState = tagOpenAttributeValueQuoted;
+ return lineEndingBefore(code);
+ }
+
+ effects.consume(code);
+ return tagOpenAttributeValueQuoted;
+ }
+
+ /**
+ * In unquoted attribute value.
+ *
+ * ```markdown
+ * > | a e
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeValueUnquoted(code) {
+ if (
+ code === codes.eof ||
+ code === codes.quotationMark ||
+ code === codes.apostrophe ||
+ code === codes.lessThan ||
+ code === codes.equalsTo ||
+ code === codes.graveAccent
+ ) {
+ return nok(code);
+ }
+
+ if (
+ code === codes.slash ||
+ code === codes.greaterThan ||
+ markdownLineEndingOrSpace(code)
+ ) {
+ return tagOpenBetween(code);
+ }
+
+ effects.consume(code);
+ return tagOpenAttributeValueUnquoted;
+ }
+
+ /**
+ * After double or single quoted attribute value, before whitespace or the end
+ * of the tag.
+ *
+ * ```markdown
+ * > | a e
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function tagOpenAttributeValueQuotedAfter(code) {
+ if (
+ code === codes.slash ||
+ code === codes.greaterThan ||
+ markdownLineEndingOrSpace(code)
+ ) {
+ return tagOpenBetween(code);
+ }
+
+ return nok(code);
+ }
+
+ /**
+ * In certain circumstances of a tag where only an `>` is allowed.
+ *
+ * ```markdown
+ * > | a e
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function end(code) {
+ if (code === codes.greaterThan) {
+ effects.consume(code);
+ effects.exit(types.htmlTextData);
+ effects.exit(types.htmlText);
+ return ok;
+ }
+
+ return nok(code);
+ }
+
+ /**
+ * At eol.
+ *
+ * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about
+ * > empty tokens.
+ *
+ * ```markdown
+ * > | a
+ * ```
+ *
+ * @type {State}
+ */
+ function lineEndingBefore(code) {
+ assert(returnState, "expected return state");
+ assert(markdownLineEnding(code), "expected eol");
+ effects.exit(types.htmlTextData);
+ effects.enter(types.lineEnding);
+ effects.consume(code);
+ effects.exit(types.lineEnding);
+ return lineEndingAfter;
+ }
+
+ /**
+ * After eol, at optional whitespace.
+ *
+ * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about
+ * > empty tokens.
+ *
+ * ```markdown
+ * | a
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function lineEndingAfter(code) {
+ // Always populated by defaults.
+ assert(
+ self.parser.constructs.disable.null,
+ "expected `disable.null` to be populated",
+ );
+
+ if (!markdownSpace(code)) {
+ return lineEndingAfterPrefix(code);
+ }
+
+ if (marker === codes.quotationMark || marker === codes.apostrophe) {
+ return lineEndingAfterPrefix(code);
+ }
+
+ return factorySpace(
+ effects,
+ lineEndingAfterPrefix,
+ types.linePrefix,
+ self.parser.constructs.disable.null.includes("codeIndented")
+ ? undefined
+ : constants.tabSize,
+ )(code);
+ }
+
+ /**
+ * After eol, after optional whitespace.
+ *
+ * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about
+ * > empty tokens.
+ *
+ * ```markdown
+ * | a
+ * ^
+ * ```
+ *
+ * @type {State}
+ */
+ function lineEndingAfterPrefix(code) {
+ effects.enter(types.htmlTextData);
+ return returnState(code);
+ }
+}
+
+function overrideHtmlTextSyntax() {
+ return {
+ text: {
+ [codes.lessThan]: htmlText,
+ },
+ };
+}
+
+// eslint-disable-next-line no-unused-vars
+function assert(..._args) {
+ // Do nothing in Prettier
+}
+
+export { overrideHtmlTextSyntax };
diff --git a/src/language-markdown/parse/micromark/micromark-extension-liquid.js b/src/language-markdown/parse/micromark/micromark-extension-liquid.js
new file mode 100644
index 000000000..8d2db09f5
--- /dev/null
+++ b/src/language-markdown/parse/micromark/micromark-extension-liquid.js
@@ -0,0 +1,112 @@
+import { markdownLineEnding } from "micromark-util-character";
+import { codes, types } from "micromark-util-symbol";
+
+/**
+ * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension
+ * @typedef {import('mdast-util-from-markdown').Token} Token
+ * @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext
+ * @typedef {import('mdast-util-from-markdown').Handle} Handle
+ * @typedef {import('micromark-util-types').State} State
+ */
+
+const nodeType = "liquidNode";
+
+/**
+ * @returns {FromMarkdownExtension}
+ */
+function liquidFromMarkdown() {
+ return {
+ canContainEols: [nodeType],
+ enter: { [nodeType]: enterInlineMath },
+ exit: { [nodeType]: exitInlineMath },
+ };
+
+ /** @type {Handle} */
+ function enterInlineMath(token) {
+ this.enter(
+ // @ts-expect-error
+ { type: nodeType },
+ token,
+ );
+ this.buffer();
+ }
+
+ /** @type {Handle} */
+ function exitInlineMath(token) {
+ const d = this.resume();
+ /** @type {any} */
+ const node = this.stack.at(-1);
+ node.value = d;
+ this.exit(token);
+ }
+}
+
+/**
+ * @returns {import('micromark-util-types').Extension}
+ */
+function liquidSyntax() {
+ return {
+ text: {
+ [codes.leftCurlyBrace]: {
+ name: "liquid",
+ tokenize: liquidTokenize,
+ },
+ },
+ };
+
+ function liquidTokenize(effects, ok, nok) {
+ return start;
+
+ /** @type {State} */
+ function start(code) {
+ effects.enter("liquidNode");
+ effects.enter(types.data);
+ effects.consume(code);
+ return function (code) {
+ switch (code) {
+ case codes.percentSign:
+ case codes.leftCurlyBrace:
+ effects.consume(code);
+ return inside;
+ default:
+ return nok;
+ }
+ };
+ }
+
+ /** @type {State} */
+ function inside(code) {
+ switch (code) {
+ case codes.percentSign:
+ case codes.rightCurlyBrace:
+ effects.consume(code);
+ return mayExit;
+ case codes.eof:
+ return nok;
+ default:
+ if (markdownLineEnding(code)) {
+ effects.enter(types.lineEnding);
+ effects.consume(code);
+ effects.exit(types.lineEnding);
+ return inside;
+ }
+ effects.consume(code);
+ return inside;
+ }
+ }
+
+ /** @type {State} */
+ function mayExit(code) {
+ if (code !== codes.rightCurlyBrace) {
+ effects.consume(code);
+ return inside;
+ }
+ effects.consume(code);
+ effects.exit(types.data);
+ effects.exit(nodeType);
+ return ok;
+ }
+ }
+}
+
+export { liquidFromMarkdown, liquidSyntax };
diff --git a/src/language-markdown/parse/parse-markdown.js b/src/language-markdown/parse/parse-markdown.js
new file mode 100644
index 000000000..78fb6412d
--- /dev/null
+++ b/src/language-markdown/parse/parse-markdown.js
@@ -0,0 +1,58 @@
+import { fromMarkdown } from "mdast-util-from-markdown";
+import { mathFromMarkdown } from "mdast-util-math";
+import { fromMarkdown as wikiLinkFromMarkdown } from "mdast-util-wiki-link";
+import { gfm as gfmSyntax } from "micromark-extension-gfm";
+import { math as mathSyntax } from "micromark-extension-math";
+import { syntax as wikiLinkSyntax } from "micromark-extension-wiki-link";
+import parseFrontMatter from "../../main/front-matter/parse.js";
+import { gfmFromMarkdown } from "./micromark/mdast-util-gfm.js";
+import { overrideHtmlTextSyntax } from "./micromark/micromark-extension-html-text.js";
+import {
+ liquidFromMarkdown,
+ liquidSyntax,
+} from "./micromark/micromark-extension-liquid.js";
+
+let markdownParseOptions;
+function getMarkdownParseOptions() {
+ return (markdownParseOptions ??= {
+ extensions: [
+ gfmSyntax(),
+ mathSyntax(),
+ wikiLinkSyntax(),
+ liquidSyntax(),
+ overrideHtmlTextSyntax(),
+ ],
+ mdastExtensions: [
+ gfmFromMarkdown(),
+ mathFromMarkdown(),
+ wikiLinkFromMarkdown(),
+ liquidFromMarkdown(),
+ ],
+ });
+}
+
+function parseMarkdown(text) {
+ const { frontMatter, content } = parseFrontMatter(text);
+ const ast = fromMarkdown(content, getMarkdownParseOptions());
+
+ if (frontMatter) {
+ const [start, end] = [frontMatter.start, frontMatter.end].map(
+ ({ line, column, index }) => ({
+ line,
+ column: column + 1,
+ offset: index,
+ }),
+ );
+
+ ast.children.unshift({
+ ...frontMatter,
+ // @ts-expect-error -- Expected
+ type: "frontMatter",
+ position: { start, end },
+ });
+ }
+
+ return ast;
+}
+
+export { parseMarkdown };
diff --git a/src/language-markdown/parse/parse.js b/src/language-markdown/parse/parse-mdx.js
similarity index 60%
rename from src/language-markdown/parse/parse.js
rename to src/language-markdown/parse/parse-mdx.js
index 193da46fd..38cff8d44 100644
--- a/src/language-markdown/parse/parse.js
+++ b/src/language-markdown/parse/parse-mdx.js
@@ -22,27 +22,21 @@ import wikiLink from "./unified-plugins/wiki-link.js";
* interface Sentence { children: Array }
* interface InlineCode { children: Array }
*/
-function createParse({ isMDX }) {
- return (text) => {
- const processor = unified()
- .use(remarkParse, {
- commonmark: true,
- ...(isMDX && { blocks: [BLOCKS_REGEX] }),
- })
- .use(footnotes)
- .use(frontMatter)
- .use(remarkMath)
- .use(isMDX ? esSyntax : noop)
- .use(liquid)
- .use(isMDX ? htmlToJsx : noop)
- .use(wikiLink);
- return processor.run(processor.parse(text));
- };
+
+function parseMdx(text) {
+ const processor = unified()
+ .use(remarkParse, {
+ commonmark: true,
+ blocks: [BLOCKS_REGEX],
+ })
+ .use(footnotes)
+ .use(frontMatter)
+ .use(remarkMath)
+ .use(esSyntax)
+ .use(liquid)
+ .use(htmlToJsx)
+ .use(wikiLink);
+ return processor.run(processor.parse(text));
}
-function noop() {}
-
-const parseMarkdown = /* @__PURE__ */ createParse({ isMDX: false });
-const parseMdx = /* @__PURE__ */ createParse({ isMDX: true });
-
-export { parseMarkdown, parseMdx };
+export { parseMdx };
diff --git a/src/language-markdown/print/children.js b/src/language-markdown/print/children.js
index daaa5e0a3..4cf826c88 100644
--- a/src/language-markdown/print/children.js
+++ b/src/language-markdown/print/children.js
@@ -3,6 +3,7 @@ import {
INLINE_NODE_TYPES,
INLINE_NODE_WRAPPER_TYPES,
isPrettierIgnore,
+ isSetextHeading,
} from "../utilities.js";
/**
@@ -58,26 +59,62 @@ function shouldPrePrintHardline({ node, parent }) {
const SIBLING_NODE_TYPES = new Set(["listItem", "definition"]);
-function shouldPrePrintDoubleHardline({ node, previous, parent }, options) {
- if (
- isLooseListItem(previous, options) ||
- (node.type === "list" &&
- parent.type === "listItem" &&
- previous.type === "code")
- ) {
- return true;
+/**
+ * @param {AstPath} path
+ * @returns {boolean}
+ */
+function shouldPrePrintDoubleHardline(path, options) {
+ const { node, previous, parent } = path;
+
+ if (options.parser === "mdx") {
+ if (
+ isLooseListItemLegacy(previous, options) ||
+ (node.type === "list" &&
+ parent.type === "listItem" &&
+ previous.type === "code")
+ ) {
+ return true;
+ }
+ } else {
+ if (
+ isSetextHeading(node) &&
+ node.position.start.line < previous.position.end.line
+ ) {
+ return false;
+ }
+
+ if (
+ isPreviousNodeLooseListItem(path) ||
+ (node.type === "list" &&
+ parent.type === "listItem" &&
+ previous.type === "code")
+ ) {
+ return true;
+ }
}
const isSequence = previous.type === node.type;
const isSiblingNode = isSequence && SIBLING_NODE_TYPES.has(node.type);
- const isInTightListItem =
- parent.type === "listItem" &&
- (node.type === "list" || !isLooseListItem(parent, options));
+ let isInTightListItem;
+ if (options.parser === "mdx") {
+ isInTightListItem =
+ parent.type === "listItem" &&
+ (node.type === "list" || !isLooseListItemLegacy(parent, options));
+ } else {
+ isInTightListItem =
+ parent.type === "listItem" &&
+ (node.type === "list" || !path.callParent(isLooseListItem));
+ }
const isPrevNodePrettierIgnore = isPrettierIgnore(previous) === "next";
const isBlockHtmlWithoutBlankLineBetweenPrevHtml =
node.type === "html" &&
previous.type === "html" &&
previous.position.end.line + 1 === node.position.start.line;
+ const isBlockHtmlWithoutBlankLineBetweenPrevParagraph =
+ options.parser !== "mdx" &&
+ node.type === "html" &&
+ previous.type === "paragraph" &&
+ previous.position.end.line + 1 === node.position.start.line;
const isHtmlDirectAfterListItem =
node.type === "html" &&
parent.type === "listItem" &&
@@ -89,6 +126,7 @@ function shouldPrePrintDoubleHardline({ node, previous, parent }, options) {
isInTightListItem ||
isPrevNodePrettierIgnore ||
isBlockHtmlWithoutBlankLineBetweenPrevHtml ||
+ isBlockHtmlWithoutBlankLineBetweenPrevParagraph ||
isHtmlDirectAfterListItem
);
}
@@ -100,7 +138,7 @@ function shouldPrePrintTripleHardline({ node, previous }) {
return isPrevNodeList && isIndentedCode;
}
-function isLooseListItem(node, options) {
+function isLooseListItemLegacy(node, options) {
return (
node.type === "listItem" &&
(node.spread ||
@@ -110,4 +148,29 @@ function isLooseListItem(node, options) {
);
}
+function isLooseListItem({ node, parent, next }) {
+ return (
+ node.type === "listItem" &&
+ (node.spread ||
+ (parent.type === "list" &&
+ next?.type === "listItem" &&
+ node.position.end.line + 1 < next.position.start.line))
+ );
+}
+
+/**
+ * @param {AstPath} path
+ * @returns {boolean}
+ */
+function isPreviousNodeLooseListItem(path) {
+ if (path.index === 0) {
+ return false;
+ }
+ return isLooseListItem({
+ node: path.previous,
+ parent: path.parent,
+ next: path.node,
+ });
+}
+
export { printChildren };
diff --git a/src/language-markdown/print/heading.js b/src/language-markdown/print/heading.js
new file mode 100644
index 000000000..10e75a567
--- /dev/null
+++ b/src/language-markdown/print/heading.js
@@ -0,0 +1,31 @@
+import { hardline } from "../../document/index.js";
+import { isSetextHeading } from "../utilities.js";
+import { printChildren } from "./children.js";
+
+function printAtxHeading(path, options, print) {
+ return [
+ "#".repeat(path.node.depth) + " ",
+ printChildren(path, options, print),
+ ];
+}
+
+function printSetextHeading(path, options, print) {
+ const { originalText } = options;
+ const { node } = path;
+ const end = node.position.end.offset;
+ const lineStart = originalText.lastIndexOf("\n", end - 1) + 1;
+ const lastLine = originalText.slice(lineStart, end);
+ const start = Math.max(lastLine.indexOf("="), lastLine.indexOf("-"));
+ const underline = lastLine.slice(start);
+ return [printChildren(path, options, print), hardline, underline];
+}
+
+function printHeading(path, options, print) {
+ if (options.parser !== "mdx" && isSetextHeading(path.node)) {
+ return printSetextHeading(path, options, print);
+ }
+
+ return printAtxHeading(path, options, print);
+}
+
+export { printHeading };
diff --git a/src/language-markdown/print/ignored.js b/src/language-markdown/print/ignored.js
new file mode 100644
index 000000000..99cc25666
--- /dev/null
+++ b/src/language-markdown/print/ignored.js
@@ -0,0 +1,35 @@
+/**
+ * @import AstPath from "../../common/ast-path.js";
+ * @import {Doc} from "../../document/index.js";
+ */
+
+/**
+ * @param {AstPath} path
+ * @param {*} options
+ * @returns {Doc}
+ */
+function printPrettierIgnored(path, options) {
+ const originalText = options.originalText.slice(
+ path.node.position.start.offset,
+ path.node.position.end.offset,
+ );
+
+ if (options.parser === "mdx") {
+ return originalText;
+ }
+
+ switch (path.node.type) {
+ case "list":
+ if (
+ path.findAncestor((p) => p.type === "blockquote") &&
+ options.proseWrap !== "always"
+ ) {
+ return originalText.replace(/\n>\s*$/, "");
+ }
+ return originalText;
+ default:
+ return originalText;
+ }
+}
+
+export { printPrettierIgnored };
diff --git a/src/language-markdown/print/index.js b/src/language-markdown/print/index.js
index 888d7260e..f81f4f600 100644
--- a/src/language-markdown/print/index.js
+++ b/src/language-markdown/print/index.js
@@ -1 +1,2 @@
+export { printPrettierIgnored } from "./ignored.js";
export { printMdast } from "./mdast.js";
diff --git a/src/language-markdown/print/list.js b/src/language-markdown/print/list.js
index 86ae1e663..1a56bff36 100644
--- a/src/language-markdown/print/list.js
+++ b/src/language-markdown/print/list.js
@@ -25,6 +25,8 @@ function printList(path, options, print) {
options,
);
+ const minIndent = requiredIndent(path);
+
return printChildren(path, options, print, {
processor() {
const prefix = getPrefix();
@@ -47,6 +49,129 @@ function printList(path, options, print) {
),
];
+ function getPrefix() {
+ const rawPrefix = node.ordered
+ ? (path.isFirst
+ ? node.start
+ : isGitDiffFriendlyOrderedList
+ ? 1
+ : node.start + path.index) +
+ (nthSiblingIndex % 2 === 0 ? ". " : ") ")
+ : nthSiblingIndex % 2 === 0
+ ? "- "
+ : "* ";
+
+ let prefix =
+ node.isAligned && node.ordered
+ ? alignListPrefix(rawPrefix, options)
+ : rawPrefix;
+
+ if (prefix.length >= minIndent) {
+ return prefix;
+ }
+
+ prefix = prefix.trimEnd();
+ const trailingSpaces = Math.min(minIndent - prefix.length, 4); // 5+ will cause indented code block
+ if (trailingSpaces > 0) {
+ prefix += " ".repeat(trailingSpaces);
+ }
+ const leadingSpaces = Math.min(minIndent - prefix.length, 3); // 4+ will cause indented code block
+ if (leadingSpaces > 0) {
+ prefix = " ".repeat(leadingSpaces) + prefix;
+ }
+
+ return prefix;
+ }
+ },
+ });
+}
+
+function printListItem(path, options, print, listPrefix) {
+ const { node } = path;
+ const prefix = node.checked === null ? "" : node.checked ? "[x] " : "[ ] ";
+ return [
+ prefix,
+ printChildren(path, options, print, {
+ processor({ node, isFirst }) {
+ if (
+ (isFirst && node.type !== "list") ||
+ (node.type === "code" && node.isIndented)
+ ) {
+ return align(" ".repeat(prefix.length), print());
+ }
+
+ const alignment = " ".repeat(
+ clamp(options.tabWidth - listPrefix.length, 0, 3), // 4+ will cause indented code block
+ );
+ return [alignment, align(alignment, print())];
+ },
+ }),
+ ];
+}
+
+/**
+ * If the list is followed by a indented code block, its content have to be
+ * indented deeper than the code block.
+ * @param {AstPath} path
+ * @return {number}
+ */
+function requiredIndent(path) {
+ const { node, next } = path;
+ if (node.checked === null) {
+ return 0;
+ }
+ if (!(next?.type === "code" && next.isIndented)) {
+ return 0;
+ }
+
+ const leadingSpaces = /^[ \t]*/.exec(next.value)?.[0] ?? "";
+ return (
+ 4 + // base indent of the code block
+ [...leadingSpaces].reduce(
+ (count, char) => count + (char === "\t" ? 4 : 1),
+ 0,
+ ) +
+ 1 // at least one space more than the code block
+ );
+}
+
+/**
+ * @param {AstPath} path
+ * @param {*} options
+ * @param {() => Doc} print
+ * @return {Doc}
+ */
+function printListLegacy(path, options, print) {
+ const { node } = path;
+ const nthSiblingIndex = getNthListSiblingIndex(node, path.parent);
+
+ const isGitDiffFriendlyOrderedList = hasGitDiffFriendlyOrderedList(
+ node,
+ options,
+ );
+
+ return printChildren(path, options, print, {
+ processor() {
+ const prefix = getPrefix();
+ const { node: childNode } = path;
+
+ if (
+ childNode.children.length === 2 &&
+ childNode.children[1].type === "html" &&
+ childNode.children[0].position.start.column !==
+ childNode.children[1].position.start.column
+ ) {
+ return [prefix, printListItemLegacy(path, options, print, prefix)];
+ }
+
+ return [
+ prefix,
+ align(
+ " ".repeat(prefix.length),
+ printListItemLegacy(path, options, print, prefix),
+ ),
+ ];
+
function getPrefix() {
const rawPrefix = node.ordered
? (path.isFirst
@@ -69,7 +194,7 @@ function printList(path, options, print) {
});
}
-function printListItem(path, options, print, listPrefix) {
+function printListItemLegacy(path, options, print, listPrefix) {
const { node } = path;
const prefix = node.checked === null ? "" : node.checked ? "[x] " : "[ ] ";
return [
@@ -108,4 +233,4 @@ function clamp(value, min, max) {
return Math.max(min, Math.min(value, max));
}
-export { printList };
+export { printList, printListLegacy };
diff --git a/src/language-markdown/print/mdast.js b/src/language-markdown/print/mdast.js
index 2c0050078..62cb30998 100644
--- a/src/language-markdown/print/mdast.js
+++ b/src/language-markdown/print/mdast.js
@@ -27,15 +27,17 @@ import {
splitText,
} from "../utilities.js";
import { printChildren } from "./children.js";
-import { printList } from "./list.js";
+import { printHeading } from "./heading.js";
+import { printList, printListLegacy } from "./list.js";
import { printParagraph } from "./paragraph.js";
import { printSentence } from "./sentence.js";
import { printTable } from "./table.js";
import { printWhitespace } from "./whitespace.js";
-import { printWord } from "./word.js";
+import { printWord, printWordLegacy } from "./word.js";
/**
- * @import {Doc} from "../../document/index.js"
+ * @import AstPath from "../../common/ast-path.js";
+ * @import {Doc} from "../../document/index.js";
*/
function prevOrNextWord(path) {
@@ -72,7 +74,13 @@ function printMdast(path, options, print) {
parts.push([parts.pop(), node.value]);
continue;
}
- const doc = printWhitespace(path, node.value, options.proseWrap, true);
+ const doc = printWhitespace(
+ path,
+ node.value,
+ options.proseWrap,
+ true,
+ options,
+ );
if (getDocType(doc) === DOC_TYPE_STRING) {
parts.push([parts.pop(), doc]);
continue;
@@ -95,7 +103,7 @@ function printMdast(path, options, print) {
case "sentence":
return printSentence(path, print);
case "word":
- return printWord(path);
+ return options.parser !== "mdx" ? printWord(path) : printWordLegacy(path);
case "whitespace": {
const { next } = path;
@@ -105,7 +113,7 @@ function printMdast(path, options, print) {
? "never"
: options.proseWrap;
- return printWhitespace(path, node.value, proseWrap);
+ return printWhitespace(path, node.value, proseWrap, false, options);
}
case "emphasis": {
let style;
@@ -131,10 +139,16 @@ function printMdast(path, options, print) {
case "delete":
return ["~~", printChildren(path, options, print), "~~"];
case "inlineCode": {
- const code =
+ let code =
options.proseWrap === "preserve"
? node.value
: node.value.replaceAll("\n", " ");
+ if (
+ options.parser !== "mdx" &&
+ path.hasAncestor((node) => node.type === "tableCell")
+ ) {
+ code = code.replaceAll("|", String.raw`\|`);
+ }
const backtickCount = getMinNotPresentContinuousCount(code, "`");
const backtickString = "`".repeat(backtickCount);
const padding =
@@ -188,7 +202,7 @@ function printMdast(path, options, print) {
case "image":
return [
""),
printTitle(node.title, options),
@@ -197,10 +211,7 @@ function printMdast(path, options, print) {
case "blockquote":
return ["> ", align("> ", printChildren(path, options, print))];
case "heading":
- return [
- "#".repeat(node.depth) + " ",
- printChildren(path, options, print),
- ];
+ return printHeading(path, options, print);
case "code": {
if (node.isIndented) {
// indented code block
@@ -222,7 +233,9 @@ function printMdast(path, options, print) {
node.meta ? " " + node.meta : "",
hardline,
replaceEndOfLine(
- getFencedCodeBlockValue(node, options.originalText),
+ options.parser === "mdx"
+ ? getFencedCodeBlockValue(node, options.originalText)
+ : node.value,
hardline,
),
hardline,
@@ -241,6 +254,9 @@ function printMdast(path, options, print) {
);
}
case "list":
+ if (options.parser === "mdx") {
+ return printListLegacy(path, options, print);
+ }
return printList(path, options, print);
case "thematicBreak": {
const { ancestors } = path;
@@ -265,18 +281,21 @@ function printMdast(path, options, print) {
? "[]"
: "",
];
- case "imageReference":
+ case "imageReference": {
+ const alt = printImageAlt(node, options);
+
switch (node.referenceType) {
case "full":
- return ["![", node.alt || "", "]", printLinkReference(node)];
+ return ["![", alt, "]", printLinkReference(node)];
default:
return [
- "![",
- node.alt,
- "]",
+ ...(options.parser === "mdx"
+ ? ["![", alt, "]"]
+ : ["!", printLinkReference(node)]),
node.referenceType === "collapsed" ? "[]" : "",
];
}
+ }
case "definition": {
const lineOrSpace = options.proseWrap === "always" ? line : " ";
return group([
@@ -284,7 +303,9 @@ function printMdast(path, options, print) {
":",
indent([
lineOrSpace,
- printUrl(node.url),
+ options.parser !== "mdx" && node.url === ""
+ ? "<>"
+ : printUrl(node.url),
node.title === null
? ""
: [lineOrSpace, printTitle(node.title, options, false)],
@@ -344,6 +365,7 @@ function printMdast(path, options, print) {
case "math":
return [
"$$",
+ node.meta ? " " + node.meta : "",
hardline,
node.value ? [replaceEndOfLine(node.value, hardline), hardline] : "",
"$$",
@@ -352,11 +374,12 @@ function printMdast(path, options, print) {
// remark-math trims content but we don't want to remove whitespaces
// since it's very possible that it's recognized as math accidentally
return options.originalText.slice(locStart(node), locEnd(node));
+ case "text":
+ return replaceEndOfLine(node.value, hardline);
case "frontMatter": // Handled in core
case "tableRow": // handled in "table"
case "listItem": // handled in "list"
- case "text": // handled in other types
default:
/* c8 ignore next */
throw new UnexpectedNodeError(node, "Markdown");
@@ -484,8 +507,10 @@ function printTitle(title, options, printSpace = true) {
return " " + printTitle(title, options, false);
}
- // title is escaped after `remark-parse` v7
- title = title.replaceAll(/\\(?=["')])/g, "");
+ // title is escaped before `remark-parse` v10
+ if (options.parser === "mdx") {
+ title = title.replaceAll(/\\(?=["')])/g, "");
+ }
if (title.includes('"') && title.includes("'") && !title.includes(")")) {
return `(${title})`; // avoid escaped quotes
@@ -496,14 +521,27 @@ function printTitle(title, options, printSpace = true) {
return `${quote}${title}${quote}`;
}
-// `remark-parse` lowercase the `label` as `identifier`, we don't want do that
-// https://github.com/remarkjs/remark/blob/daddcb463af2d5b2115496c395d0571c0ff87d15/packages/remark-parse/lib/tokenize/reference.js
-function printLinkReference(node) {
- return `[${collapseWhiteSpace(node.label)}]`;
+function printLinkReference(node, options) {
+ // `remark-parse` lowercase the `label` as `identifier`, we don't want do that
+ // https://github.com/remarkjs/remark/blob/daddcb463af2d5b2115496c395d0571c0ff87d15/packages/remark-parse/lib/tokenize/reference.js
+ const label = collapseWhiteSpace(node.label);
+ if (options?.parser === "mdx") {
+ return `[${label}]`;
+ }
+ const name = label.replaceAll(/[\\[\]]/g, (s) => `\\${s}`);
+ return `[${name}]`;
}
function printFootnoteReference(node) {
return `[^${node.label}]`;
}
+function printImageAlt(node, options) {
+ if (options.parser !== "mdx" && node.originalAltText) {
+ return node.originalAltText;
+ }
+
+ return node.alt || "";
+}
+
export { printMdast };
diff --git a/src/language-markdown/print/preprocess.js b/src/language-markdown/print/preprocess.js
index 4210a061f..11f8e4072 100644
--- a/src/language-markdown/print/preprocess.js
+++ b/src/language-markdown/print/preprocess.js
@@ -6,11 +6,30 @@ const isSingleCharRegex = /^\\?.$/su;
const isNewLineBlockquoteRegex = /^\n *>[ >]*$/;
function preprocess(ast, options) {
- ast = restoreUnescapedCharacter(ast, options);
+ if (options.parser === "mdx") {
+ ast = restoreUnescapedCharacter(ast, options);
+ } else {
+ ast = addRawToText(ast, options);
+ }
ast = mergeContinuousTexts(ast);
- ast = transformIndentedCodeblockAndMarkItsParentList(ast, options);
- ast = markAlignedList(ast, options);
- ast = splitTextIntoSentences(ast);
+ if (options.parser === "mdx") {
+ ast = transformIndentedCodeblockAndMarkItsParentList(ast, options);
+ } else {
+ ast = transformIndentedCodeblock(ast, options);
+ }
+ if (options.parser !== "mdx") {
+ ast = markOriginalImageAndLinkAlt(ast, options);
+ }
+ if (options.parser === "mdx") {
+ ast = markAlignedListLegacy(ast, options);
+ } else {
+ ast = markAlignedList(ast, options);
+ }
+ if (options.parser === "mdx") {
+ ast = splitTextIntoSentencesLegacy(ast);
+ } else {
+ ast = splitTextIntoSentences(ast);
+ }
return ast;
}
@@ -44,6 +63,19 @@ function restoreUnescapedCharacter(ast, options) {
});
}
+function addRawToText(ast, options) {
+ return mapAst(ast, (node) => {
+ if (node.type === "text") {
+ // https://github.com/remarkjs/remark-gfm/issues/16
+ node.raw = options.originalText.slice(
+ node.position.start.offset,
+ node.position.end.offset,
+ );
+ }
+ return node;
+ });
+}
+
function mergeChildren(ast, shouldMerge, mergeNode) {
return mapAst(ast, (node) => {
if (!node.children) {
@@ -85,7 +117,7 @@ function mergeContinuousTexts(ast) {
);
}
-function splitTextIntoSentences(ast) {
+function splitTextIntoSentencesLegacy(ast) {
return mapAst(ast, (node, index, [parentNode]) => {
if (node.type !== "text") {
return node;
@@ -112,6 +144,140 @@ function splitTextIntoSentences(ast) {
});
}
+function splitTextIntoSentences(ast) {
+ const canOpenAccidentalWikiLink = new Set();
+ const riskyParagraphPositions = new Set(); // we can't use nodes themselves because they will be cloned.
+
+ walkAst(ast, (node, parentStack) => {
+ if (node.type === "wikiLink") {
+ markAncestors(parentStack); // word wrapping can accidentally merge nodes like `[[foo\n[[wiki link]]`
+ return;
+ }
+
+ if (node.type !== "text") {
+ return;
+ }
+
+ if (node.raw.includes("[[")) {
+ for (const ancestor of parentStack) {
+ if (ancestor.type === "paragraph") {
+ canOpenAccidentalWikiLink.add(ancestor);
+ }
+ }
+ }
+
+ if (node.raw.includes("]]")) {
+ markAncestors(parentStack);
+ }
+ });
+
+ return mapAst(ast, (node, index, parentStack) => {
+ if (node.type !== "text") {
+ return node;
+ }
+
+ // NOTE: there's trade-off between using `node.value` or `node.raw` here.
+ // Using `node.raw`, we can better preserve the original text, especially escaped characters.
+ // Using `node.value`, we don't need to care about markers like `\n > ` in `blockquote`s.
+ let text = node.raw;
+
+ const paragraphIndex = parentStack.findIndex(
+ (ancestor) => ancestor?.type === "paragraph",
+ );
+
+ const paragraphNode =
+ paragraphIndex === -1 ? undefined : parentStack[paragraphIndex];
+
+ if (paragraphNode) {
+ if (
+ parentStack
+ .slice(paragraphIndex + 1)
+ .some((ancestor) => ancestor?.type === "blockquote")
+ ) {
+ text = getBlockquoteRawText(text, node);
+ }
+
+ const parentNode = parentStack[0];
+
+ if (parentNode?.type === "paragraph") {
+ if (index === 0) {
+ text = htmlWhitespace.trimStart(text);
+ }
+ if (index === parentNode.children.length - 1) {
+ text = htmlWhitespace.trimEnd(text);
+ }
+ }
+ }
+
+ if (paragraphNode && riskyParagraphPositions.has(paragraphNode.position)) {
+ return {
+ type: "text",
+ position: node.position,
+ value: text,
+ };
+ }
+
+ return {
+ type: "sentence",
+ position: node.position,
+ children: splitText(text),
+ };
+ });
+
+ function walkAst(ast, handler) {
+ return (function preorder(node, parentStack) {
+ handler(node, parentStack);
+ if (node.children) {
+ for (const child of node.children) {
+ preorder(child, [node, ...parentStack]);
+ }
+ }
+ })(ast, []);
+ }
+
+ function markAncestors(parentStack) {
+ for (const ancestor of parentStack) {
+ if (
+ ancestor.type === "paragraph" &&
+ canOpenAccidentalWikiLink.has(ancestor)
+ ) {
+ riskyParagraphPositions.add(ancestor.position);
+ }
+ }
+ }
+}
+
+function getBlockquoteRawText(text, node) {
+ const angleBracketsRegex = /^([ \t]*>[ \t]*)*/;
+ const rawLines = text.split("\n");
+ const valueLines = node.value.split("\n");
+ const resultLines = rawLines.map((rawLine, index) => {
+ const valueLine = valueLines[index] ?? "";
+ const leadingTextAngleBrackets =
+ valueLine.match(angleBracketsRegex)[0] ?? "";
+ return rawLine.replace(angleBracketsRegex, leadingTextAngleBrackets);
+ });
+ return resultLines.join("\n");
+}
+
+function transformIndentedCodeblock(ast, options) {
+ return mapAst(ast, (node) => {
+ if (node.type !== "code") {
+ return node;
+ }
+ // the first char may point to `\n`, e.g. `\n\t\tbar`, just ignore it
+ const isIndented = /^\n?(?: {4,}|\t)/.test(
+ options.originalText.slice(
+ node.position.start.offset,
+ node.position.end.offset,
+ ),
+ );
+
+ node.isIndented = isIndented;
+ return node;
+ });
+}
+
function transformIndentedCodeblockAndMarkItsParentList(ast, options) {
return mapAst(ast, (node, index, parentStack) => {
if (node.type === "code") {
@@ -144,7 +310,187 @@ function transformIndentedCodeblockAndMarkItsParentList(ast, options) {
});
}
+// remark 11 removes nested links so we need to recover the original alt text
+function markOriginalImageAndLinkAlt(ast, options) {
+ const { originalText } = options;
+ return mapAst(ast, (node) => {
+ if (node.type === "image" || node.type === "imageReference") {
+ node.originalAltText = getBracketContent(
+ originalText,
+ node.position.start.offset,
+ node.position.end.offset,
+ );
+ return node;
+ }
+
+ if (node.type !== "link" || !node.url) {
+ return node;
+ }
+
+ const originalAlt = getBracketContent(
+ originalText,
+ node.position.start.offset,
+ node.position.end.offset,
+ );
+
+ if (originalAlt && /[[\]]/.test(originalAlt)) {
+ node.originalLabelText = originalAlt;
+ }
+
+ return node;
+ });
+}
+
+function getBracketContent(text, startOffset, endOffset) {
+ const firstBracket = text.indexOf("[", startOffset);
+
+ if (firstBracket === -1 || firstBracket >= endOffset) {
+ return null;
+ }
+
+ let depth = 1;
+ let index = firstBracket + 1;
+
+ while (index < endOffset) {
+ const char = text[index];
+
+ if (char === "\\") {
+ index += 2;
+ continue;
+ }
+
+ if (char === "[") {
+ depth++;
+ } else if (char === "]") {
+ depth--;
+ if (depth === 0) {
+ return text.slice(firstBracket + 1, index);
+ }
+ }
+
+ index++;
+ }
+
+ return null;
+}
+
function markAlignedList(ast, options) {
+ return mapAst(ast, (node, index, parentStack) => {
+ if (node.type === "list" && node.children.length > 0) {
+ // if one of its parents is not aligned, it's not possible to be aligned in sub-lists
+ for (let i = 0; i < parentStack.length; i++) {
+ const parent = parentStack[i];
+ if (parent.type === "list" && !parent.isAligned) {
+ node.isAligned = false;
+ return node;
+ }
+ }
+
+ const next = parentStack[0]?.children[index + 1];
+ if (next?.type === "code" && next.isIndented) {
+ // hard to align in this case
+ node.isAligned = false;
+ return node;
+ }
+
+ node.isAligned = isAligned(node);
+ }
+
+ return node;
+ });
+
+ function getListItemStart(listItem) {
+ return listItem.children.length === 0
+ ? -1
+ : listItem.children[0].position.start.column - 1;
+ }
+
+ function isAligned(list) {
+ if (!list.ordered) {
+ /**
+ * - 123
+ * - 123
+ */
+ return true;
+ }
+
+ const [firstItem, secondItem] = list.children;
+
+ const firstInfo = getOrderedListItemInfo(firstItem, options);
+
+ if (firstInfo.leadingSpaces.length > 1) {
+ /**
+ * 1. 123
+ *
+ * 1. 123
+ * 1. 123
+ */
+ return true;
+ }
+
+ const firstStart = getListItemStart(firstItem);
+
+ if (firstStart === -1) {
+ /**
+ * 1.
+ *
+ * 1.
+ * 1.
+ */
+ return false;
+ }
+
+ if (list.children.length === 1) {
+ /**
+ * aligned:
+ *
+ * 11. 123
+ *
+ * not aligned:
+ *
+ * 1. 123
+ */
+ return firstStart % options.tabWidth === 0;
+ }
+
+ const secondStart = getListItemStart(secondItem);
+
+ if (firstStart !== secondStart) {
+ /**
+ * 11. 123
+ * 1. 123
+ *
+ * 1. 123
+ * 11. 123
+ */
+ return false;
+ }
+
+ if (firstStart % options.tabWidth === 0) {
+ /**
+ * 11. 123
+ * 12. 123
+ */
+ return true;
+ }
+
+ /**
+ * aligned:
+ *
+ * 11. 123
+ * 1. 123
+ *
+ * not aligned:
+ *
+ * 1. 123
+ * 2. 123
+ */
+ const secondInfo = getOrderedListItemInfo(secondItem, options);
+ return secondInfo.leadingSpaces.length > 1;
+ }
+}
+
+function markAlignedListLegacy(ast, options) {
return mapAst(ast, (node, index, parentStack) => {
if (node.type === "list" && node.children.length > 0) {
// if one of its parents is not aligned, it's not possible to be aligned in sub-lists
diff --git a/src/language-markdown/print/table.js b/src/language-markdown/print/table.js
index 9f1165199..2cedecc39 100644
--- a/src/language-markdown/print/table.js
+++ b/src/language-markdown/print/table.js
@@ -50,13 +50,20 @@ function printTable(path, options, print) {
}
function printAlign(isCompact) {
- return columnMaxWidths.map((width, index) => {
- const align = node.align[index];
- const first = align === "center" || align === "left" ? ":" : "-";
- const last = align === "center" || align === "right" ? ":" : "-";
- const middle = isCompact ? "-" : "-".repeat(width - 2);
- return `${first}${middle}${last}`;
- });
+ return columnMaxWidths
+ .map((width, index) => {
+ if (options.parser !== "mdx" && index >= contents[0].length) {
+ // The header row must match the delimiter row in the number of cells. If not, a table will not be recognized
+ // https://github.github.com/gfm/#example-203
+ return null;
+ }
+ const align = node.align[index];
+ const first = align === "center" || align === "left" ? ":" : "-";
+ const last = align === "center" || align === "right" ? ":" : "-";
+ const middle = isCompact ? "-" : "-".repeat(width - 2);
+ return `${first}${middle}${last}`;
+ })
+ .filter((x) => x !== null);
}
function printRow(columns, isCompact) {
diff --git a/src/language-markdown/print/whitespace.js b/src/language-markdown/print/whitespace.js
index bfa7cde7f..d588b5edb 100644
--- a/src/language-markdown/print/whitespace.js
+++ b/src/language-markdown/print/whitespace.js
@@ -1,5 +1,6 @@
import { hardline, line, softline } from "../../document/index.js";
import {
+ isSetextHeading,
KIND_CJ_LETTER,
KIND_CJK_PUNCTUATION,
KIND_K_LETTER,
@@ -15,12 +16,7 @@ import {
* `word`.
*/
-const SINGLE_LINE_NODE_TYPES = new Set([
- "heading",
- "tableCell",
- "link",
- "wikiLink",
-]);
+const SINGLE_LINE_NODE_TYPES = new Set(["tableCell", "link", "wikiLink"]);
/**
* A line break between a character from this set and CJ can be converted to a
@@ -182,10 +178,15 @@ function isNonCJKOrKoreanLetter(kind) {
* @param {boolean} isLink
* @returns {boolean}
*/
-function isBreakable(path, value, proseWrap, isLink) {
+function isBreakable(path, value, proseWrap, isLink, options) {
if (
proseWrap !== "always" ||
- path.hasAncestor((node) => SINGLE_LINE_NODE_TYPES.has(node.type))
+ path.hasAncestor(
+ (node) =>
+ SINGLE_LINE_NODE_TYPES.has(node.type) ||
+ (node.type === "heading" &&
+ (options.parser === "mdx" || !isSetextHeading(node))),
+ )
) {
return false;
}
@@ -244,10 +245,11 @@ function isBreakable(path, value, proseWrap, isLink) {
* @param {AstPath} path
* @param {WhitespaceValue} value
* @param {ProseWrap} proseWrap
- * @param {boolean} [isLink] Special mode of (un)wrapping that preserves the
+ * @param {boolean} isLink Special mode of (un)wrapping that preserves the
+ * @param {any} options Special mode of (un)wrapping that preserves the
* normalized form of link labels. https://spec.commonmark.org/0.30/#matches
*/
-function printWhitespace(path, value, proseWrap, isLink) {
+function printWhitespace(path, value, proseWrap, isLink, options) {
if (proseWrap === "preserve" && value === "\n") {
return hardline;
}
@@ -256,7 +258,7 @@ function printWhitespace(path, value, proseWrap, isLink) {
value === " " ||
(value === "\n" && lineBreakCanBeConvertedToSpace(path, isLink));
- if (isBreakable(path, value, proseWrap, isLink)) {
+ if (isBreakable(path, value, proseWrap, isLink, options)) {
return canBeSpace ? line : softline;
}
diff --git a/src/language-markdown/print/word.js b/src/language-markdown/print/word.js
index ab7b46c19..2bf7f6843 100644
--- a/src/language-markdown/print/word.js
+++ b/src/language-markdown/print/word.js
@@ -11,6 +11,102 @@ import { isAutolink } from "../utilities.js";
* @return {Doc}
*/
function printWord(path) {
+ const { node } = path;
+ const emphasisOrStrong = path.findAncestor(
+ (p) => p.type === "emphasis" || p.type === "strong",
+ );
+ if (!emphasisOrStrong) {
+ return node.value;
+ }
+ const { previous, next, grandparent } = path;
+ let text = node.value;
+
+ // escape leading `*` or `_` if it's the first character in an emphasis/strong
+ if (
+ path.isFirst &&
+ (text.startsWith("*") || text.startsWith("_")) &&
+ path.callParent(() => path.isFirst) &&
+ grandparent === emphasisOrStrong
+ ) {
+ text = `\\${text}`;
+ }
+
+ // escape internal `*` or `_` that can open or close emphasis/strong
+ text = text.replaceAll(
+ /(\\+|^|.)(\*+|_+)($|.)/g,
+ (match, preceding, delimiterRun, following) => {
+ if (
+ [...preceding].every((c) => c === "\\") &&
+ preceding.length % 2 === 1
+ ) {
+ // already escaped
+ return match;
+ }
+ if (
+ canOpenOrCloseStrongOrEmphasis(
+ preceding.at(-1) || previous?.value.at(-1),
+ delimiterRun,
+ following[0] || next?.value[0],
+ )
+ ) {
+ return `${preceding}\\${delimiterRun}${following}`;
+ }
+ return match;
+ },
+ );
+
+ return text;
+}
+
+/**
+ * @param {string | undefined} preceding
+ * @param {string} delimiterRun
+ * @param {string | undefined} following
+ * @returns {boolean | null}
+ */
+function canOpenOrCloseStrongOrEmphasis(preceding, delimiterRun, following) {
+ if (!preceding || !following) {
+ return null; // cannot determine
+ }
+
+ // https://spec.commonmark.org/0.31.2/#emphasis-and-strong-emphasis
+ const followedByWhitespace = /[\p{Space_Separator}\t\n\f\r]/u.test(following);
+ const precededByWhitespace = /[\p{Space_Separator}\t\n\f\r]/u.test(preceding);
+ const followedByPunctuation = PUNCTUATION_REGEXP.test(following);
+ const precededByPunctuation = PUNCTUATION_REGEXP.test(preceding);
+
+ const isLeftFlanking =
+ !followedByWhitespace &&
+ (!followedByPunctuation ||
+ (followedByPunctuation &&
+ (precededByWhitespace || precededByPunctuation)));
+ const isRightFlanking =
+ !precededByWhitespace &&
+ (!precededByPunctuation ||
+ (precededByPunctuation &&
+ (followedByWhitespace || followedByPunctuation)));
+
+ const indicator = delimiterRun[0];
+ if (indicator === "*") {
+ return isLeftFlanking || isRightFlanking;
+ }
+
+ if (isLeftFlanking) {
+ return !isRightFlanking || precededByPunctuation;
+ }
+
+ if (isRightFlanking) {
+ return !isLeftFlanking || followedByPunctuation;
+ }
+
+ return false;
+}
+
+/**
+ * @param {AstPath} path
+ * @return {Doc}
+ */
+function printWordLegacy(path) {
const { node } = path;
let escapedValue = node.value
.replaceAll("*", String.raw`\*`) // escape all `*`
@@ -53,4 +149,4 @@ function printWord(path) {
return escapedValue;
}
-export { printWord };
+export { printWord, printWordLegacy };
diff --git a/src/language-markdown/printers.js b/src/language-markdown/printers.js
index 8bac61a99..036f0c9b2 100644
--- a/src/language-markdown/printers.js
+++ b/src/language-markdown/printers.js
@@ -1,7 +1,7 @@
import clean from "./clean.js";
import embed from "./embed.js";
import { insertPragma } from "./pragma.js";
-import { printMdast } from "./print/index.js";
+import { printMdast, printPrettierIgnored } from "./print/index.js";
import preprocess from "./print/preprocess.js";
import getVisitorKeys from "./traverse/get-visitor-keys.js";
import { hasPrettierIgnore } from "./utilities.js";
@@ -21,6 +21,7 @@ const printer = {
hasPrettierIgnore,
insertPragma,
getVisitorKeys,
+ printPrettierIgnored,
};
export { printer as mdast };
diff --git a/src/language-markdown/utilities.js b/src/language-markdown/utilities.js
index a6f5f10b4..d5be83624 100644
--- a/src/language-markdown/utilities.js
+++ b/src/language-markdown/utilities.js
@@ -181,10 +181,19 @@ function splitText(text) {
}
function getOrderedListItemInfo(orderListItem, options) {
- const text = options.originalText.slice(
+ let text = options.originalText.slice(
orderListItem.position.start.offset,
orderListItem.position.end.offset,
);
+ if (options.parser !== "mdx") {
+ const firstChild = orderListItem.children[0];
+ if (firstChild) {
+ text = options.originalText.slice(
+ orderListItem.position.start.offset,
+ firstChild.position.start.offset,
+ );
+ }
+ }
const { numberText, leadingSpaces } = text.match(
/^\s*(?\d+)(\.|\))(?\s*)/,
@@ -218,6 +227,7 @@ function hasGitDiffFriendlyOrderedList(node, options) {
// The final new line should not include in value
// https://github.com/remarkjs/remark/issues/512
+// TODO[@fisker]: Use `node.value` directly when we update mdx to use latest remark
function getFencedCodeBlockValue(node, originalText) {
const { value } = node;
if (
@@ -248,6 +258,7 @@ function isAutolink(node) {
if (node?.type !== "link" || node.children.length !== 1) {
return false;
}
+
const [child] = node.children;
return locStart(node) === locStart(child) && locEnd(node) === locEnd(child);
}
@@ -307,6 +318,11 @@ function hasPrettierIgnore(path) {
return path.index > 0 && isPrettierIgnore(path.previous) === "next";
}
+function isSetextHeading(node) {
+ const { start, end } = node.position;
+ return start.line !== end.line;
+}
+
export {
getFencedCodeBlockValue,
getNthListSiblingIndex,
@@ -317,6 +333,7 @@ export {
INLINE_NODE_WRAPPER_TYPES,
isAutolink,
isPrettierIgnore,
+ isSetextHeading,
KIND_CJ_LETTER,
KIND_CJK_PUNCTUATION,
KIND_K_LETTER,
diff --git a/src/main/front-matter/parse.js b/src/main/front-matter/parse.js
index 2cf0bd70a..803f08e66 100644
--- a/src/main/front-matter/parse.js
+++ b/src/main/front-matter/parse.js
@@ -4,7 +4,13 @@ import { FRONT_MATTER_MARK } from "./constants.js";
const DELIMITER_LENGTH = 3;
/**
-@typedef {{index: number, line: number, column: number}} Position
+@typedef {{
+ index: number,
+ // 1-based line number
+ line: number,
+ // 0-based column number
+ column: number,
+}} Position
@typedef {{
language: string,
explicitLanguage: string | null,
diff --git a/tests/config/run-format-test.js b/tests/config/run-format-test.js
index aac912e5c..8afb9a248 100644
--- a/tests/config/run-format-test.js
+++ b/tests/config/run-format-test.js
@@ -27,8 +27,6 @@ const unstableTests = new Map(
"js/comments/return-statement.js",
"js/comments/tagged-template-literal.js",
"js/for/9812-unstable.js",
- "markdown/spec/example-234.md",
- "markdown/spec/example-235.md",
[
"js/multiparser-markdown/codeblock.js",
(options) => options.proseWrap === "always",
@@ -362,6 +360,7 @@ async function runTest({
}) {
let formatOptions = mainParserFormatOptions;
let formatResult = mainParserFormatResult;
+ expect(formatResult).toBeDefined();
// Verify parsers or error tests
if (
diff --git a/tests/format/markdown/auto-link/__snapshots__/format.test.js.snap b/tests/format/markdown/auto-link/__snapshots__/format.test.js.snap
index 4bb900cdb..8fc974d3b 100644
--- a/tests/format/markdown/auto-link/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/auto-link/__snapshots__/format.test.js.snap
@@ -8,7 +8,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/*a *
=====================================output=====================================
-- http://www.example.com:80/*a \\*
+- http://www.example.com:80/*a *
================================================================================
`;
@@ -21,7 +21,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/*a _
=====================================output=====================================
-- http://www.example.com:80/*a \\_
+- http://www.example.com:80/*a _
================================================================================
`;
@@ -34,7 +34,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/*a* *
=====================================output=====================================
-- http://www.example.com:80/*a* \\*
+- http://www.example.com:80/*a* *
================================================================================
`;
@@ -47,7 +47,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/*a* _
=====================================output=====================================
-- http://www.example.com:80/*a* \\_
+- http://www.example.com:80/*a* _
================================================================================
`;
@@ -73,7 +73,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/*a** *
=====================================output=====================================
-- http://www.example.com:80/*a** \\*
+- http://www.example.com:80/*a** *
================================================================================
`;
@@ -86,7 +86,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/*a** _
=====================================output=====================================
-- http://www.example.com:80/*a** \\_
+- http://www.example.com:80/*a** _
================================================================================
`;
@@ -138,7 +138,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/*a*/ *
=====================================output=====================================
-- http://www.example.com:80/*a*/ \\*
+- http://www.example.com:80/*a*/ *
================================================================================
`;
@@ -151,7 +151,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/*a*/ _
=====================================output=====================================
-- http://www.example.com:80/*a*/ \\_
+- http://www.example.com:80/*a*/ _
================================================================================
`;
@@ -164,7 +164,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/*a*/* *
=====================================output=====================================
-- http://www.example.com:80/*a*/* \\*
+- http://www.example.com:80/*a*/* *
================================================================================
`;
@@ -177,7 +177,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/*a*/* _
=====================================output=====================================
-- http://www.example.com:80/*a*/* \\_
+- http://www.example.com:80/*a*/* _
================================================================================
`;
@@ -255,7 +255,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/*a*b *
=====================================output=====================================
-- http://www.example.com:80/*a*b \\*
+- http://www.example.com:80/*a*b *
================================================================================
`;
@@ -268,7 +268,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/*a*b _
=====================================output=====================================
-- http://www.example.com:80/*a*b \\_
+- http://www.example.com:80/*a*b _
================================================================================
`;
@@ -320,7 +320,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a *
=====================================output=====================================
-- http://www.example.com:80/_a \\*
+- http://www.example.com:80/_a *
================================================================================
`;
@@ -333,7 +333,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a _
=====================================output=====================================
-- http://www.example.com:80/_a \\_
+- http://www.example.com:80/_a _
================================================================================
`;
@@ -346,7 +346,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a* *
=====================================output=====================================
-- http://www.example.com:80/_a* \\*
+- http://www.example.com:80/_a* *
================================================================================
`;
@@ -359,7 +359,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a* _
=====================================output=====================================
-- http://www.example.com:80/_a* \\_
+- http://www.example.com:80/_a* _
================================================================================
`;
@@ -398,7 +398,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a*/ *
=====================================output=====================================
-- http://www.example.com:80/_a*/ \\*
+- http://www.example.com:80/_a*/ *
================================================================================
`;
@@ -411,7 +411,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a*/ _
=====================================output=====================================
-- http://www.example.com:80/_a*/ \\_
+- http://www.example.com:80/_a*/ _
================================================================================
`;
@@ -463,7 +463,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a*b *
=====================================output=====================================
-- http://www.example.com:80/_a*b \\*
+- http://www.example.com:80/_a*b *
================================================================================
`;
@@ -476,7 +476,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a*b _
=====================================output=====================================
-- http://www.example.com:80/_a*b \\_
+- http://www.example.com:80/_a*b _
================================================================================
`;
@@ -515,7 +515,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a_ *
=====================================output=====================================
-- http://www.example.com:80/_a_ \\*
+- http://www.example.com:80/_a_ *
================================================================================
`;
@@ -528,7 +528,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a_ _
=====================================output=====================================
-- http://www.example.com:80/_a_ \\_
+- http://www.example.com:80/_a_ _
================================================================================
`;
@@ -554,7 +554,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a_* *
=====================================output=====================================
-- http://www.example.com:80/_a_* \\*
+- http://www.example.com:80/_a_* *
================================================================================
`;
@@ -619,7 +619,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a_/ *
=====================================output=====================================
-- http://www.example.com:80/_a_/ \\*
+- http://www.example.com:80/_a_/ *
================================================================================
`;
@@ -632,7 +632,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a_/ _
=====================================output=====================================
-- http://www.example.com:80/_a_/ \\_
+- http://www.example.com:80/_a_/ _
================================================================================
`;
@@ -645,7 +645,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a_/* *
=====================================output=====================================
-- http://www.example.com:80/_a_/* \\*
+- http://www.example.com:80/_a_/* *
================================================================================
`;
@@ -658,7 +658,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a_/* _
=====================================output=====================================
-- http://www.example.com:80/_a_/* \\_
+- http://www.example.com:80/_a_/* _
================================================================================
`;
@@ -710,7 +710,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a_/_ *
=====================================output=====================================
-- http://www.example.com:80/_a_/_ \\*
+- http://www.example.com:80/_a_/_ *
================================================================================
`;
@@ -723,7 +723,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a_/_ _
=====================================output=====================================
-- http://www.example.com:80/_a_/_ \\_
+- http://www.example.com:80/_a_/_ _
================================================================================
`;
@@ -775,7 +775,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a__ *
=====================================output=====================================
-- http://www.example.com:80/_a__ \\*
+- http://www.example.com:80/_a__ *
================================================================================
`;
@@ -788,7 +788,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a__ _
=====================================output=====================================
-- http://www.example.com:80/_a__ \\_
+- http://www.example.com:80/_a__ _
================================================================================
`;
@@ -840,7 +840,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a_b *
=====================================output=====================================
-- http://www.example.com:80/_a_b \\*
+- http://www.example.com:80/_a_b *
================================================================================
`;
@@ -853,7 +853,7 @@ printWidth: 80
=====================================input======================================
* http://www.example.com:80/_a_b _
=====================================output=====================================
-- http://www.example.com:80/_a_b \\_
+- http://www.example.com:80/_a_b _
================================================================================
`;
@@ -892,7 +892,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a *
=====================================output=====================================
-*http://www.example.com:80/*a \\*
+*http://www.example.com:80/*a *
================================================================================
`;
@@ -905,7 +905,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a _
=====================================output=====================================
-*http://www.example.com:80/*a \\_
+*http://www.example.com:80/*a _
================================================================================
`;
@@ -918,7 +918,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a* *
=====================================output=====================================
-*http://www.example.com:80/*a\\* \\*
+*http://www.example.com:80/*a* *
================================================================================
`;
@@ -931,7 +931,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a* _
=====================================output=====================================
-*http://www.example.com:80/*a\\* \\_
+*http://www.example.com:80/*a* _
================================================================================
`;
@@ -944,7 +944,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a*
=====================================output=====================================
-*http://www.example.com:80/*a\\*
+*http://www.example.com:80/*a*
================================================================================
`;
@@ -957,7 +957,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a** *
=====================================output=====================================
-*http://www.example.com:80/*a\\*\\* \\*
+*http://www.example.com:80/*a** *
================================================================================
`;
@@ -970,7 +970,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a** _
=====================================output=====================================
-*http://www.example.com:80/*a\\*\\* \\_
+*http://www.example.com:80/*a** _
================================================================================
`;
@@ -983,7 +983,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a**
=====================================output=====================================
-*http://www.example.com:80/*a\\*\\*
+*http://www.example.com:80/*a**
================================================================================
`;
@@ -996,7 +996,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a***
=====================================output=====================================
-*http://www.example.com:80/*a\\*\\*\\*
+*http://www.example.com:80/*a***
================================================================================
`;
@@ -1009,7 +1009,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a**_
=====================================output=====================================
-*http://www.example.com:80/*a\\*\\*\\_
+*http://www.example.com:80/*a**_
================================================================================
`;
@@ -1035,7 +1035,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a*/ _
=====================================output=====================================
-*http://www.example.com:80/*a\\*/ \\_
+*http://www.example.com:80/*a*/ _
================================================================================
`;
@@ -1048,7 +1048,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a*/* *
=====================================output=====================================
-*http://www.example.com:80/*a*/* \\*
+*http://www.example.com:80/*a*/* *
================================================================================
`;
@@ -1061,7 +1061,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a*/* _
=====================================output=====================================
-*http://www.example.com:80/*a*/* \\_
+*http://www.example.com:80/*a*/* _
================================================================================
`;
@@ -1087,7 +1087,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a*/**
=====================================output=====================================
-*http://www.example.com:80/*a\\*/\\*\\*
+*http://www.example.com:80/*a*/**
================================================================================
`;
@@ -1100,7 +1100,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a*/*_
=====================================output=====================================
-*http://www.example.com:80/*a*/*\\_
+*http://www.example.com:80/*a*/*_
================================================================================
`;
@@ -1113,7 +1113,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a*/_
=====================================output=====================================
-*http://www.example.com:80/*a\\*/\\_
+*http://www.example.com:80/*a*/_
================================================================================
`;
@@ -1126,7 +1126,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a*_
=====================================output=====================================
-*http://www.example.com:80/*a\\*\\_
+*http://www.example.com:80/*a*_
================================================================================
`;
@@ -1152,7 +1152,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a*b _
=====================================output=====================================
-*http://www.example.com:80/*a\\*b \\_
+*http://www.example.com:80/*a*b _
================================================================================
`;
@@ -1178,7 +1178,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a*b_
=====================================output=====================================
-*http://www.example.com:80/*a\\*b\\_
+*http://www.example.com:80/*a*b_
================================================================================
`;
@@ -1191,7 +1191,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/*a_
=====================================output=====================================
-*http://www.example.com:80/*a\\_
+*http://www.example.com:80/*a_
================================================================================
`;
@@ -1217,7 +1217,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a _
=====================================output=====================================
-\\*http://www.example.com:80/_a \\_
+*http://www.example.com:80/_a _
================================================================================
`;
@@ -1230,7 +1230,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a* *
=====================================output=====================================
-*http://www.example.com:80/_a* \\*
+*http://www.example.com:80/_a* *
================================================================================
`;
@@ -1243,7 +1243,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a* _
=====================================output=====================================
-*http://www.example.com:80/_a* \\_
+*http://www.example.com:80/_a* _
================================================================================
`;
@@ -1269,7 +1269,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a**
=====================================output=====================================
-\\*http://www.example.com:80/_a**
+*http://www.example.com:80/_a**
================================================================================
`;
@@ -1282,7 +1282,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a*/ *
=====================================output=====================================
-*http://www.example.com:80/_a*/ \\*
+*http://www.example.com:80/_a*/ *
================================================================================
`;
@@ -1295,7 +1295,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a*/ _
=====================================output=====================================
-*http://www.example.com:80/_a*/ \\_
+*http://www.example.com:80/_a*/ _
================================================================================
`;
@@ -1308,7 +1308,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a*/*
=====================================output=====================================
-*http://www.example.com:80/_a*/\\*
+*http://www.example.com:80/_a*/*
================================================================================
`;
@@ -1321,7 +1321,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a*/_
=====================================output=====================================
-*http://www.example.com:80/_a*/\\_
+*http://www.example.com:80/_a*/_
================================================================================
`;
@@ -1334,7 +1334,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a*_
=====================================output=====================================
-*http://www.example.com:80/_a*\\_
+*http://www.example.com:80/_a*_
================================================================================
`;
@@ -1347,7 +1347,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a*b *
=====================================output=====================================
-*http://www.example.com:80/_a*b \\*
+*http://www.example.com:80/_a*b *
================================================================================
`;
@@ -1360,7 +1360,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a*b _
=====================================output=====================================
-*http://www.example.com:80/_a*b \\_
+*http://www.example.com:80/_a*b _
================================================================================
`;
@@ -1373,7 +1373,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a*b*
=====================================output=====================================
-*http://www.example.com:80/_a*b\\*
+*http://www.example.com:80/_a*b*
================================================================================
`;
@@ -1386,7 +1386,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a*b_
=====================================output=====================================
-*http://www.example.com:80/_a*b\\_
+*http://www.example.com:80/_a*b_
================================================================================
`;
@@ -1412,7 +1412,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a_ _
=====================================output=====================================
-\\*http://www.example.com:80/_a_ \\_
+*http://www.example.com:80/_a_ _
================================================================================
`;
@@ -1425,7 +1425,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a_
=====================================output=====================================
-\\*http://www.example.com:80/_a_
+*http://www.example.com:80/_a_
================================================================================
`;
@@ -1438,7 +1438,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a_* *
=====================================output=====================================
-*http://www.example.com:80/_a_* \\*
+*http://www.example.com:80/_a_* *
================================================================================
`;
@@ -1451,7 +1451,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a_* _
=====================================output=====================================
-*http://www.example.com:80/_a_* \\_
+*http://www.example.com:80/_a_* _
================================================================================
`;
@@ -1477,7 +1477,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a_**
=====================================output=====================================
-\\*http://www.example.com:80/_a_**
+*http://www.example.com:80/_a_**
================================================================================
`;
@@ -1490,7 +1490,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a_*_
=====================================output=====================================
-*http://www.example.com:80/_a_*\\_
+*http://www.example.com:80/_a_*_
================================================================================
`;
@@ -1516,7 +1516,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a_/ _
=====================================output=====================================
-\\*http://www.example.com:80/_a_/ \\_
+*http://www.example.com:80/_a_/ _
================================================================================
`;
@@ -1529,7 +1529,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a_/* *
=====================================output=====================================
-*http://www.example.com:80/_a_/* \\*
+*http://www.example.com:80/_a_/* *
================================================================================
`;
@@ -1542,7 +1542,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a_/* _
=====================================output=====================================
-*http://www.example.com:80/_a_/* \\_
+*http://www.example.com:80/_a_/* _
================================================================================
`;
@@ -1568,7 +1568,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a_/**
=====================================output=====================================
-\\*http://www.example.com:80/_a_/**
+*http://www.example.com:80/_a_/**
================================================================================
`;
@@ -1581,7 +1581,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a_/*_
=====================================output=====================================
-*http://www.example.com:80/_a_/*\\_
+*http://www.example.com:80/_a_/*_
================================================================================
`;
@@ -1607,7 +1607,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a_/_ _
=====================================output=====================================
-\\*http://www.example.com:80/_a_/_ \\_
+*http://www.example.com:80/_a_/_ _
================================================================================
`;
@@ -1620,7 +1620,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a_/_
=====================================output=====================================
-\\*http://www.example.com:80/_a_/_
+*http://www.example.com:80/_a_/_
================================================================================
`;
@@ -1646,7 +1646,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a_/__
=====================================output=====================================
-\\*http://www.example.com:80/_a_/__
+*http://www.example.com:80/_a_/__
================================================================================
`;
@@ -1672,7 +1672,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a__ _
=====================================output=====================================
-\\*http://www.example.com:80/_a__ \\_
+*http://www.example.com:80/_a__ _
================================================================================
`;
@@ -1685,7 +1685,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a__
=====================================output=====================================
-\\*http://www.example.com:80/_a__
+*http://www.example.com:80/_a__
================================================================================
`;
@@ -1711,7 +1711,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a___
=====================================output=====================================
-\\*http://www.example.com:80/_a___
+*http://www.example.com:80/_a___
================================================================================
`;
@@ -1737,7 +1737,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a_b _
=====================================output=====================================
-\\*http://www.example.com:80/_a_b \\_
+*http://www.example.com:80/_a_b _
================================================================================
`;
@@ -1763,7 +1763,7 @@ printWidth: 80
=====================================input======================================
*http://www.example.com:80/_a_b_
=====================================output=====================================
-\\*http://www.example.com:80/_a_b_
+*http://www.example.com:80/_a_b_
================================================================================
`;
@@ -1776,7 +1776,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/*a *
=====================================output=====================================
-\\_ http://www.example.com:80/*a \\*
+_ http://www.example.com:80/*a *
================================================================================
`;
@@ -1802,7 +1802,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/*a* *
=====================================output=====================================
-\\_ http://www.example.com:80/*a* \\*
+_ http://www.example.com:80/*a* *
================================================================================
`;
@@ -1828,7 +1828,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/*a*
=====================================output=====================================
-\\_ http://www.example.com:80/*a*
+_ http://www.example.com:80/*a*
================================================================================
`;
@@ -1841,7 +1841,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/*a** *
=====================================output=====================================
-\\_ http://www.example.com:80/*a** \\*
+_ http://www.example.com:80/*a** *
================================================================================
`;
@@ -1867,7 +1867,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/*a**
=====================================output=====================================
-\\_ http://www.example.com:80/*a**
+_ http://www.example.com:80/*a**
================================================================================
`;
@@ -1880,7 +1880,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/*a***
=====================================output=====================================
-\\_ http://www.example.com:80/*a***
+_ http://www.example.com:80/*a***
================================================================================
`;
@@ -1906,7 +1906,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/*a*/ *
=====================================output=====================================
-\\_ http://www.example.com:80/*a*/ \\*
+_ http://www.example.com:80/*a*/ *
================================================================================
`;
@@ -1932,7 +1932,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/*a*/* *
=====================================output=====================================
-\\_ http://www.example.com:80/*a*/* \\*
+_ http://www.example.com:80/*a*/* *
================================================================================
`;
@@ -1958,7 +1958,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/*a*/*
=====================================output=====================================
-\\_ http://www.example.com:80/*a*/*
+_ http://www.example.com:80/*a*/*
================================================================================
`;
@@ -1971,7 +1971,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/*a*/**
=====================================output=====================================
-\\_ http://www.example.com:80/*a*/**
+_ http://www.example.com:80/*a*/**
================================================================================
`;
@@ -2023,7 +2023,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/*a*b *
=====================================output=====================================
-\\_ http://www.example.com:80/*a*b \\*
+_ http://www.example.com:80/*a*b *
================================================================================
`;
@@ -2049,7 +2049,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/*a*b*
=====================================output=====================================
-\\_ http://www.example.com:80/*a*b*
+_ http://www.example.com:80/*a*b*
================================================================================
`;
@@ -2088,7 +2088,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a *
=====================================output=====================================
-\\_ http://www.example.com:80/_a \\*
+_ http://www.example.com:80/_a *
================================================================================
`;
@@ -2114,7 +2114,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a* *
=====================================output=====================================
-\\_ http://www.example.com:80/_a* \\*
+_ http://www.example.com:80/_a* *
================================================================================
`;
@@ -2140,7 +2140,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a*
=====================================output=====================================
-\\_ http://www.example.com:80/_a*
+_ http://www.example.com:80/_a*
================================================================================
`;
@@ -2153,7 +2153,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a**
=====================================output=====================================
-\\_ http://www.example.com:80/_a**
+_ http://www.example.com:80/_a**
================================================================================
`;
@@ -2166,7 +2166,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a*/ *
=====================================output=====================================
-\\_ http://www.example.com:80/_a*/ \\*
+_ http://www.example.com:80/_a*/ *
================================================================================
`;
@@ -2192,7 +2192,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a*/*
=====================================output=====================================
-\\_ http://www.example.com:80/_a*/*
+_ http://www.example.com:80/_a*/*
================================================================================
`;
@@ -2231,7 +2231,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a*b *
=====================================output=====================================
-\\_ http://www.example.com:80/_a*b \\*
+_ http://www.example.com:80/_a*b *
================================================================================
`;
@@ -2257,7 +2257,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a*b*
=====================================output=====================================
-\\_ http://www.example.com:80/_a*b*
+_ http://www.example.com:80/_a*b*
================================================================================
`;
@@ -2283,7 +2283,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_ *
=====================================output=====================================
-_ http://www.example.com:80/_a_ \\*
+_ http://www.example.com:80/_a_ *
================================================================================
`;
@@ -2296,7 +2296,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_ _
=====================================output=====================================
-_ http://www.example.com:80/_a_ \\_
+_ http://www.example.com:80/_a_ _
================================================================================
`;
@@ -2322,7 +2322,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_* *
=====================================output=====================================
-_ http://www.example.com:80/_a_\\* \\*
+_ http://www.example.com:80/_a_* *
================================================================================
`;
@@ -2335,7 +2335,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_* _
=====================================output=====================================
-_ http://www.example.com:80/_a_\\* \\_
+_ http://www.example.com:80/_a_* _
================================================================================
`;
@@ -2348,7 +2348,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_*
=====================================output=====================================
-_ http://www.example.com:80/_a_\\*
+_ http://www.example.com:80/_a_*
================================================================================
`;
@@ -2361,7 +2361,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_**
=====================================output=====================================
-_ http://www.example.com:80/_a_\\*\\*
+_ http://www.example.com:80/_a_**
================================================================================
`;
@@ -2374,7 +2374,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_*_
=====================================output=====================================
-_ http://www.example.com:80/_a_\\*\\_
+_ http://www.example.com:80/_a_*_
================================================================================
`;
@@ -2387,7 +2387,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_/ *
=====================================output=====================================
-_ http://www.example.com:80/_a_/ \\*
+_ http://www.example.com:80/_a_/ *
================================================================================
`;
@@ -2400,7 +2400,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_/ _
=====================================output=====================================
-_ http://www.example.com:80/_a_/ \\_
+_ http://www.example.com:80/_a_/ _
================================================================================
`;
@@ -2413,7 +2413,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_/* *
=====================================output=====================================
-_ http://www.example.com:80/_a_/\\* \\*
+_ http://www.example.com:80/_a_/* *
================================================================================
`;
@@ -2426,7 +2426,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_/* _
=====================================output=====================================
-_ http://www.example.com:80/_a_/\\* \\_
+_ http://www.example.com:80/_a_/* _
================================================================================
`;
@@ -2439,7 +2439,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_/*
=====================================output=====================================
-_ http://www.example.com:80/_a_/\\*
+_ http://www.example.com:80/_a_/*
================================================================================
`;
@@ -2452,7 +2452,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_/**
=====================================output=====================================
-_ http://www.example.com:80/_a_/\\*\\*
+_ http://www.example.com:80/_a_/**
================================================================================
`;
@@ -2465,7 +2465,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_/*_
=====================================output=====================================
-_ http://www.example.com:80/_a_/\\*\\_
+_ http://www.example.com:80/_a_/*_
================================================================================
`;
@@ -2478,7 +2478,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_/_ *
=====================================output=====================================
-_ http://www.example.com:80/_a_/\\_ \\*
+_ http://www.example.com:80/_a_/_ *
================================================================================
`;
@@ -2491,7 +2491,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_/_ _
=====================================output=====================================
-_ http://www.example.com:80/_a_/\\_ \\_
+_ http://www.example.com:80/_a_/_ _
================================================================================
`;
@@ -2504,7 +2504,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_/_
=====================================output=====================================
-_ http://www.example.com:80/_a_/\\_
+_ http://www.example.com:80/_a_/_
================================================================================
`;
@@ -2517,7 +2517,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_/_*
=====================================output=====================================
-_ http://www.example.com:80/_a_/\\_\\*
+_ http://www.example.com:80/_a_/_*
================================================================================
`;
@@ -2530,7 +2530,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_/__
=====================================output=====================================
-_ http://www.example.com:80/_a_/\\_\\_
+_ http://www.example.com:80/_a_/__
================================================================================
`;
@@ -2543,7 +2543,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a__ *
=====================================output=====================================
-\\_ http://www.example.com:80/_a__ \\*
+_ http://www.example.com:80/_a__ *
================================================================================
`;
@@ -2569,7 +2569,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a__
=====================================output=====================================
-\\_ http://www.example.com:80/_a__
+_ http://www.example.com:80/_a__
================================================================================
`;
@@ -2582,7 +2582,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a__*
=====================================output=====================================
-\\_ http://www.example.com:80/_a__*
+_ http://www.example.com:80/_a__*
================================================================================
`;
@@ -2595,7 +2595,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a___
=====================================output=====================================
-\\_ http://www.example.com:80/_a___
+_ http://www.example.com:80/_a___
================================================================================
`;
@@ -2608,7 +2608,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_b *
=====================================output=====================================
-\\_ http://www.example.com:80/_a_b \\*
+_ http://www.example.com:80/_a_b *
================================================================================
`;
@@ -2634,7 +2634,7 @@ printWidth: 80
=====================================input======================================
_ http://www.example.com:80/_a_b*
=====================================output=====================================
-\\_ http://www.example.com:80/_a_b*
+_ http://www.example.com:80/_a_b*
================================================================================
`;
@@ -2660,7 +2660,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/*a *
=====================================output=====================================
-\\_http://www.example.com:80/*a \\*
+_http://www.example.com:80/*a *
================================================================================
`;
@@ -2686,7 +2686,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/*a* *
=====================================output=====================================
-\\_http://www.example.com:80/*a* \\*
+_http://www.example.com:80/*a* *
================================================================================
`;
@@ -2712,7 +2712,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/*a*
=====================================output=====================================
-\\_http://www.example.com:80/*a*
+_http://www.example.com:80/*a*
================================================================================
`;
@@ -2725,7 +2725,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/*a** *
=====================================output=====================================
-\\_http://www.example.com:80/*a** \\*
+_http://www.example.com:80/*a** *
================================================================================
`;
@@ -2751,7 +2751,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/*a**
=====================================output=====================================
-\\_http://www.example.com:80/*a**
+_http://www.example.com:80/*a**
================================================================================
`;
@@ -2764,7 +2764,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/*a***
=====================================output=====================================
-\\_http://www.example.com:80/*a***
+_http://www.example.com:80/*a***
================================================================================
`;
@@ -2790,7 +2790,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/*a*/ *
=====================================output=====================================
-\\_http://www.example.com:80/*a*/ \\*
+_http://www.example.com:80/*a*/ *
================================================================================
`;
@@ -2816,7 +2816,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/*a*/* *
=====================================output=====================================
-\\_http://www.example.com:80/*a*/* \\*
+_http://www.example.com:80/*a*/* *
================================================================================
`;
@@ -2842,7 +2842,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/*a*/*
=====================================output=====================================
-\\_http://www.example.com:80/*a*/*
+_http://www.example.com:80/*a*/*
================================================================================
`;
@@ -2855,7 +2855,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/*a*/**
=====================================output=====================================
-\\_http://www.example.com:80/*a*/**
+_http://www.example.com:80/*a*/**
================================================================================
`;
@@ -2907,7 +2907,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/*a*b *
=====================================output=====================================
-\\_http://www.example.com:80/*a*b \\*
+_http://www.example.com:80/*a*b *
================================================================================
`;
@@ -2933,7 +2933,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/*a*b*
=====================================output=====================================
-\\_http://www.example.com:80/*a*b*
+_http://www.example.com:80/*a*b*
================================================================================
`;
@@ -2972,7 +2972,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a *
=====================================output=====================================
-\\_http://www.example.com:80/_a \\*
+_http://www.example.com:80/_a *
================================================================================
`;
@@ -2998,7 +2998,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a* *
=====================================output=====================================
-\\_http://www.example.com:80/_a* \\*
+_http://www.example.com:80/_a* *
================================================================================
`;
@@ -3024,7 +3024,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a*
=====================================output=====================================
-\\_http://www.example.com:80/_a*
+_http://www.example.com:80/_a*
================================================================================
`;
@@ -3037,7 +3037,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a**
=====================================output=====================================
-\\_http://www.example.com:80/_a**
+_http://www.example.com:80/_a**
================================================================================
`;
@@ -3050,7 +3050,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a*/ *
=====================================output=====================================
-\\_http://www.example.com:80/_a*/ \\*
+_http://www.example.com:80/_a*/ *
================================================================================
`;
@@ -3076,7 +3076,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a*/*
=====================================output=====================================
-\\_http://www.example.com:80/_a*/*
+_http://www.example.com:80/_a*/*
================================================================================
`;
@@ -3115,7 +3115,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a*b *
=====================================output=====================================
-\\_http://www.example.com:80/_a*b \\*
+_http://www.example.com:80/_a*b *
================================================================================
`;
@@ -3141,7 +3141,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a*b*
=====================================output=====================================
-\\_http://www.example.com:80/_a*b*
+_http://www.example.com:80/_a*b*
================================================================================
`;
@@ -3167,7 +3167,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_ *
=====================================output=====================================
-_http://www.example.com:80/_a_ \\*
+_http://www.example.com:80/_a_ *
================================================================================
`;
@@ -3180,7 +3180,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_ _
=====================================output=====================================
-_http://www.example.com:80/_a_ \\_
+_http://www.example.com:80/_a_ _
================================================================================
`;
@@ -3206,7 +3206,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_* *
=====================================output=====================================
-_http://www.example.com:80/_a_\\* \\*
+_http://www.example.com:80/_a_* *
================================================================================
`;
@@ -3219,7 +3219,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_* _
=====================================output=====================================
-_http://www.example.com:80/_a_\\* \\_
+_http://www.example.com:80/_a_* _
================================================================================
`;
@@ -3232,7 +3232,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_*
=====================================output=====================================
-_http://www.example.com:80/_a_\\*
+_http://www.example.com:80/_a_*
================================================================================
`;
@@ -3245,7 +3245,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_**
=====================================output=====================================
-_http://www.example.com:80/_a_\\*\\*
+_http://www.example.com:80/_a_**
================================================================================
`;
@@ -3258,7 +3258,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_*_
=====================================output=====================================
-_http://www.example.com:80/_a_\\*\\_
+_http://www.example.com:80/_a_*_
================================================================================
`;
@@ -3271,7 +3271,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_/ *
=====================================output=====================================
-_http://www.example.com:80/_a_/ \\*
+_http://www.example.com:80/_a_/ *
================================================================================
`;
@@ -3284,7 +3284,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_/ _
=====================================output=====================================
-_http://www.example.com:80/_a_/ \\_
+_http://www.example.com:80/_a_/ _
================================================================================
`;
@@ -3297,7 +3297,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_/* *
=====================================output=====================================
-_http://www.example.com:80/_a_/\\* \\*
+_http://www.example.com:80/_a_/* *
================================================================================
`;
@@ -3310,7 +3310,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_/* _
=====================================output=====================================
-_http://www.example.com:80/_a_/\\* \\_
+_http://www.example.com:80/_a_/* _
================================================================================
`;
@@ -3323,7 +3323,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_/*
=====================================output=====================================
-_http://www.example.com:80/_a_/\\*
+_http://www.example.com:80/_a_/*
================================================================================
`;
@@ -3336,7 +3336,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_/**
=====================================output=====================================
-_http://www.example.com:80/_a_/\\*\\*
+_http://www.example.com:80/_a_/**
================================================================================
`;
@@ -3349,7 +3349,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_/*_
=====================================output=====================================
-_http://www.example.com:80/_a_/\\*\\_
+_http://www.example.com:80/_a_/*_
================================================================================
`;
@@ -3362,7 +3362,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_/_ *
=====================================output=====================================
-_http://www.example.com:80/_a_/\\_ \\*
+_http://www.example.com:80/_a_/_ *
================================================================================
`;
@@ -3375,7 +3375,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_/_ _
=====================================output=====================================
-_http://www.example.com:80/_a_/\\_ \\_
+_http://www.example.com:80/_a_/_ _
================================================================================
`;
@@ -3388,7 +3388,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_/_
=====================================output=====================================
-_http://www.example.com:80/_a_/\\_
+_http://www.example.com:80/_a_/_
================================================================================
`;
@@ -3401,7 +3401,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_/_*
=====================================output=====================================
-_http://www.example.com:80/_a_/\\_\\*
+_http://www.example.com:80/_a_/_*
================================================================================
`;
@@ -3414,7 +3414,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_/__
=====================================output=====================================
-_http://www.example.com:80/_a_/\\_\\_
+_http://www.example.com:80/_a_/__
================================================================================
`;
@@ -3427,7 +3427,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a__ *
=====================================output=====================================
-\\_http://www.example.com:80/_a__ \\*
+_http://www.example.com:80/_a__ *
================================================================================
`;
@@ -3453,7 +3453,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a__
=====================================output=====================================
-\\_http://www.example.com:80/_a__
+_http://www.example.com:80/_a__
================================================================================
`;
@@ -3466,7 +3466,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a__*
=====================================output=====================================
-\\_http://www.example.com:80/_a__*
+_http://www.example.com:80/_a__*
================================================================================
`;
@@ -3479,7 +3479,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a___
=====================================output=====================================
-\\_http://www.example.com:80/_a___
+_http://www.example.com:80/_a___
================================================================================
`;
@@ -3492,7 +3492,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_b *
=====================================output=====================================
-\\_http://www.example.com:80/_a_b \\*
+_http://www.example.com:80/_a_b *
================================================================================
`;
@@ -3518,7 +3518,7 @@ printWidth: 80
=====================================input======================================
_http://www.example.com:80/_a_b*
=====================================output=====================================
-\\_http://www.example.com:80/_a_b*
+_http://www.example.com:80/_a_b*
================================================================================
`;
diff --git a/tests/format/markdown/blockquote/__snapshots__/format.test.js.snap b/tests/format/markdown/blockquote/__snapshots__/format.test.js.snap
index 2dd99cdd6..a6828c667 100644
--- a/tests/format/markdown/blockquote/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/blockquote/__snapshots__/format.test.js.snap
@@ -1,5 +1,51 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
+exports[`check-accidental.md - {"proseWrap":"always"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "always"
+ | printWidth
+=====================================input======================================
+long long long long long long long long long long long long long long long > > > > this is not quote
+
+=====================================output=====================================
+long long long long long long long long long long long long long long
+long > > > > this is not quote
+
+================================================================================
+`;
+
+exports[`check-accidental.md - {"proseWrap":"never"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "never"
+ | printWidth
+=====================================input======================================
+long long long long long long long long long long long long long long long > > > > this is not quote
+
+=====================================output=====================================
+long long long long long long long long long long long long long long long > > > > this is not quote
+
+================================================================================
+`;
+
+exports[`check-accidental.md - {"proseWrap":"preserve"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "preserve"
+ | printWidth
+=====================================input======================================
+long long long long long long long long long long long long long long long > > > > this is not quote
+
+=====================================output=====================================
+long long long long long long long long long long long long long long long > > > > this is not quote
+
+================================================================================
+`;
+
exports[`code.md - {"proseWrap":"always"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
@@ -232,6 +278,7 @@ proseWrap: "always"
> - This is a long long
> long long long long
> long long paragraph.
+>
> \`\`\`js
> // prettier-ignore
@@ -472,6 +519,250 @@ proseWrap: "preserve"
================================================================================
`;
+exports[`interrupt-others.md - {"proseWrap":"always"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "always"
+ | printWidth
+=====================================input======================================
+This paragraph
+> is interrupted by block quote.
+
+[This link
+> is interrupted by block quote.](http://example.com)
+
+[[This wiki link
+> is interrupted by block quote.]]
+
+> This is a block quote and this paragraph
+> > is interrupted neither by block quote nor indented code block.
+
+=====================================output=====================================
+This paragraph
+
+> is interrupted by block quote.
+
+[This link
+
+> is interrupted by block quote.](http://example.com)
+
+[[This wiki link
+
+> is interrupted by block quote.]]
+
+> This is a block quote and this paragraph > is interrupted neither by block
+> quote nor indented code block.
+
+================================================================================
+`;
+
+exports[`interrupt-others.md - {"proseWrap":"never"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "never"
+ | printWidth
+=====================================input======================================
+This paragraph
+> is interrupted by block quote.
+
+[This link
+> is interrupted by block quote.](http://example.com)
+
+[[This wiki link
+> is interrupted by block quote.]]
+
+> This is a block quote and this paragraph
+> > is interrupted neither by block quote nor indented code block.
+
+=====================================output=====================================
+This paragraph
+
+> is interrupted by block quote.
+
+[This link
+
+> is interrupted by block quote.](http://example.com)
+
+[[This wiki link
+
+> is interrupted by block quote.]]
+
+> This is a block quote and this paragraph > is interrupted neither by block quote nor indented code block.
+
+================================================================================
+`;
+
+exports[`interrupt-others.md - {"proseWrap":"preserve"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "preserve"
+ | printWidth
+=====================================input======================================
+This paragraph
+> is interrupted by block quote.
+
+[This link
+> is interrupted by block quote.](http://example.com)
+
+[[This wiki link
+> is interrupted by block quote.]]
+
+> This is a block quote and this paragraph
+> > is interrupted neither by block quote nor indented code block.
+
+=====================================output=====================================
+This paragraph
+
+> is interrupted by block quote.
+
+[This link
+
+> is interrupted by block quote.](http://example.com)
+
+[[This wiki link
+
+> is interrupted by block quote.]]
+
+> This is a block quote and this paragraph > is interrupted neither by block quote nor indented code block.
+
+================================================================================
+`;
+
+exports[`list.md - {"proseWrap":"always"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "always"
+ | printWidth
+=====================================input======================================
+> - list in quote
+> with multiple lines
+> - nested list item
+> - nested list item 2
+> across multiple lines
+> > quote in nested list in quote
+> > with multiple lines
+
+- > quote in list
+ > with multiple lines
+ > - list item in quote in list
+ > > quote in list item in quote in list
+ > > with multiple lines
+ - nested list
+
+- > quote in list
+ > this line is indented by tab
+
+=====================================output=====================================
+> - list in quote with multiple lines
+> - nested list item
+> - nested list item 2 across multiple lines
+> > quote in nested list in quote with multiple lines
+
+- > quote in list with multiple lines
+ >
+ > - list item in quote in list
+ > > quote in list item in quote in list with multiple lines
+ - nested list
+
+- > quote in list this line is indented by tab
+
+================================================================================
+`;
+
+exports[`list.md - {"proseWrap":"never"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "never"
+ | printWidth
+=====================================input======================================
+> - list in quote
+> with multiple lines
+> - nested list item
+> - nested list item 2
+> across multiple lines
+> > quote in nested list in quote
+> > with multiple lines
+
+- > quote in list
+ > with multiple lines
+ > - list item in quote in list
+ > > quote in list item in quote in list
+ > > with multiple lines
+ - nested list
+
+- > quote in list
+ > this line is indented by tab
+
+=====================================output=====================================
+> - list in quote with multiple lines
+> - nested list item
+> - nested list item 2 across multiple lines
+> > quote in nested list in quote with multiple lines
+
+- > quote in list with multiple lines
+ >
+ > - list item in quote in list
+ > > quote in list item in quote in list with multiple lines
+ - nested list
+
+- > quote in list this line is indented by tab
+
+================================================================================
+`;
+
+exports[`list.md - {"proseWrap":"preserve"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "preserve"
+ | printWidth
+=====================================input======================================
+> - list in quote
+> with multiple lines
+> - nested list item
+> - nested list item 2
+> across multiple lines
+> > quote in nested list in quote
+> > with multiple lines
+
+- > quote in list
+ > with multiple lines
+ > - list item in quote in list
+ > > quote in list item in quote in list
+ > > with multiple lines
+ - nested list
+
+- > quote in list
+ > this line is indented by tab
+
+=====================================output=====================================
+> - list in quote
+> with multiple lines
+> - nested list item
+> - nested list item 2
+> across multiple lines
+> > quote in nested list in quote
+> > with multiple lines
+
+- > quote in list
+ > with multiple lines
+ >
+ > - list item in quote in list
+ > > quote in list item in quote in list
+ > > with multiple lines
+ - nested list
+
+- > quote in list
+ > this line is indented by tab
+
+================================================================================
+`;
+
exports[`nested.md - {"proseWrap":"always"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
diff --git a/tests/format/markdown/blockquote/check-accidental.md b/tests/format/markdown/blockquote/check-accidental.md
new file mode 100644
index 000000000..434f5fe13
--- /dev/null
+++ b/tests/format/markdown/blockquote/check-accidental.md
@@ -0,0 +1 @@
+long long long long long long long long long long long long long long long > > > > this is not quote
diff --git a/tests/format/markdown/blockquote/interrupt-others.md b/tests/format/markdown/blockquote/interrupt-others.md
new file mode 100644
index 000000000..3bf160e36
--- /dev/null
+++ b/tests/format/markdown/blockquote/interrupt-others.md
@@ -0,0 +1,11 @@
+This paragraph
+> is interrupted by block quote.
+
+[This link
+> is interrupted by block quote.](http://example.com)
+
+[[This wiki link
+> is interrupted by block quote.]]
+
+> This is a block quote and this paragraph
+> > is interrupted neither by block quote nor indented code block.
diff --git a/tests/format/markdown/blockquote/list.md b/tests/format/markdown/blockquote/list.md
new file mode 100644
index 000000000..f574d5ffb
--- /dev/null
+++ b/tests/format/markdown/blockquote/list.md
@@ -0,0 +1,17 @@
+> - list in quote
+> with multiple lines
+> - nested list item
+> - nested list item 2
+> across multiple lines
+> > quote in nested list in quote
+> > with multiple lines
+
+- > quote in list
+ > with multiple lines
+ > - list item in quote in list
+ > > quote in list item in quote in list
+ > > with multiple lines
+ - nested list
+
+- > quote in list
+ > this line is indented by tab
diff --git a/tests/format/markdown/break/__snapshots__/format.test.js.snap b/tests/format/markdown/break/__snapshots__/format.test.js.snap
index 257a8ae85..0aa6f57ac 100644
--- a/tests/format/markdown/break/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/break/__snapshots__/format.test.js.snap
@@ -44,8 +44,7 @@ word very-very-very-very-very-very-very-very-very-very-long-word very-very-very-
=====================================output=====================================
a
- very-very-very-very-very-very-very-very-very-very-long-word
-very-very-very-very-very-very-very-very-very-very-long-word
+very-very-very-very-very-very-very-very-very-very-long-word very-very-very-very-very-very-very-very-very-very-long-word
very-very-very-very-very-very-very-very-very-very-long-word
\\
diff --git a/tests/format/markdown/break/list-item/__snapshots__/format.test.js.snap b/tests/format/markdown/break/list-item/__snapshots__/format.test.js.snap
new file mode 100644
index 000000000..e95133e97
--- /dev/null
+++ b/tests/format/markdown/break/list-item/__snapshots__/format.test.js.snap
@@ -0,0 +1,41 @@
+// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
+
+exports[`list-item.md - {"proseWrap":"always"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "always"
+ | printWidth
+=====================================input======================================
+- 1
+ foo
+- 2\\
+ bar
+
+=====================================output=====================================
+- 1 foo
+- 2\\
+ bar
+
+================================================================================
+`;
+
+exports[`list-item.md format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+- 1
+ foo
+- 2\\
+ bar
+
+=====================================output=====================================
+- 1
+ foo
+- 2\\
+ bar
+
+================================================================================
+`;
diff --git a/tests/format/markdown/break/list-item/format.test.js b/tests/format/markdown/break/list-item/format.test.js
new file mode 100644
index 000000000..55fbeb39f
--- /dev/null
+++ b/tests/format/markdown/break/list-item/format.test.js
@@ -0,0 +1,2 @@
+runFormatTest(import.meta, ["markdown"]);
+runFormatTest(import.meta, ["markdown"], { proseWrap: "always" });
diff --git a/tests/format/markdown/break/list-item/list-item.md b/tests/format/markdown/break/list-item/list-item.md
new file mode 100644
index 000000000..6f563879f
--- /dev/null
+++ b/tests/format/markdown/break/list-item/list-item.md
@@ -0,0 +1,4 @@
+- 1
+ foo
+- 2\
+ bar
diff --git a/tests/format/markdown/code/__snapshots__/format.test.js.snap b/tests/format/markdown/code/__snapshots__/format.test.js.snap
index c4ddf3d1f..ff49ca4c3 100644
--- a/tests/format/markdown/code/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/code/__snapshots__/format.test.js.snap
@@ -32,7 +32,6 @@ proseWrap: "always"
- 1
- 2
- 3
-
\`\`\`js
md\`
# this is the root indent
@@ -213,11 +212,11 @@ proseWrap: "always"
-1. Change to your home directory:
+1. Change to your home directory:
cd
-2. List the contents:
+2. List the contents:
ls -l
diff --git a/tests/format/markdown/commonmark-test-suite-legacy/__snapshots__/format.test.js.snap b/tests/format/markdown/commonmark-test-suite-legacy/__snapshots__/format.test.js.snap
index c01a76f19..f09814121 100644
--- a/tests/format/markdown/commonmark-test-suite-legacy/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/commonmark-test-suite-legacy/__snapshots__/format.test.js.snap
@@ -147,7 +147,7 @@ proseWrap: "always"
__a
=====================================output=====================================
-**a
+__a
================================================================================
`;
@@ -377,7 +377,8 @@ Header
foo
-## Header
+Header
+------
foo
@@ -403,7 +404,7 @@ proseWrap: "always"
\\[foo]: /url "not a reference"
=====================================output=====================================
-\\*not emphasized\\* \\
not a tag \\[not a link](/foo) \\\`not code\` 1\\. not a
+\\*not emphasized* \\
not a tag \\[not a link](/foo) \\\`not code\` 1\\. not a
list \\* not a list \\# not a header \\[foo]: /url "not a reference"
================================================================================
@@ -572,10 +573,10 @@ Bar
=====================================output=====================================
Foo Bar
-
---
-Foo Bar ===
+Foo Bar
+===
================================================================================
`;
@@ -636,7 +637,7 @@ proseWrap: "always"
> foo bar
=====================================output=====================================
-> foo bar
+> foo bar
================================================================================
`;
@@ -1126,8 +1127,7 @@ proseWrap: "always"
- a
- b
- c
-- d
-- e
+- d - e
- f
- g
- h
@@ -1153,7 +1153,7 @@ proseWrap: "always"
\\[foo]: /url "not a reference"
=====================================output=====================================
-\\*not emphasized\\* \\
not a tag \\[not a link](/foo) \\\`not code\` 1\\. not a
+\\*not emphasized* \\
not a tag \\[not a link](/foo) \\\`not code\` 1\\. not a
list \\* not a list \\# not a heading \\[foo]: /url "not a reference"
================================================================================
@@ -1297,7 +1297,7 @@ proseWrap: "always"
[ref]: /uri
=====================================output=====================================
-[foo \\*bar][ref]
+[foo *bar][ref]
[ref]: /uri
diff --git a/tests/format/markdown/commonmark-test-suite/__snapshots__/format.test.js.snap b/tests/format/markdown/commonmark-test-suite/__snapshots__/format.test.js.snap
index 6d95b19e9..5b36c790c 100644
--- a/tests/format/markdown/commonmark-test-suite/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/commonmark-test-suite/__snapshots__/format.test.js.snap
@@ -25,7 +25,9 @@ proseWrap: "always"
foo baz bim
=====================================output=====================================
-foo baz bim
+\`\`\`
+foo baz bim
+\`\`\`
================================================================================
`;
@@ -80,7 +82,7 @@ proseWrap: "always"
=====================================output=====================================
- foo
- bar
+ bar
================================================================================
`;
@@ -95,7 +97,7 @@ proseWrap: "always"
> foo
=====================================output=====================================
-> foo
+> foo
================================================================================
`;
@@ -110,7 +112,7 @@ proseWrap: "always"
- foo
=====================================output=====================================
-- foo
+- foo
================================================================================
`;
@@ -146,7 +148,7 @@ proseWrap: "always"
=====================================output=====================================
- foo
- bar
- - baz
+ - baz
================================================================================
`;
@@ -166,6 +168,21 @@ proseWrap: "always"
================================================================================
`;
+exports[`snippet: example-11.md (Tabs) - {"proseWrap":"always"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "always"
+ | printWidth
+=====================================input======================================
+* * *
+
+=====================================output=====================================
+---
+
+================================================================================
+`;
+
exports[`snippet: example-12.md (Backslash escapes) - {"proseWrap":"always"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
@@ -214,7 +231,7 @@ proseWrap: "always"
\\ö not a character entity
=====================================output=====================================
-\\*not emphasized\\* \\
not a tag \\[not a link](/foo) \\\`not code\` 1\\. not a
+\\*not emphasized* \\
not a tag \\[not a link](/foo) \\\`not code\` 1\\. not a
list \\* not a list \\# not a heading \\[foo]: /url "not a reference" \\ö not a
character entity
@@ -398,7 +415,7 @@ proseWrap: "always"
=====================================output=====================================
& © Æ Ď ¾ ℋ ⅆ
-∲ ≧̸
+∲ ≧̸
================================================================================
`;
@@ -590,7 +607,7 @@ proseWrap: "always"
*foo*
=====================================output=====================================
-\\*foo\\* _foo_
+*foo* _foo_
================================================================================
`;
@@ -607,7 +624,7 @@ proseWrap: "always"
* foo
=====================================output=====================================
-\\* foo
+* foo
- foo
@@ -718,7 +735,7 @@ proseWrap: "always"
__
=====================================output=====================================
--- \\*\\* \\_\\_
+-- ** __
================================================================================
`;
@@ -749,7 +766,7 @@ Foo
***
=====================================output=====================================
-Foo \\*\\*\\*
+Foo ***
================================================================================
`;
@@ -843,7 +860,7 @@ a------
---a---
=====================================output=====================================
-\\_ \\_ \\_ \\_ a
+_ _ _ _ a
a------
@@ -921,7 +938,8 @@ Foo
bar
=====================================output=====================================
-## Foo
+Foo
+---
bar
@@ -1285,9 +1303,11 @@ Foo *bar*
---------
=====================================output=====================================
-# Foo _bar_
+Foo _bar_
+=========
-## Foo _bar_
+Foo _bar_
+---------
================================================================================
`;
@@ -1304,7 +1324,8 @@ baz*
====
=====================================output=====================================
-Foo _bar baz_ ====
+Foo _bar baz_
+====
================================================================================
`;
@@ -1321,7 +1342,8 @@ baz*
====
=====================================output=====================================
-Foo _bar baz_ ====
+Foo _bar baz_
+====
================================================================================
`;
@@ -1340,9 +1362,11 @@ Foo
=
=====================================output=====================================
-## Foo
+Foo
+-------------------------
-# Foo
+Foo
+=
================================================================================
`;
@@ -1364,11 +1388,14 @@ proseWrap: "always"
===
=====================================output=====================================
-## Foo
+Foo
+---
-## Foo
+Foo
+-----
-Foo ===
+Foo
+===
================================================================================
`;
@@ -1409,8 +1436,7 @@ Foo
=====================================output=====================================
Foo
-
----
+----
================================================================================
`;
@@ -1465,7 +1491,8 @@ Foo
-----
=====================================output=====================================
-## Foo
+Foo
+-----
================================================================================
`;
@@ -1481,7 +1508,8 @@ Foo\\
----
=====================================output=====================================
-## Foo\\
+Foo\\
+----
================================================================================
`;
@@ -1502,11 +1530,13 @@ proseWrap: "always"
of dashes"/>
=====================================output=====================================
-## \`Foo
+\`Foo
+----
\`
-##
@@ -1543,9 +1573,7 @@ bar
===
=====================================output=====================================
-> foo
-
-# bar
+> foo bar ===
================================================================================
`;
@@ -1581,7 +1609,6 @@ Bar
=====================================output=====================================
Foo Bar
-
---
================================================================================
@@ -1606,7 +1633,8 @@ Baz
Foo
---
-## Bar
+Bar
+---
Baz
@@ -1711,7 +1739,8 @@ proseWrap: "always"
------
=====================================output=====================================
-## \\> foo
+\\> foo
+------
================================================================================
`;
@@ -1732,7 +1761,8 @@ baz
=====================================output=====================================
Foo
-## bar
+bar
+---
baz
@@ -1978,7 +2008,8 @@ Heading
foo
-## Heading
+Heading
+------
foo
@@ -2501,7 +2532,8 @@ bar
# baz
=====================================output=====================================
-## foo
+foo
+---
\`\`\`
bar
@@ -2631,9 +2663,7 @@ _world_.
**Hello**,
-_world_.
-
-
+_world_.
================================================================================
@@ -3097,7 +3127,7 @@ _bar_
=====================================output=====================================
=====================================output=====================================
- A list item.
+
Summary
@@ -37,6 +38,109 @@ quoted sentence2
- A list item.
+
+
+
+quoted sentence1
+quoted sentence2
+
+
+- indented html is formatted as it is
+ asdf
+
+================================================================================
+`;
+
+exports[`beginning-tag-after-a-list-item.md - {"proseWrap":"never"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "never"
+ | printWidth
+=====================================input======================================
+- A list item.
+Summary
+
+
+- A list item.
+
+
+
+
+- A list item.
+
+
+quoted sentence1
+quoted sentence2
+
+
+- indented html is formatted as it is
+ asdf
+
+=====================================output=====================================
+- A list item.
+
+Summary
+
+
+- A list item.
+
+
+
+
+- A list item.
+
+
+
+quoted sentence1
+quoted sentence2
+
+
+- indented html is formatted as it is
+ asdf
+
+================================================================================
+`;
+
+exports[`beginning-tag-after-a-list-item.md - {"proseWrap":"preserve"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "preserve"
+ | printWidth
+=====================================input======================================
+- A list item.
+Summary
+
+
+- A list item.
+
+
+
+
+- A list item.
+
+
+quoted sentence1
+quoted sentence2
+
+
+- indented html is formatted as it is
+ asdf
+
+=====================================output=====================================
+- A list item.
+
+Summary
+
+
+- A list item.
+
+
+
+
+- A list item.
+
quoted sentence1
@@ -68,6 +172,292 @@ proseWrap: "always"
================================================================================
`;
+exports[`blank-line-between-htmls.md - {"proseWrap":"never"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "never"
+ | printWidth
+=====================================input======================================
+
+

+
+
+=====================================output=====================================
+
+
+
+
+================================================================================
+`;
+
+exports[`blank-line-between-htmls.md - {"proseWrap":"preserve"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "preserve"
+ | printWidth
+=====================================input======================================
+
+
+
+
+=====================================output=====================================
+
+
+
+
+================================================================================
+`;
+
+exports[`inline-html.md - {"proseWrap":"always"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "always"
+ | printWidth
+=====================================input======================================
+text
+text
+text
+
+text
+ text
+
+text
+ text
+
+
+
+
+Foo
+
+bar
+
+
+Foo
+
+
+bar
+
+
+Foo
+
+bar
+
+
+=====================================output=====================================
+text text text
+
+text text
+
+text text
+
+
+
+Foo
+
+bar
+
+
+Foo
+
+
+bar
+
+
+Foo
+
+bar
+
+
+================================================================================
+`;
+
+exports[`inline-html.md - {"proseWrap":"never"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "never"
+ | printWidth
+=====================================input======================================
+text
+text
+text
+
+text
+ text
+
+text
+ text
+
+
+
+
+Foo
+
+bar
+
+
+Foo
+
+
+bar
+
+
+Foo
+
+bar
+
+
+=====================================output=====================================
+text text text
+
+text text
+
+text text
+
+
+
+Foo
+
+bar
+
+
+Foo
+
+
+bar
+
+
+Foo
+
+bar
+
+
+================================================================================
+`;
+
+exports[`inline-html.md - {"proseWrap":"preserve"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "preserve"
+ | printWidth
+=====================================input======================================
+text
+text
+text
+
+text
+ text
+
+text
+ text
+
+
+
+
+Foo
+
+bar
+
+
+Foo
+
+
+bar
+
+
+Foo
+
+bar
+
+
+=====================================output=====================================
+text
+text
+text
+
+text
+text
+
+text
+text
+
+
+
+
+Foo
+
+bar
+
+
+Foo
+
+
+bar
+
+
+Foo
+
+bar
+
+
+================================================================================
+`;
+
+exports[`inline-vs-block.md - {"proseWrap":"always"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "always"
+ | printWidth
+=====================================input======================================
+- html
text
+- html text
+
+=====================================output=====================================
+- html
text
+- html text
+
+================================================================================
+`;
+
+exports[`inline-vs-block.md - {"proseWrap":"never"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "never"
+ | printWidth
+=====================================input======================================
+- html
text
+- html text
+
+=====================================output=====================================
+- html
text
+- html text
+
+================================================================================
+`;
+
+exports[`inline-vs-block.md - {"proseWrap":"preserve"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "preserve"
+ | printWidth
+=====================================input======================================
+- html
text
+- html text
+
+=====================================output=====================================
+- html
text
+- html text
+
+================================================================================
+`;
+
exports[`multiline.md - {"proseWrap":"always"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
@@ -127,6 +517,354 @@ proseWrap: "always"
================================================================================
`;
+exports[`multiline.md - {"proseWrap":"never"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "never"
+ | printWidth
+=====================================input======================================
+1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync.
+
+
+
+ | Test |
+ Table |
+
+
+
+ | will |
+ be |
+
+
+ | pushed |
+ When |
+
+
+ | Format on |
+ Save |
+
+
+
+
+=====================================output=====================================
+1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync.
+
+
+
+ | Test |
+ Table |
+
+
+
+ | will |
+ be |
+
+
+ | pushed |
+ When |
+
+
+ | Format on |
+ Save |
+
+
+
+
+================================================================================
+`;
+
+exports[`multiline.md - {"proseWrap":"preserve"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "preserve"
+ | printWidth
+=====================================input======================================
+1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync.
+
+
+
+ | Test |
+ Table |
+
+
+
+ | will |
+ be |
+
+
+ | pushed |
+ When |
+
+
+ | Format on |
+ Save |
+
+
+
+
+=====================================output=====================================
+1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync.
+
+
+
+ | Test |
+ Table |
+
+
+
+ | will |
+ be |
+
+
+ | pushed |
+ When |
+
+
+ | Format on |
+ Save |
+
+
+
+
+================================================================================
+`;
+
+exports[`multiline-attribute.md - {"proseWrap":"always"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "always"
+ | printWidth
+=====================================input======================================
+
+
+
+
+- In list
+
+ - In list
+
+
+
+
+
+> in blockquote
+>
+>
+>
+>
+
+text text text
+
+=====================================output=====================================
+
+
+
+
+- In list
+ - In list
+
+
+
+
+
+> in blockquote
+>
+>
+>
+>
+
+text text text
+
+================================================================================
+`;
+
+exports[`multiline-attribute.md - {"proseWrap":"never"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "never"
+ | printWidth
+=====================================input======================================
+
+
+
+
+- In list
+
+ - In list
+
+
+
+
+
+> in blockquote
+>
+>
+>
+>
+
+text text text
+
+=====================================output=====================================
+
+
+
+
+- In list
+ - In list
+
+
+
+
+
+> in blockquote
+>
+>
+>
+>
+
+text text text
+
+================================================================================
+`;
+
+exports[`multiline-attribute.md - {"proseWrap":"preserve"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "preserve"
+ | printWidth
+=====================================input======================================
+
+
+
+
+- In list
+
+ - In list
+
+
+
+
+
+> in blockquote
+>
+>
+>
+>
+
+text text text
+
+=====================================output=====================================
+
+
+
+
+- In list
+ - In list
+
+
+
+
+
+> in blockquote
+>
+>
+>
+>
+
+text text text
+
+================================================================================
+`;
+
exports[`multiline-with-trailing-space.md - {"proseWrap":"always"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
@@ -186,6 +924,120 @@ proseWrap: "always"
================================================================================
`;
+exports[`multiline-with-trailing-space.md - {"proseWrap":"never"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "never"
+ | printWidth
+=====================================input======================================
+1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync.
+
+
+
+ | Test |
+ Table |
+
+
+
+ | will |
+ be |
+
+
+ | pushed |
+ When |
+
+
+ | Format on |
+ Save |
+
+
+
+
+=====================================output=====================================
+1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync.
+
+
+
+ | Test |
+ Table |
+
+
+
+ | will |
+ be |
+
+
+ | pushed |
+ When |
+
+
+ | Format on |
+ Save |
+
+
+
+
+================================================================================
+`;
+
+exports[`multiline-with-trailing-space.md - {"proseWrap":"preserve"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "preserve"
+ | printWidth
+=====================================input======================================
+1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync.
+
+
+
+ | Test |
+ Table |
+
+
+
+ | will |
+ be |
+
+
+ | pushed |
+ When |
+
+
+ | Format on |
+ Save |
+
+
+
+
+=====================================output=====================================
+1. Some test text, the goal is to have the html table below nested within this number. When formating on save Prettier will continue to add an indent each time pushing the table further and further out of sync.
+
+
+
+ | Test |
+ Table |
+
+
+
+ | will |
+ be |
+
+
+ | pushed |
+ When |
+
+
+ | Format on |
+ Save |
+
+
+
+
+================================================================================
+`;
+
exports[`simple.md - {"proseWrap":"always"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
@@ -200,3 +1052,33 @@ proseWrap: "always"
================================================================================
`;
+
+exports[`simple.md - {"proseWrap":"never"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "never"
+ | printWidth
+=====================================input======================================
+
+
+=====================================output=====================================
+
+
+================================================================================
+`;
+
+exports[`simple.md - {"proseWrap":"preserve"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "preserve"
+ | printWidth
+=====================================input======================================
+
+
+=====================================output=====================================
+
+
+================================================================================
+`;
diff --git a/tests/format/markdown/html/format.test.js b/tests/format/markdown/html/format.test.js
index 6ecc0af19..e672fe578 100644
--- a/tests/format/markdown/html/format.test.js
+++ b/tests/format/markdown/html/format.test.js
@@ -1 +1,3 @@
runFormatTest(import.meta, ["markdown"], { proseWrap: "always" });
+runFormatTest(import.meta, ["markdown"], { proseWrap: "never" });
+runFormatTest(import.meta, ["markdown"], { proseWrap: "preserve" });
diff --git a/tests/format/markdown/html/inline-html.md b/tests/format/markdown/html/inline-html.md
new file mode 100644
index 000000000..946088d52
--- /dev/null
+++ b/tests/format/markdown/html/inline-html.md
@@ -0,0 +1,28 @@
+text
+text
+text
+
+text
+ text
+
+text
+ text
+
+
+
+
+Foo
+
+bar
+
+
+Foo
+
+
+bar
+
+
+Foo
+
+bar
+
diff --git a/tests/format/markdown/html/inline-vs-block.md b/tests/format/markdown/html/inline-vs-block.md
new file mode 100644
index 000000000..dc3fdd698
--- /dev/null
+++ b/tests/format/markdown/html/inline-vs-block.md
@@ -0,0 +1,2 @@
+- html
text
+- html text
diff --git a/tests/format/markdown/html/multiline-attribute.md b/tests/format/markdown/html/multiline-attribute.md
new file mode 100644
index 000000000..6dc4cedc8
--- /dev/null
+++ b/tests/format/markdown/html/multiline-attribute.md
@@ -0,0 +1,33 @@
+
+
+
+
+- In list
+
+ - In list
+
+
+
+
+
+> in blockquote
+>
+>
+>
+>
+
+text text text
diff --git a/tests/format/markdown/image/__snapshots__/format.test.js.snap b/tests/format/markdown/image/__snapshots__/format.test.js.snap
index b3b9ee016..06c678c9f 100644
--- a/tests/format/markdown/image/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/image/__snapshots__/format.test.js.snap
@@ -1,5 +1,54 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
+exports[`alt.md - {"proseWrap":"always"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "always"
+ | printWidth
+=====================================input======================================
+[Image-reference]: a.png
+[ Image reference with \`\`backtick\`\` ]: a.png
+[ Image reference with \`\`backtick \` ]: a.png
+
+
+- 
+- 
+- ![ Image reference alt with \`\`backtick\`\` ][Image-reference]
+- ![ Image reference alt with \`\`backtick \` ][Image-reference]
+- ![ Image reference with \`\`backtick\`\` ][]
+- ![ Image reference with \`\`backtick \` ][]
+
+
+- ![ Image alt with [ square brackets ] ](a.png)
+- ![ Image alt with [[square brackets]] ](a.png)
+- ![ Image alt with [ square brackets ] ][Image-reference]
+- ![ Image alt with [[square brackets]] ][Image-reference]
+
+=====================================output=====================================
+[Image-reference]: a.png
+[ Image reference with \`\`backtick\`\` ]: a.png
+[ Image reference with \`\`backtick \` ]: a.png
+
+
+
+- 
+- 
+- ![ Image reference alt with \`\`backtick\`\` ][Image-reference]
+- ![ Image reference alt with \`\`backtick \` ][Image-reference]
+- ![ Image reference with \`\`backtick\`\` ][]
+- ![ Image reference with \`\`backtick \` ][]
+
+
+
+- ![ Image alt with [ square brackets ] ](a.png)
+- ![ Image alt with [[square brackets]] ](a.png)
+- ![ Image alt with [ square brackets ] ][Image-reference]
+- ![ Image alt with [[square brackets]] ][Image-reference]
+
+================================================================================
+`;
+
exports[`simple.md - {"proseWrap":"always"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
diff --git a/tests/format/markdown/image/alt.md b/tests/format/markdown/image/alt.md
new file mode 100644
index 000000000..0d8a9b86a
--- /dev/null
+++ b/tests/format/markdown/image/alt.md
@@ -0,0 +1,17 @@
+[Image-reference]: a.png
+[ Image reference with ``backtick`` ]: a.png
+[ Image reference with ``backtick ` ]: a.png
+
+
+- 
+- 
+- ![ Image reference alt with ``backtick`` ][Image-reference]
+- ![ Image reference alt with ``backtick ` ][Image-reference]
+- ![ Image reference with ``backtick`` ][]
+- ![ Image reference with ``backtick ` ][]
+
+
+- ![ Image alt with [ square brackets ] ](a.png)
+- ![ Image alt with [[square brackets]] ](a.png)
+- ![ Image alt with [ square brackets ] ][Image-reference]
+- ![ Image alt with [[square brackets]] ][Image-reference]
diff --git a/tests/format/markdown/link/__snapshots__/format.test.js.snap b/tests/format/markdown/link/__snapshots__/format.test.js.snap
index 5feb9bd5d..c9ae6e70d 100644
--- a/tests/format/markdown/link/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/link/__snapshots__/format.test.js.snap
@@ -155,6 +155,37 @@ proseWrap: "always"
================================================================================
`;
+exports[`escape-in-link.md - {"proseWrap":"always","singleQuote":true} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "always"
+singleQuote: true
+ | printWidth
+=====================================input======================================
+"https\\://developer.mozilla.org" x
+
+=====================================output=====================================
+"https\\://developer.mozilla.org" x
+
+================================================================================
+`;
+
+exports[`escape-in-link.md - {"proseWrap":"always"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "always"
+ | printWidth
+=====================================input======================================
+"https\\://developer.mozilla.org" x
+
+=====================================output=====================================
+"https\\://developer.mozilla.org" x
+
+================================================================================
+`;
+
exports[`long.md - {"proseWrap":"always","singleQuote":true} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
@@ -267,11 +298,11 @@ singleQuote: true
[a](https://example.com "'") [a](https://example.com ')')
[a](https://example.com ')')
-[a](https://example.com '"') [a](https://example.com "'")
-[a](https://example.com ')')
+[a](https://example.com '\\\\"') [a](https://example.com "\\\\'")
+[a](https://example.com '\\\\)')
-[a](https://example.com "'") [a](https://example.com '"')
-[a](https://example.com '"')
+[a](https://example.com "\\\\'") [a](https://example.com '\\\\"')
+[a](https://example.com '\\\\"')
@@ -330,11 +361,11 @@ proseWrap: "always"
[a](https://example.com "'") [a](https://example.com ")")
[a](https://example.com ")")
-[a](https://example.com '"') [a](https://example.com "'")
-[a](https://example.com ")")
+[a](https://example.com '\\\\"') [a](https://example.com "\\\\'")
+[a](https://example.com "\\\\)")
-[a](https://example.com "'") [a](https://example.com '"')
-[a](https://example.com '"')
+[a](https://example.com "\\\\'") [a](https://example.com '\\\\"')
+[a](https://example.com '\\\\"')
diff --git a/tests/format/markdown/link/escape-in-link.md b/tests/format/markdown/link/escape-in-link.md
new file mode 100644
index 000000000..83480c6e1
--- /dev/null
+++ b/tests/format/markdown/link/escape-in-link.md
@@ -0,0 +1 @@
+"https\://developer.mozilla.org" x
diff --git a/tests/format/markdown/linkReference/__snapshots__/format.test.js.snap b/tests/format/markdown/linkReference/__snapshots__/format.test.js.snap
index 98a6d260c..ddc84b144 100644
--- a/tests/format/markdown/linkReference/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/linkReference/__snapshots__/format.test.js.snap
@@ -9,9 +9,14 @@ proseWrap: "always"
=====================================input======================================
[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落][]
+[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落]: /abc
+
=====================================output=====================================
[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落][]
+[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落]:
+ /abc
+
================================================================================
`;
@@ -24,9 +29,13 @@ proseWrap: "never"
=====================================input======================================
[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落][]
+[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落]: /abc
+
=====================================output=====================================
[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落][]
+[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落]: /abc
+
================================================================================
`;
@@ -233,25 +242,21 @@ proseWrap: "always"
[other-ref]:
https://example.com
(Shakespeare's "Romeo and Juliet" is a famous play)
-
-[a]: https://example.com "\\"" [a]: https://example.com '\\"' [a]:
-https://example.com (\\")
-
+[a]: https://example.com '"'
+[a]: https://example.com '"'
+[a]: https://example.com '"'
+[a]: https://example.com "'"
+[a]: https://example.com "'"
[a]: https://example.com "'"
-
-[a]: https://example.com '\\'' [a]: https://example.com (\\')
-
[a]: https://example.com "'"
[a]: https://example.com ")"
-
-[a]: https://example.com (\\))
-
-[a]: https://example.com "\\\\\\"" [a]: https://example.com '\\\\\\'' [a]:
-https://example.com (\\\\\\))
-
-[a]: https://example.com "'"
-[a]: https://example.com '"'
-[a]: https://example.com '"'
+[a]: https://example.com ")"
+[a]: https://example.com '\\\\"'
+[a]: https://example.com "\\\\'"
+[a]: https://example.com "\\\\)"
+[a]: https://example.com "\\\\'"
+[a]: https://example.com '\\\\"'
+[a]: https://example.com '\\\\"'
[a]: https://example.com "\\\\a\\\\a"
[a]: https://example.com "\\\\a\\\\a"
[a]: https://example.com "\\\\a\\\\a"
@@ -317,23 +322,21 @@ proseWrap: "never"
=====================================output=====================================
[ref]: https://example.com "bar"
[other-ref]: https://example.com (Shakespeare's "Romeo and Juliet" is a famous play)
-
-[a]: https://example.com "\\"" [a]: https://example.com '\\"' [a]: https://example.com (\\")
-
+[a]: https://example.com '"'
+[a]: https://example.com '"'
+[a]: https://example.com '"'
+[a]: https://example.com "'"
+[a]: https://example.com "'"
[a]: https://example.com "'"
-
-[a]: https://example.com '\\'' [a]: https://example.com (\\')
-
[a]: https://example.com "'"
[a]: https://example.com ")"
-
-[a]: https://example.com (\\))
-
-[a]: https://example.com "\\\\\\"" [a]: https://example.com '\\\\\\'' [a]: https://example.com (\\\\\\))
-
-[a]: https://example.com "'"
-[a]: https://example.com '"'
-[a]: https://example.com '"'
+[a]: https://example.com ")"
+[a]: https://example.com '\\\\"'
+[a]: https://example.com "\\\\'"
+[a]: https://example.com "\\\\)"
+[a]: https://example.com "\\\\'"
+[a]: https://example.com '\\\\"'
+[a]: https://example.com '\\\\"'
[a]: https://example.com "\\\\a\\\\a"
[a]: https://example.com "\\\\a\\\\a"
[a]: https://example.com "\\\\a\\\\a"
diff --git a/tests/format/markdown/linkReference/case-and-space/__snapshots__/format.test.js.snap b/tests/format/markdown/linkReference/case-and-space/__snapshots__/format.test.js.snap
index d4c3e883d..87ac486d8 100644
--- a/tests/format/markdown/linkReference/case-and-space/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/linkReference/case-and-space/__snapshots__/format.test.js.snap
@@ -9,10 +9,14 @@ printWidth: 80
# \`linkReference\`
[ See \`AsyncGeneratorFunction\` ][ See \`AsyncGeneratorFunction\` ]
+[ See \`AsyncGeneratorFunction\` label ][ See \`AsyncGeneratorFunction\` ]
+[ See \`AsyncGeneratorFunction\` ][]
# \`imageReference\`
![ See \`AsyncGeneratorFunction\` ][ See \`AsyncGeneratorFunction\` ]
+![ See \`AsyncGeneratorFunction\` alt ][ See \`AsyncGeneratorFunction\` ]
+![ See \`AsyncGeneratorFunction\` ][]
# \`definition\`
@@ -30,10 +34,14 @@ printWidth: 80
# \`linkReference\`
[ See \`AsyncGeneratorFunction\` ][ See \`AsyncGeneratorFunction\` ]
+[ See \`AsyncGeneratorFunction\` label ][ See \`AsyncGeneratorFunction\` ]
+[ See \`AsyncGeneratorFunction\` ][]
# \`imageReference\`
![ See \`AsyncGeneratorFunction\` ][ See \`AsyncGeneratorFunction\` ]
+![ See \`AsyncGeneratorFunction\` alt ][ See \`AsyncGeneratorFunction\` ]
+![ See \`AsyncGeneratorFunction\` ][]
# \`definition\`
diff --git a/tests/format/markdown/linkReference/case-and-space/case-and-space.md b/tests/format/markdown/linkReference/case-and-space/case-and-space.md
index f849494fd..2db6be628 100644
--- a/tests/format/markdown/linkReference/case-and-space/case-and-space.md
+++ b/tests/format/markdown/linkReference/case-and-space/case-and-space.md
@@ -1,10 +1,14 @@
# `linkReference`
[ See `AsyncGeneratorFunction` ][ See `AsyncGeneratorFunction` ]
+[ See `AsyncGeneratorFunction` label ][ See `AsyncGeneratorFunction` ]
+[ See `AsyncGeneratorFunction` ][]
# `imageReference`
![ See `AsyncGeneratorFunction` ][ See `AsyncGeneratorFunction` ]
+![ See `AsyncGeneratorFunction` alt ][ See `AsyncGeneratorFunction` ]
+![ See `AsyncGeneratorFunction` ][]
# `definition`
diff --git a/tests/format/markdown/linkReference/cjk.md b/tests/format/markdown/linkReference/cjk.md
index fb0610449..12c5e3e55 100644
--- a/tests/format/markdown/linkReference/cjk.md
+++ b/tests/format/markdown/linkReference/cjk.md
@@ -1 +1,3 @@
[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落][]
+
+[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落]: /abc
diff --git a/tests/format/markdown/liquid/__snapshots__/format.test.js.snap b/tests/format/markdown/liquid/__snapshots__/format.test.js.snap
index aa960cc54..2bab54ade 100644
--- a/tests/format/markdown/liquid/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/liquid/__snapshots__/format.test.js.snap
@@ -83,8 +83,8 @@ proseWrap: "always"
Braces {% doesn't match so these words should not be considered as *liquid node* }}
=====================================output=====================================
-Braces {% doesn't match so these words should not be considered as _liquid node_
-}}
+Braces
+{% doesn't match so these words should not be considered as *liquid node* }}
================================================================================
`;
@@ -99,7 +99,7 @@ printWidth: 80
Braces {% doesn't match so these words should not be considered as *liquid node* }}
=====================================output=====================================
-Braces {% doesn't match so these words should not be considered as _liquid node_ }}
+Braces {% doesn't match so these words should not be considered as *liquid node* }}
================================================================================
`;
diff --git a/tests/format/markdown/list/__snapshots__/format.test.js.snap b/tests/format/markdown/list/__snapshots__/format.test.js.snap
index 777295a4e..1ffd1f15f 100644
--- a/tests/format/markdown/list/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/list/__snapshots__/format.test.js.snap
@@ -1056,6 +1056,1121 @@ proseWrap: "always"
================================================================================
`;
+exports[`followed-by-indented-things.md - {"proseWrap":"always","tabWidth":0} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "always"
+tabWidth: 0
+ | printWidth
+=====================================input======================================
+- foo
+
+ top level indented code block
+
+---
+
+- foo
+
+ list item text
+
+---
+
+ - foo
+
+ top level indented code block
+
+---
+
+ - foo
+
+ indented code block in bullet
+
+---
+
+1. foo
+
+ top level indented code block
+
+---
+
+1. foo
+
+ list item text
+
+---
+
+ 1. foo
+
+ top level indented code block
+
+
+---
+
+ 1. foo
+
+ indented code block in numbered item
+
+---
+
+- [ ] foo
+
+ top level indented code block
+
+---
+
+ - [ ] foo
+
+ indented code block in checkbox item
+
+---
+
+ - item 1
+ - item 2
+
+ top level indented code block
+
+---
+
+- item 1
+ - item 1-1
+ - item 1-2
+
+ naive paragraph in item 1
+
+---
+
+ - item 1
+ - item 1-1
+ - item 1-2
+
+ top level indented code block
+
+---
+
+
+ - item 1
+ - item 1-1
+ - item 1-2
+ - item 2
+
+ top level indented code block
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+
+ naive paragraph in item 1
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+100. item 1
+
+ top level indented code block
+
+---
+
+ - item 1
+ > quote
+
+ text
+
+ top level indented code block
+
+---
+
+ - item 1
+ - item 1-1
+ - item 1-2
+
+ indented code block
+
+ top level indented code block
+
+=====================================output=====================================
+- foo
+
+
+ top level indented code block
+
+---
+
+- foo
+
+ list item text
+
+---
+
+ - foo
+
+
+ top level indented code block
+
+---
+
+- foo
+
+ indented code block in bullet
+
+---
+
+1. foo
+
+
+ top level indented code block
+
+---
+
+1. foo
+
+ list item text
+
+---
+
+ 1. foo
+
+
+ top level indented code block
+
+---
+
+1. foo
+
+ indented code block in numbered item
+
+---
+
+- [ ] foo
+
+
+ top level indented code block
+
+---
+
+- [ ] foo
+
+ indented code block in checkbox item
+
+---
+
+ - item 1
+ - item 2
+
+
+ top level indented code block
+
+---
+
+- item 1
+ - item 1-1
+ - item 1-2
+
+ naive paragraph in item 1
+
+---
+
+- item 1
+ - item 1-1
+ - item 1-2
+
+
+ top level indented code block
+
+---
+
+ - item 1
+ - item 1-1
+ - item 1-2
+ - item 2
+
+
+ top level indented code block
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+
+ naive paragraph in item 1
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+2. item 1
+
+
+ top level indented code block
+
+---
+
+- item 1
+
+ > quote
+
+ text
+
+
+ top level indented code block
+
+---
+
+- item 1
+ - item 1-1
+ - item 1-2
+
+
+ indented code block
+
+
+ top level indented code block
+
+================================================================================
+`;
+
+exports[`followed-by-indented-things.md - {"proseWrap":"always","tabWidth":4} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "always"
+tabWidth: 4
+ | printWidth
+=====================================input======================================
+- foo
+
+ top level indented code block
+
+---
+
+- foo
+
+ list item text
+
+---
+
+ - foo
+
+ top level indented code block
+
+---
+
+ - foo
+
+ indented code block in bullet
+
+---
+
+1. foo
+
+ top level indented code block
+
+---
+
+1. foo
+
+ list item text
+
+---
+
+ 1. foo
+
+ top level indented code block
+
+
+---
+
+ 1. foo
+
+ indented code block in numbered item
+
+---
+
+- [ ] foo
+
+ top level indented code block
+
+---
+
+ - [ ] foo
+
+ indented code block in checkbox item
+
+---
+
+ - item 1
+ - item 2
+
+ top level indented code block
+
+---
+
+- item 1
+ - item 1-1
+ - item 1-2
+
+ naive paragraph in item 1
+
+---
+
+ - item 1
+ - item 1-1
+ - item 1-2
+
+ top level indented code block
+
+---
+
+
+ - item 1
+ - item 1-1
+ - item 1-2
+ - item 2
+
+ top level indented code block
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+
+ naive paragraph in item 1
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+100. item 1
+
+ top level indented code block
+
+---
+
+ - item 1
+ > quote
+
+ text
+
+ top level indented code block
+
+---
+
+ - item 1
+ - item 1-1
+ - item 1-2
+
+ indented code block
+
+ top level indented code block
+
+=====================================output=====================================
+- foo
+
+
+ top level indented code block
+
+---
+
+- foo
+
+ list item text
+
+---
+
+ - foo
+
+
+ top level indented code block
+
+---
+
+- foo
+
+ indented code block in bullet
+
+---
+
+1. foo
+
+
+ top level indented code block
+
+---
+
+1. foo
+
+ list item text
+
+---
+
+ 1. foo
+
+
+ top level indented code block
+
+---
+
+1. foo
+
+ indented code block in numbered item
+
+---
+
+- [ ] foo
+
+
+ top level indented code block
+
+---
+
+- [ ] foo
+
+ indented code block in checkbox item
+
+---
+
+ - item 1
+ - item 2
+
+
+ top level indented code block
+
+---
+
+- item 1
+ - item 1-1
+ - item 1-2
+
+ naive paragraph in item 1
+
+---
+
+- item 1
+ - item 1-1
+ - item 1-2
+
+
+ top level indented code block
+
+---
+
+ - item 1
+ - item 1-1
+ - item 1-2
+ - item 2
+
+
+ top level indented code block
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+
+ naive paragraph in item 1
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+2. item 1
+
+
+ top level indented code block
+
+---
+
+- item 1
+
+ > quote
+
+ text
+
+
+ top level indented code block
+
+---
+
+- item 1
+ - item 1-1
+ - item 1-2
+
+
+ indented code block
+
+
+ top level indented code block
+
+================================================================================
+`;
+
+exports[`followed-by-indented-things.md - {"proseWrap":"always","tabWidth":999} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "always"
+tabWidth: 999
+ | printWidth
+=====================================input======================================
+- foo
+
+ top level indented code block
+
+---
+
+- foo
+
+ list item text
+
+---
+
+ - foo
+
+ top level indented code block
+
+---
+
+ - foo
+
+ indented code block in bullet
+
+---
+
+1. foo
+
+ top level indented code block
+
+---
+
+1. foo
+
+ list item text
+
+---
+
+ 1. foo
+
+ top level indented code block
+
+
+---
+
+ 1. foo
+
+ indented code block in numbered item
+
+---
+
+- [ ] foo
+
+ top level indented code block
+
+---
+
+ - [ ] foo
+
+ indented code block in checkbox item
+
+---
+
+ - item 1
+ - item 2
+
+ top level indented code block
+
+---
+
+- item 1
+ - item 1-1
+ - item 1-2
+
+ naive paragraph in item 1
+
+---
+
+ - item 1
+ - item 1-1
+ - item 1-2
+
+ top level indented code block
+
+---
+
+
+ - item 1
+ - item 1-1
+ - item 1-2
+ - item 2
+
+ top level indented code block
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+
+ naive paragraph in item 1
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+100. item 1
+
+ top level indented code block
+
+---
+
+ - item 1
+ > quote
+
+ text
+
+ top level indented code block
+
+---
+
+ - item 1
+ - item 1-1
+ - item 1-2
+
+ indented code block
+
+ top level indented code block
+
+=====================================output=====================================
+- foo
+
+
+ top level indented code block
+
+---
+
+- foo
+
+ list item text
+
+---
+
+ - foo
+
+
+ top level indented code block
+
+---
+
+- foo
+
+ indented code block in bullet
+
+---
+
+1. foo
+
+
+ top level indented code block
+
+---
+
+1. foo
+
+ list item text
+
+---
+
+ 1. foo
+
+
+ top level indented code block
+
+---
+
+1. foo
+
+ indented code block in numbered item
+
+---
+
+- [ ] foo
+
+
+ top level indented code block
+
+---
+
+- [ ] foo
+
+ indented code block in checkbox item
+
+---
+
+ - item 1
+ - item 2
+
+
+ top level indented code block
+
+---
+
+- item 1
+ - item 1-1
+ - item 1-2
+
+ naive paragraph in item 1
+
+---
+
+- item 1
+ - item 1-1
+ - item 1-2
+
+
+ top level indented code block
+
+---
+
+ - item 1
+ - item 1-1
+ - item 1-2
+ - item 2
+
+
+ top level indented code block
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+
+ naive paragraph in item 1
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+2. item 1
+
+
+ top level indented code block
+
+---
+
+- item 1
+
+ > quote
+
+ text
+
+
+ top level indented code block
+
+---
+
+- item 1
+ - item 1-1
+ - item 1-2
+
+
+ indented code block
+
+
+ top level indented code block
+
+================================================================================
+`;
+
+exports[`followed-by-indented-things.md - {"proseWrap":"always"} format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+proseWrap: "always"
+ | printWidth
+=====================================input======================================
+- foo
+
+ top level indented code block
+
+---
+
+- foo
+
+ list item text
+
+---
+
+ - foo
+
+ top level indented code block
+
+---
+
+ - foo
+
+ indented code block in bullet
+
+---
+
+1. foo
+
+ top level indented code block
+
+---
+
+1. foo
+
+ list item text
+
+---
+
+ 1. foo
+
+ top level indented code block
+
+
+---
+
+ 1. foo
+
+ indented code block in numbered item
+
+---
+
+- [ ] foo
+
+ top level indented code block
+
+---
+
+ - [ ] foo
+
+ indented code block in checkbox item
+
+---
+
+ - item 1
+ - item 2
+
+ top level indented code block
+
+---
+
+- item 1
+ - item 1-1
+ - item 1-2
+
+ naive paragraph in item 1
+
+---
+
+ - item 1
+ - item 1-1
+ - item 1-2
+
+ top level indented code block
+
+---
+
+
+ - item 1
+ - item 1-1
+ - item 1-2
+ - item 2
+
+ top level indented code block
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+
+ naive paragraph in item 1
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+100. item 1
+
+ top level indented code block
+
+---
+
+ - item 1
+ > quote
+
+ text
+
+ top level indented code block
+
+---
+
+ - item 1
+ - item 1-1
+ - item 1-2
+
+ indented code block
+
+ top level indented code block
+
+=====================================output=====================================
+- foo
+
+
+ top level indented code block
+
+---
+
+- foo
+
+ list item text
+
+---
+
+ - foo
+
+
+ top level indented code block
+
+---
+
+- foo
+
+ indented code block in bullet
+
+---
+
+1. foo
+
+
+ top level indented code block
+
+---
+
+1. foo
+
+ list item text
+
+---
+
+ 1. foo
+
+
+ top level indented code block
+
+---
+
+1. foo
+
+ indented code block in numbered item
+
+---
+
+- [ ] foo
+
+
+ top level indented code block
+
+---
+
+- [ ] foo
+
+ indented code block in checkbox item
+
+---
+
+ - item 1
+ - item 2
+
+
+ top level indented code block
+
+---
+
+- item 1
+ - item 1-1
+ - item 1-2
+
+ naive paragraph in item 1
+
+---
+
+- item 1
+ - item 1-1
+ - item 1-2
+
+
+ top level indented code block
+
+---
+
+ - item 1
+ - item 1-1
+ - item 1-2
+ - item 2
+
+
+ top level indented code block
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+
+ naive paragraph in item 1
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+2. item 1
+
+
+ top level indented code block
+
+---
+
+- item 1
+
+ > quote
+
+ text
+
+
+ top level indented code block
+
+---
+
+- item 1
+ - item 1-1
+ - item 1-2
+
+
+ indented code block
+
+
+ top level indented code block
+
+================================================================================
+`;
+
exports[`git-diff-friendly.md - {"proseWrap":"always","tabWidth":0} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
@@ -2090,16 +3205,16 @@ tabWidth: 0
e e e
=====================================output=====================================
- a a
- b b
- c c
- d d
+ b b
+ c c
+ d d
e e
1. a a a
- b b b
+ b b b
c c c
- d d d
- e e e
+ d d d
+ e e e
================================================================================
`;
@@ -2125,16 +3240,16 @@ tabWidth: 4
e e e
=====================================output=====================================
- a a
- b b
- c c
- d d
+ b b
+ c c
+ d d
e e
1. a a a
- b b b
+ b b b
c c c
- d d d
- e e e
+ d d d
+ e e e
================================================================================
`;
@@ -2160,16 +3275,16 @@ tabWidth: 999
e e e
=====================================output=====================================
- a a
- b b
- c c
- d d
+ b b
+ c c
+ d d
e e
1. a a a
- b b b
+ b b b
c c c
- d d d
- e e e
+ d d d
+ e e e
================================================================================
`;
@@ -2194,16 +3309,16 @@ proseWrap: "always"
e e e
=====================================output=====================================
- a a
- b b
- c c
- d d
+ b b
+ c c
+ d d
e e
1. a a a
- b b b
+ b b b
c c c
- d d d
- e e e
+ d d d
+ e e e
================================================================================
`;
@@ -3072,7 +4187,9 @@ tabWidth: 0
- Top level list item 1
- Top level list item 2
- Nested List item 1
- - Nested List item 2 _ Sub-Nested List item 1 _ Sub-Nested List item 2
+ - Nested List item 2
+ - Sub-Nested List item 1
+ - Sub-Nested List item 2
================================================================================
`;
@@ -3116,7 +4233,9 @@ tabWidth: 4
- Top level list item 1
- Top level list item 2
- Nested List item 1
- - Nested List item 2 _ Sub-Nested List item 1 _ Sub-Nested List item 2
+ - Nested List item 2
+ - Sub-Nested List item 1
+ - Sub-Nested List item 2
================================================================================
`;
@@ -3160,7 +4279,9 @@ tabWidth: 999
- Top level list item 1
- Top level list item 2
- Nested List item 1
- - Nested List item 2 _ Sub-Nested List item 1 _ Sub-Nested List item 2
+ - Nested List item 2
+ - Sub-Nested List item 1
+ - Sub-Nested List item 2
================================================================================
`;
@@ -3203,7 +4324,9 @@ proseWrap: "always"
- Top level list item 1
- Top level list item 2
- Nested List item 1
- - Nested List item 2 _ Sub-Nested List item 1 _ Sub-Nested List item 2
+ - Nested List item 2
+ - Sub-Nested List item 1
+ - Sub-Nested List item 2
================================================================================
`;
diff --git a/tests/format/markdown/list/followed-by-indented-things.md b/tests/format/markdown/list/followed-by-indented-things.md
new file mode 100644
index 000000000..3be74e9e2
--- /dev/null
+++ b/tests/format/markdown/list/followed-by-indented-things.md
@@ -0,0 +1,127 @@
+- foo
+
+ top level indented code block
+
+---
+
+- foo
+
+ list item text
+
+---
+
+ - foo
+
+ top level indented code block
+
+---
+
+ - foo
+
+ indented code block in bullet
+
+---
+
+1. foo
+
+ top level indented code block
+
+---
+
+1. foo
+
+ list item text
+
+---
+
+ 1. foo
+
+ top level indented code block
+
+
+---
+
+ 1. foo
+
+ indented code block in numbered item
+
+---
+
+- [ ] foo
+
+ top level indented code block
+
+---
+
+ - [ ] foo
+
+ indented code block in checkbox item
+
+---
+
+ - item 1
+ - item 2
+
+ top level indented code block
+
+---
+
+- item 1
+ - item 1-1
+ - item 1-2
+
+ naive paragraph in item 1
+
+---
+
+ - item 1
+ - item 1-1
+ - item 1-2
+
+ top level indented code block
+
+---
+
+
+ - item 1
+ - item 1-1
+ - item 1-2
+ - item 2
+
+ top level indented code block
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+
+ naive paragraph in item 1
+
+---
+
+1. item 1
+ 1. item 1-1
+ 2. item 1-2
+100. item 1
+
+ top level indented code block
+
+---
+
+ - item 1
+ > quote
+
+ text
+
+ top level indented code block
+
+---
+
+ - item 1
+ - item 1-1
+ - item 1-2
+
+ indented code block
+
+ top level indented code block
diff --git a/tests/format/markdown/list/task-list/__snapshots__/format.test.js.snap b/tests/format/markdown/list/task-list/__snapshots__/format.test.js.snap
new file mode 100644
index 000000000..2291eea53
--- /dev/null
+++ b/tests/format/markdown/list/task-list/__snapshots__/format.test.js.snap
@@ -0,0 +1,37 @@
+// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
+
+exports[`in-html.md format 1`] = `
+====================================options=====================================
+parsers: ["markdown"]
+printWidth: 80
+ | printWidth
+=====================================input======================================
+
+ Checklist
+
+- [ ] I checked for duplicate issues.
+
+
+ Checklist
+
+- [ ] I checked for duplicate issues.
+- [ ] I checked for duplicate issues.
+
+
+=====================================output=====================================
+
+ Checklist
+
+- [ ] I checked for duplicate issues.
+
+
+
+ Checklist
+
+- [ ] I checked for duplicate issues.
+- [ ] I checked for duplicate issues.
+
+
+
+================================================================================
+`;
diff --git a/tests/format/markdown/list/task-list/format.test.js b/tests/format/markdown/list/task-list/format.test.js
new file mode 100644
index 000000000..7df6c9eaa
--- /dev/null
+++ b/tests/format/markdown/list/task-list/format.test.js
@@ -0,0 +1 @@
+runFormatTest(import.meta, ["markdown"]);
diff --git a/tests/format/markdown/list/task-list/in-html.md b/tests/format/markdown/list/task-list/in-html.md
new file mode 100644
index 000000000..98736f5e2
--- /dev/null
+++ b/tests/format/markdown/list/task-list/in-html.md
@@ -0,0 +1,11 @@
+
+ Checklist
+
+- [ ] I checked for duplicate issues.
+
+
+ Checklist
+
+- [ ] I checked for duplicate issues.
+- [ ] I checked for duplicate issues.
+
diff --git a/tests/format/markdown/markdown/__snapshots__/format.test.js.snap b/tests/format/markdown/markdown/__snapshots__/format.test.js.snap
index 97cc3b6c8..d1d62bbb7 100644
--- a/tests/format/markdown/markdown/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/markdown/__snapshots__/format.test.js.snap
@@ -4166,9 +4166,11 @@ This is a paragraph.
This is a paragraph.
-# Header 1
+Header 1
+========
-## Header 2
+Header 2
+--------
Header 1
========
@@ -4570,9 +4572,11 @@ This is a paragraph.
This is a paragraph.
-# Header 1
+Header 1
+========
-## Header 2
+Header 2
+--------
Header 1
========
diff --git a/tests/format/markdown/math/__snapshots__/format.test.js.snap b/tests/format/markdown/math/__snapshots__/format.test.js.snap
index 3043ce46e..383d3c9e7 100644
--- a/tests/format/markdown/math/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/math/__snapshots__/format.test.js.snap
@@ -55,7 +55,7 @@ Paragraph with $14 million. But if more $dollars on the same line...
=====================================output=====================================
$10 - $20
-Paragraph with $14 million. But if more $dollars on the same line...
+Paragraph with $14 million. But if more $dollars on the same line...
================================================================================
`;
@@ -226,8 +226,7 @@ $$
---
-$$
-must
+$$ must
\\alpha
$$
diff --git a/tests/format/markdown/paragraph/__snapshots__/format.test.js.snap b/tests/format/markdown/paragraph/__snapshots__/format.test.js.snap
index b1d77fd59..00bb413dd 100644
--- a/tests/format/markdown/paragraph/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/paragraph/__snapshots__/format.test.js.snap
@@ -159,7 +159,7 @@ proseWrap: "always"
It removes all original styling[*](#styling-footnote) and ensures that all outputted code conforms to a consistent style. (See this [blog post](http://jlongster.com/A-Prettier-Formatter))
=====================================output=====================================
-It removes all original styling[\\*](#styling-footnote) and ensures that all
+It removes all original styling[*](#styling-footnote) and ensures that all
outputted code conforms to a consistent style. (See this
[blog post](http://jlongster.com/A-Prettier-Formatter))
@@ -176,7 +176,7 @@ proseWrap: "never"
It removes all original styling[*](#styling-footnote) and ensures that all outputted code conforms to a consistent style. (See this [blog post](http://jlongster.com/A-Prettier-Formatter))
=====================================output=====================================
-It removes all original styling[\\*](#styling-footnote) and ensures that all outputted code conforms to a consistent style. (See this [blog post](http://jlongster.com/A-Prettier-Formatter))
+It removes all original styling[*](#styling-footnote) and ensures that all outputted code conforms to a consistent style. (See this [blog post](http://jlongster.com/A-Prettier-Formatter))
================================================================================
`;
@@ -191,7 +191,7 @@ proseWrap: "preserve"
It removes all original styling[*](#styling-footnote) and ensures that all outputted code conforms to a consistent style. (See this [blog post](http://jlongster.com/A-Prettier-Formatter))
=====================================output=====================================
-It removes all original styling[\\*](#styling-footnote) and ensures that all outputted code conforms to a consistent style. (See this [blog post](http://jlongster.com/A-Prettier-Formatter))
+It removes all original styling[*](#styling-footnote) and ensures that all outputted code conforms to a consistent style. (See this [blog post](http://jlongster.com/A-Prettier-Formatter))
================================================================================
`;
diff --git a/tests/format/markdown/splitCjkText/__snapshots__/format.test.js.snap b/tests/format/markdown/splitCjkText/__snapshots__/format.test.js.snap
index 5ebabf5f9..2dff975e3 100644
--- a/tests/format/markdown/splitCjkText/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/splitCjkText/__snapshots__/format.test.js.snap
@@ -34,8 +34,7 @@ nasalカ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク
nasalカ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚
-かつてはワ行のワ、ヰ、ヱ、ヲに濁点を付して [v]
-音を表現すること(ワ゛、ヰ゛、ヱ゛、ヲ゛)も行われたが、一般的にはならなかった。
+かつてはワ行のワ、ヰ、ヱ、ヲに濁点を付して [v] 音を表現すること(ワ゛、ヰ゛、ヱ゛、ヲ゛)も行われたが、一般的にはならなかった。
================================================================================
`;
@@ -180,9 +179,14 @@ proseWrap: "always"
=====================================input======================================
[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落][]
+[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落]: /abc
+
=====================================output=====================================
[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落][]
+[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落]:
+ /abc
+
================================================================================
`;
diff --git a/tests/format/markdown/splitCjkText/link.md b/tests/format/markdown/splitCjkText/link.md
index fb0610449..12c5e3e55 100644
--- a/tests/format/markdown/splitCjkText/link.md
+++ b/tests/format/markdown/splitCjkText/link.md
@@ -1 +1,3 @@
[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落][]
+
+[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落]: /abc
diff --git a/tests/format/markdown/table/__snapshots__/format.test.js.snap b/tests/format/markdown/table/__snapshots__/format.test.js.snap
index 492a83221..bc305ca1f 100644
--- a/tests/format/markdown/table/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/table/__snapshots__/format.test.js.snap
@@ -89,11 +89,29 @@ proseWrap: "always"
|:--|:-:|--:|
| \\| | \\| | \\| |
+| a | b |
+|:--|:-:|
+| \`\\|\` | \`\\\\\\|\` |
+| \`\\|\\|\` | \`\\\\\\\\\\|\` |
+
+| a | b |
+| --- | --- |
+| \`not | inline code\` |
+
=====================================output=====================================
| a | b | c |
| :-- | :-: | --: |
| \\| | \\| | \\| |
+| a | b |
+| :----- | :------: |
+| \`\\|\` | \`\\\\\\|\` |
+| \`\\|\\|\` | \`\\\\\\\\\\|\` |
+
+| a | b |
+| ---- | ------------ |
+| \`not | inline code\` |
+
================================================================================
`;
diff --git a/tests/format/markdown/table/escape.md b/tests/format/markdown/table/escape.md
index f6d06a7ac..7725be7cf 100644
--- a/tests/format/markdown/table/escape.md
+++ b/tests/format/markdown/table/escape.md
@@ -1,3 +1,12 @@
| a | b | c |
|:--|:-:|--:|
| \| | \| | \| |
+
+| a | b |
+|:--|:-:|
+| `\|` | `\\\|` |
+| `\|\|` | `\\\\\|` |
+
+| a | b |
+| --- | --- |
+| `not | inline code` |
diff --git a/tests/format/markdown/wiki-link/__snapshots__/format.test.js.snap b/tests/format/markdown/wiki-link/__snapshots__/format.test.js.snap
index c82952384..7c43aa000 100644
--- a/tests/format/markdown/wiki-link/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/wiki-link/__snapshots__/format.test.js.snap
@@ -267,8 +267,8 @@ I have some markdown prose here, with a horrible run-on sentence that [[makes li
continue it into an obscenely long wiki-style link thingy]].
=====================================output=====================================
-I have some markdown prose here, with a horrible run-on sentence that
-[[makes little sense at all as I continue it into an obscenely long wiki-style link thingy]].
+I have some markdown prose here, with a horrible run-on sentence that [[makes little sense at all as I
+continue it into an obscenely long wiki-style link thingy]].
================================================================================
`;
@@ -284,8 +284,8 @@ I have some markdown prose here, with a horrible run-on sentence that [[makes li
continue it into an obscenely long wiki-style link thingy]].
=====================================output=====================================
-I have some markdown prose here, with a horrible run-on sentence that
-[[makes little sense at all as I continue it into an obscenely long wiki-style link thingy]].
+I have some markdown prose here, with a horrible run-on sentence that [[makes little sense at all as I
+continue it into an obscenely long wiki-style link thingy]].
================================================================================
`;
@@ -301,7 +301,8 @@ I have some markdown prose here, with a horrible run-on sentence that [[makes li
continue it into an obscenely long wiki-style link thingy]].
=====================================output=====================================
-I have some markdown prose here, with a horrible run-on sentence that [[makes little sense at all as I continue it into an obscenely long wiki-style link thingy]].
+I have some markdown prose here, with a horrible run-on sentence that [[makes little sense at all as I
+continue it into an obscenely long wiki-style link thingy]].
================================================================================
`;
@@ -535,8 +536,136 @@ singleQuote: true
[[a
b]]
+[[This is **not** a
+_wiki link_]]
+
+[[test1
+[[wiki link]]
+
+[[wiki link]] test2
+]]
+
+\\[[test3 text
+]]
+
+[[test4 text
+\\]]
+
+[[test5
+abc ***def*** ghi
+text]]
+
+[[test6 ***
+text***text***text
+*** text]
+
+\\\\[[test7
+text]]
+
+\\\\\\[[test8
+text]]
+
+\\\\\\\\[[test9
+text]]
+
+\\\\\\[[[test10
+text]]
+
+[[test11
+text\\\\]]
+
+[[test12
+text\\\\\\]]
+
+[[test13
+text\\\\\\\\]]
+
+[[test14
+text\\\\\\]]]
+
+test15]] text [[text
+text]]
+
+[test16
+text]]
+
+[[test17
+text]
+
+[[test18 ]]
+
+[[test19 text
+text]]
+
+> [[quote test
+> text]]
+
=====================================output=====================================
-[[a b]]
+[[a
+b]]
+
+[[This is **not** a
+_wiki link_]]
+
+[[test1
+[[wiki link]]
+
+[[wiki link]] test2 ]]
+
+\\[[test3 text
+]]
+
+[[test4 text
+\\]]
+
+[[test5
+abc _**def**_ ghi
+text]]
+
+[[test6 *** text***text***text *** text]
+
+\\\\[[test7
+text]]
+
+\\\\\\[[test8
+text]]
+
+\\\\\\\\[[test9
+text]]
+
+\\\\\\[[[test10
+text]]
+
+[[test11
+text\\\\]]
+
+[[test12
+text\\\\\\]]
+
+[[test13
+text\\\\\\\\]]
+
+[[test14
+text\\\\\\]]]
+
+test15]] text [[text
+text]]
+
+[test16 text]]
+
+[[test17 text]
+
+[[test18 ]]
+
+[[test19 text
+text]]
+
+> [[quote test
+> text]]
================================================================================
`;
@@ -551,8 +680,136 @@ proseWrap: "always"
[[a
b]]
+[[This is **not** a
+_wiki link_]]
+
+[[test1
+[[wiki link]]
+
+[[wiki link]] test2
+]]
+
+\\[[test3 text
+]]
+
+[[test4 text
+\\]]
+
+[[test5
+abc ***def*** ghi
+text]]
+
+[[test6 ***
+text***text***text
+*** text]
+
+\\\\[[test7
+text]]
+
+\\\\\\[[test8
+text]]
+
+\\\\\\\\[[test9
+text]]
+
+\\\\\\[[[test10
+text]]
+
+[[test11
+text\\\\]]
+
+[[test12
+text\\\\\\]]
+
+[[test13
+text\\\\\\\\]]
+
+[[test14
+text\\\\\\]]]
+
+test15]] text [[text
+text]]
+
+[test16
+text]]
+
+[[test17
+text]
+
+[[test18 ]]
+
+[[test19 text
+text]]
+
+> [[quote test
+> text]]
+
=====================================output=====================================
-[[a b]]
+[[a
+b]]
+
+[[This is **not** a
+_wiki link_]]
+
+[[test1
+[[wiki link]]
+
+[[wiki link]] test2 ]]
+
+\\[[test3 text
+]]
+
+[[test4 text
+\\]]
+
+[[test5
+abc _**def**_ ghi
+text]]
+
+[[test6 *** text***text***text *** text]
+
+\\\\[[test7
+text]]
+
+\\\\\\[[test8
+text]]
+
+\\\\\\\\[[test9
+text]]
+
+\\\\\\[[[test10
+text]]
+
+[[test11
+text\\\\]]
+
+[[test12
+text\\\\\\]]
+
+[[test13
+text\\\\\\\\]]
+
+[[test14
+text\\\\\\]]]
+
+test15]] text [[text
+text]]
+
+[test16 text]]
+
+[[test17 text]
+
+[[test18 ]]
+
+[[test19 text
+text]]
+
+> [[quote test
+> text]]
================================================================================
`;
@@ -567,8 +824,136 @@ proseWrap: "never"
[[a
b]]
+[[This is **not** a
+_wiki link_]]
+
+[[test1
+[[wiki link]]
+
+[[wiki link]] test2
+]]
+
+\\[[test3 text
+]]
+
+[[test4 text
+\\]]
+
+[[test5
+abc ***def*** ghi
+text]]
+
+[[test6 ***
+text***text***text
+*** text]
+
+\\\\[[test7
+text]]
+
+\\\\\\[[test8
+text]]
+
+\\\\\\\\[[test9
+text]]
+
+\\\\\\[[[test10
+text]]
+
+[[test11
+text\\\\]]
+
+[[test12
+text\\\\\\]]
+
+[[test13
+text\\\\\\\\]]
+
+[[test14
+text\\\\\\]]]
+
+test15]] text [[text
+text]]
+
+[test16
+text]]
+
+[[test17
+text]
+
+[[test18 ]]
+
+[[test19 text
+text]]
+
+> [[quote test
+> text]]
+
=====================================output=====================================
-[[a b]]
+[[a
+b]]
+
+[[This is **not** a
+_wiki link_]]
+
+[[test1
+[[wiki link]]
+
+[[wiki link]] test2 ]]
+
+\\[[test3 text
+]]
+
+[[test4 text
+\\]]
+
+[[test5
+abc _**def**_ ghi
+text]]
+
+[[test6 *** text***text***text *** text]
+
+\\\\[[test7
+text]]
+
+\\\\\\[[test8
+text]]
+
+\\\\\\\\[[test9
+text]]
+
+\\\\\\[[[test10
+text]]
+
+[[test11
+text\\\\]]
+
+[[test12
+text\\\\\\]]
+
+[[test13
+text\\\\\\\\]]
+
+[[test14
+text\\\\\\]]]
+
+test15]] text [[text
+text]]
+
+[test16 text]]
+
+[[test17 text]
+
+[[test18 ]]
+
+[[test19 text
+text]]
+
+> [[quote test
+> text]]
================================================================================
`;
@@ -583,10 +968,142 @@ proseWrap: "preserve"
[[a
b]]
+[[This is **not** a
+_wiki link_]]
+
+[[test1
+[[wiki link]]
+
+[[wiki link]] test2
+]]
+
+\\[[test3 text
+]]
+
+[[test4 text
+\\]]
+
+[[test5
+abc ***def*** ghi
+text]]
+
+[[test6 ***
+text***text***text
+*** text]
+
+\\\\[[test7
+text]]
+
+\\\\\\[[test8
+text]]
+
+\\\\\\\\[[test9
+text]]
+
+\\\\\\[[[test10
+text]]
+
+[[test11
+text\\\\]]
+
+[[test12
+text\\\\\\]]
+
+[[test13
+text\\\\\\\\]]
+
+[[test14
+text\\\\\\]]]
+
+test15]] text [[text
+text]]
+
+[test16
+text]]
+
+[[test17
+text]
+
+[[test18 ]]
+
+[[test19 text
+text]]
+
+> [[quote test
+> text]]
+
=====================================output=====================================
[[a
b]]
+[[This is **not** a
+_wiki link_]]
+
+[[test1
+[[wiki link]]
+
+[[wiki link]] test2
+]]
+
+\\[[test3 text
+]]
+
+[[test4 text
+\\]]
+
+[[test5
+abc _**def**_ ghi
+text]]
+
+[[test6 ***
+text***text***text
+*** text]
+
+\\\\[[test7
+text]]
+
+\\\\\\[[test8
+text]]
+
+\\\\\\\\[[test9
+text]]
+
+\\\\\\[[[test10
+text]]
+
+[[test11
+text\\\\]]
+
+[[test12
+text\\\\\\]]
+
+[[test13
+text\\\\\\\\]]
+
+[[test14
+text\\\\\\]]]
+
+test15]] text [[text
+text]]
+
+[test16
+text]]
+
+[[test17
+text]
+
+[[test18 ]]
+
+[[test19 text
+text]]
+
+> [[quote test
+> text]]
+
================================================================================
`;
@@ -601,8 +1118,7 @@ singleQuote: true
Here's some text to ensure that the link and wiki link break the line [[a[b](http://www.example.com/)]]
=====================================output=====================================
-Here's some text to ensure that the link and wiki link break the line
-[[a[b](http://www.example.com/)]]
+Here's some text to ensure that the link and wiki link break the line [[a[b](http://www.example.com/)]]
================================================================================
`;
@@ -617,8 +1133,7 @@ proseWrap: "always"
Here's some text to ensure that the link and wiki link break the line [[a[b](http://www.example.com/)]]
=====================================output=====================================
-Here's some text to ensure that the link and wiki link break the line
-[[a[b](http://www.example.com/)]]
+Here's some text to ensure that the link and wiki link break the line [[a[b](http://www.example.com/)]]
================================================================================
`;
@@ -725,7 +1240,7 @@ singleQuote: true
[[ Here is a link with leading and trailing whitespace. ]]
=====================================output=====================================
-[[Here is a link with leading and trailing whitespace.]]
+[[ Here is a link with leading and trailing whitespace. ]]
================================================================================
`;
@@ -740,7 +1255,7 @@ proseWrap: "always"
[[ Here is a link with leading and trailing whitespace. ]]
=====================================output=====================================
-[[Here is a link with leading and trailing whitespace.]]
+[[ Here is a link with leading and trailing whitespace. ]]
================================================================================
`;
@@ -755,7 +1270,7 @@ proseWrap: "never"
[[ Here is a link with leading and trailing whitespace. ]]
=====================================output=====================================
-[[Here is a link with leading and trailing whitespace.]]
+[[ Here is a link with leading and trailing whitespace. ]]
================================================================================
`;
@@ -770,7 +1285,7 @@ proseWrap: "preserve"
[[ Here is a link with leading and trailing whitespace. ]]
=====================================output=====================================
-[[Here is a link with leading and trailing whitespace.]]
+[[ Here is a link with leading and trailing whitespace. ]]
================================================================================
`;
diff --git a/tests/format/markdown/wiki-link/multi-line.md b/tests/format/markdown/wiki-link/multi-line.md
index 803eeac94..b632e56ca 100644
--- a/tests/format/markdown/wiki-link/multi-line.md
+++ b/tests/format/markdown/wiki-link/multi-line.md
@@ -1,2 +1,68 @@
[[a
b]]
+
+[[This is **not** a
+_wiki link_]]
+
+[[test1
+[[wiki link]]
+
+[[wiki link]] test2
+]]
+
+\[[test3 text
+]]
+
+[[test4 text
+\]]
+
+[[test5
+abc ***def*** ghi
+text]]
+
+[[test6 ***
+text***text***text
+*** text]
+
+\\[[test7
+text]]
+
+\\\[[test8
+text]]
+
+\\\\[[test9
+text]]
+
+\\\[[[test10
+text]]
+
+[[test11
+text\\]]
+
+[[test12
+text\\\]]
+
+[[test13
+text\\\\]]
+
+[[test14
+text\\\]]]
+
+test15]] text [[text
+text]]
+
+[test16
+text]]
+
+[[test17
+text]
+
+[[test18 ]]
+
+[[test19 text
+text]]
+
+> [[quote test
+> text]]
diff --git a/tests/format/markdown/word/__snapshots__/format.test.js.snap b/tests/format/markdown/word/__snapshots__/format.test.js.snap
index 74be130d7..f1ea9bb43 100644
--- a/tests/format/markdown/word/__snapshots__/format.test.js.snap
+++ b/tests/format/markdown/word/__snapshots__/format.test.js.snap
@@ -38,7 +38,7 @@ asd & asd 123
123123
=====================================output=====================================
-hello \\* world \\_ ~~ ya
+hello \\* world _ ~~ ya
escape & html < entity > foo
@@ -52,7 +52,7 @@ asd & asd 123
123*123*123
-123 _ 123 _ 123
+123 * 123 * 123
## 类的 prototype 属性和\\_\\_proto\\_\\_属性
diff --git a/yarn.lock b/yarn.lock
index fdfe73875..f2f677f60 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -418,6 +418,13 @@ __metadata:
languageName: node
linkType: hard
+"@babel/runtime@npm:^7.12.1":
+ version: 7.28.4
+ resolution: "@babel/runtime@npm:7.28.4"
+ checksum: 10/6c9a70452322ea80b3c9b2a412bcf60771819213a67576c8cec41e88a95bb7bf01fc983754cda35dc19603eef52df22203ccbf7777b9d6316932f9fb77c25163
+ languageName: node
+ linkType: hard
+
"@babel/template@npm:^7.27.2":
version: 7.27.2
resolution: "@babel/template@npm:7.27.2"
@@ -2371,6 +2378,15 @@ __metadata:
languageName: node
linkType: hard
+"@types/debug@npm:^4.0.0":
+ version: 4.1.12
+ resolution: "@types/debug@npm:4.1.12"
+ dependencies:
+ "@types/ms": "npm:*"
+ checksum: 10/47876a852de8240bfdaf7481357af2b88cb660d30c72e73789abf00c499d6bc7cd5e52f41c915d1b9cd8ec9fef5b05688d7b7aef17f7f272c2d04679508d1053
+ languageName: node
+ linkType: hard
+
"@types/estree@npm:^1.0.6":
version: 1.0.8
resolution: "@types/estree@npm:1.0.8"
@@ -2378,6 +2394,15 @@ __metadata:
languageName: node
linkType: hard
+"@types/hast@npm:^3.0.0":
+ version: 3.0.4
+ resolution: "@types/hast@npm:3.0.4"
+ dependencies:
+ "@types/unist": "npm:*"
+ checksum: 10/732920d81bb7605895776841b7658b4d8cc74a43a8fa176017cc0fb0ecc1a4c82a2b75a4fe6b71aa262b649d3fb62858c6789efa3793ea1d40269953af96ecb5
+ languageName: node
+ linkType: hard
+
"@types/istanbul-lib-coverage@npm:*, @types/istanbul-lib-coverage@npm:^2.0.1, @types/istanbul-lib-coverage@npm:^2.0.6":
version: 2.0.6
resolution: "@types/istanbul-lib-coverage@npm:2.0.6"
@@ -2424,6 +2449,29 @@ __metadata:
languageName: node
linkType: hard
+"@types/katex@npm:^0.16.0":
+ version: 0.16.7
+ resolution: "@types/katex@npm:0.16.7"
+ checksum: 10/4fd15d93553be97c02c064e16be18d7ccbabf66ec72a9dc7fd5bfa47f0c7581da2f942f693c7cb59499de4c843c2189796e49c9647d336cbd52b777b6722a95a
+ languageName: node
+ linkType: hard
+
+"@types/mdast@npm:^4.0.0":
+ version: 4.0.4
+ resolution: "@types/mdast@npm:4.0.4"
+ dependencies:
+ "@types/unist": "npm:*"
+ checksum: 10/efe3ec11b9ee0015a396c4fb4cd1b6f31b51b8ae9783c59560e6fc0bf6c2fa1dcc7fccaf45fa09a6c8b3397fab9dc8d431433935cae3835caa70a18f7fc775f8
+ languageName: node
+ linkType: hard
+
+"@types/ms@npm:*":
+ version: 2.1.0
+ resolution: "@types/ms@npm:2.1.0"
+ checksum: 10/532d2ebb91937ccc4a89389715e5b47d4c66e708d15942fe6cc25add6dc37b2be058230a327dd50f43f89b8b6d5d52b74685a9e8f70516edfc9bdd6be910eff4
+ languageName: node
+ linkType: hard
+
"@types/node@npm:*":
version: 24.10.1
resolution: "@types/node@npm:24.10.1"
@@ -2440,6 +2488,13 @@ __metadata:
languageName: node
linkType: hard
+"@types/unist@npm:*, @types/unist@npm:^3.0.0":
+ version: 3.0.3
+ resolution: "@types/unist@npm:3.0.3"
+ checksum: 10/96e6453da9e075aaef1dc22482463898198acdc1eeb99b465e65e34303e2ec1e3b1ed4469a9118275ec284dc98019f63c3f5d49422f0e4ac707e5ab90fb3b71a
+ languageName: node
+ linkType: hard
+
"@types/unist@npm:^2.0.0, @types/unist@npm:^2.0.2":
version: 2.0.11
resolution: "@types/unist@npm:2.0.11"
@@ -3388,6 +3443,13 @@ __metadata:
languageName: node
linkType: hard
+"ccount@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "ccount@npm:2.0.1"
+ checksum: 10/48193dada54c9e260e0acf57fc16171a225305548f9ad20d5471e0f7a8c026aedd8747091dccb0d900cde7df4e4ddbd235df0d8de4a64c71b12f0d3303eeafd4
+ languageName: node
+ linkType: hard
+
"chalk-template@npm:^1.1.2":
version: 1.1.2
resolution: "chalk-template@npm:1.1.2"
@@ -3453,6 +3515,13 @@ __metadata:
languageName: node
linkType: hard
+"character-entities@npm:^2.0.0":
+ version: 2.0.2
+ resolution: "character-entities@npm:2.0.2"
+ checksum: 10/c8dd1f4bf1a92fccf7d2fad9673660a88b37854557d30f6076c32fedfb92d1420208298829ff1d3b6b4fa1c7012e8326c45e7f5c3ed1e9a09ec177593c521b2f
+ languageName: node
+ linkType: hard
+
"character-reference-invalid@npm:^1.0.0":
version: 1.1.4
resolution: "character-reference-invalid@npm:1.1.4"
@@ -3593,6 +3662,13 @@ __metadata:
languageName: node
linkType: hard
+"commander@npm:^8.3.0":
+ version: 8.3.0
+ resolution: "commander@npm:8.3.0"
+ checksum: 10/6b7b5d334483ce24bd73c5dac2eab901a7dbb25fd983ea24a1eeac6e7166bb1967f641546e8abf1920afbde86a45fbfe5812fbc69d0dc451bb45ca416a12a3a3
+ languageName: node
+ linkType: hard
+
"comment-json@npm:^4.4.1":
version: 4.4.1
resolution: "comment-json@npm:4.4.1"
@@ -3872,7 +3948,7 @@ __metadata:
languageName: node
linkType: hard
-"debug@npm:4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.4, debug@npm:^4.4.3":
+"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.4, debug@npm:^4.4.3":
version: 4.4.3
resolution: "debug@npm:4.4.3"
dependencies:
@@ -3884,6 +3960,15 @@ __metadata:
languageName: node
linkType: hard
+"decode-named-character-reference@npm:^1.0.0":
+ version: 1.2.0
+ resolution: "decode-named-character-reference@npm:1.2.0"
+ dependencies:
+ character-entities: "npm:^2.0.0"
+ checksum: 10/f26b23046c1a137c0b41fa51e3ce07ba8364640322c742a31570999784abc8572fc24cb108a76b14ff72ddb75d35aad3d14b10d7743639112145a2664b9d1864
+ languageName: node
+ linkType: hard
+
"dedent@npm:^1.6.0":
version: 1.7.0
resolution: "dedent@npm:1.7.0"
@@ -3959,6 +4044,13 @@ __metadata:
languageName: node
linkType: hard
+"dequal@npm:^2.0.0":
+ version: 2.0.3
+ resolution: "dequal@npm:2.0.3"
+ checksum: 10/6ff05a7561f33603df87c45e389c9ac0a95e3c056be3da1a0c4702149e3a7f6fe5ffbb294478687ba51a9e95f3a60e8b6b9005993acd79c292c7d15f71964b6b
+ languageName: node
+ linkType: hard
+
"detect-newline@npm:^3.1.0":
version: 3.1.0
resolution: "detect-newline@npm:3.1.0"
@@ -3973,6 +4065,15 @@ __metadata:
languageName: node
linkType: hard
+"devlop@npm:^1.0.0, devlop@npm:^1.1.0":
+ version: 1.1.0
+ resolution: "devlop@npm:1.1.0"
+ dependencies:
+ dequal: "npm:^2.0.0"
+ checksum: 10/3cc5f903d02d279d6dc4aa71ab6ed9898b9f4d1f861cc5421ce7357893c21b9520de78afb203c92bd650a6977ad0ca98195453a0707a39958cf5fea3b0a8ddd8
+ languageName: node
+ linkType: hard
+
"devtools-protocol@npm:0.0.1534754":
version: 0.0.1534754
resolution: "devtools-protocol@npm:0.0.1534754"
@@ -4234,7 +4335,7 @@ __metadata:
languageName: node
linkType: hard
-"escape-string-regexp@npm:5.0.0":
+"escape-string-regexp@npm:5.0.0, escape-string-regexp@npm:^5.0.0":
version: 5.0.0
resolution: "escape-string-regexp@npm:5.0.0"
checksum: 10/20daabe197f3cb198ec28546deebcf24b3dbb1a5a269184381b3116d12f0532e06007f4bc8da25669d6a7f8efb68db0758df4cd981f57bc5b57f521a3e12c59e
@@ -6465,6 +6566,17 @@ __metadata:
languageName: node
linkType: hard
+"katex@npm:^0.16.0":
+ version: 0.16.27
+ resolution: "katex@npm:0.16.27"
+ dependencies:
+ commander: "npm:^8.3.0"
+ bin:
+ katex: cli.js
+ checksum: 10/7666ae11c6c1238626bffaf1a526af6ff679114d62293bf2f0e29f8a34d8e961c0edcb686c5b628158ec92a143b4bef5d83539c81b29a63c7dcf0bdb4544eec9
+ languageName: node
+ linkType: hard
+
"keyv@npm:^4.5.4":
version: 4.5.4
resolution: "keyv@npm:4.5.4"
@@ -6602,6 +6714,20 @@ __metadata:
languageName: node
linkType: hard
+"longest-streak@npm:^2.0.0":
+ version: 2.0.4
+ resolution: "longest-streak@npm:2.0.4"
+ checksum: 10/28b8234a14963002c5c71035dee13a0a11e9e9d18ffa320fdc8796ed7437399204495702ed69cd2a7087b0af041a2a8b562829b7c1e2042e73a3374d1ecf6580
+ languageName: node
+ linkType: hard
+
+"longest-streak@npm:^3.0.0":
+ version: 3.1.0
+ resolution: "longest-streak@npm:3.1.0"
+ checksum: 10/d7f952ed004cbdb5c8bcfc4f7f5c3d65449e6c5a9e9be4505a656e3df5a57ee125f284286b4bf8ecea0c21a7b3bf2b8f9001ad506c319b9815ad6a63a47d0fd0
+ languageName: node
+ linkType: hard
+
"lru-cache@npm:^10.2.0":
version: 10.4.3
resolution: "lru-cache@npm:10.4.3"
@@ -6692,6 +6818,204 @@ __metadata:
languageName: node
linkType: hard
+"markdown-table@npm:^3.0.0":
+ version: 3.0.4
+ resolution: "markdown-table@npm:3.0.4"
+ checksum: 10/bc699819e6a15607e5def0f21aa862aa061cf1f49877baa93b0185574f6ab143591afe0e18b94d9b15ea80c6a693894150dbccfacf4f6767160dc32ae393dfe0
+ languageName: node
+ linkType: hard
+
+"mdast-util-find-and-replace@npm:^3.0.0":
+ version: 3.0.2
+ resolution: "mdast-util-find-and-replace@npm:3.0.2"
+ dependencies:
+ "@types/mdast": "npm:^4.0.0"
+ escape-string-regexp: "npm:^5.0.0"
+ unist-util-is: "npm:^6.0.0"
+ unist-util-visit-parents: "npm:^6.0.0"
+ checksum: 10/446561aa950341ef6828069cef05566256cb6836b77ea498e648102411f96fdfa342c78b82c9d813b51a1dac80b030ce80c055e044bc285a3d52d8558fc3d65e
+ languageName: node
+ linkType: hard
+
+"mdast-util-from-markdown@npm:2.0.2, mdast-util-from-markdown@npm:^2.0.0":
+ version: 2.0.2
+ resolution: "mdast-util-from-markdown@npm:2.0.2"
+ dependencies:
+ "@types/mdast": "npm:^4.0.0"
+ "@types/unist": "npm:^3.0.0"
+ decode-named-character-reference: "npm:^1.0.0"
+ devlop: "npm:^1.0.0"
+ mdast-util-to-string: "npm:^4.0.0"
+ micromark: "npm:^4.0.0"
+ micromark-util-decode-numeric-character-reference: "npm:^2.0.0"
+ micromark-util-decode-string: "npm:^2.0.0"
+ micromark-util-normalize-identifier: "npm:^2.0.0"
+ micromark-util-symbol: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ unist-util-stringify-position: "npm:^4.0.0"
+ checksum: 10/69b207913fbcc0469f8c59d922af4d5509b79e809d77c9bd4781543a907fe2ecc8e6433ce0707066a27b117b13f38af3aae4f2d085e18ebd2d3ad5f1a5647902
+ languageName: node
+ linkType: hard
+
+"mdast-util-gfm-autolink-literal@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "mdast-util-gfm-autolink-literal@npm:2.0.1"
+ dependencies:
+ "@types/mdast": "npm:^4.0.0"
+ ccount: "npm:^2.0.0"
+ devlop: "npm:^1.0.0"
+ mdast-util-find-and-replace: "npm:^3.0.0"
+ micromark-util-character: "npm:^2.0.0"
+ checksum: 10/d933b42feb126bd094d4be4a4955326c4a9e727a5d0dbe3c824534a19d831996fcf16f67df3dd29550a7d2ac4ac568c80485bee380151ebb42c62848ab20dfa6
+ languageName: node
+ linkType: hard
+
+"mdast-util-gfm-footnote@npm:^2.0.0":
+ version: 2.1.0
+ resolution: "mdast-util-gfm-footnote@npm:2.1.0"
+ dependencies:
+ "@types/mdast": "npm:^4.0.0"
+ devlop: "npm:^1.1.0"
+ mdast-util-from-markdown: "npm:^2.0.0"
+ mdast-util-to-markdown: "npm:^2.0.0"
+ micromark-util-normalize-identifier: "npm:^2.0.0"
+ checksum: 10/5fac0f64d1233f7c533c2bb99a95c56f8f5dab553ae3a83f87c1fd6e4f28e0050e3240ae32ba77b4f5df0b84404932c66fd00c852a0925059bfa5d876f155854
+ languageName: node
+ linkType: hard
+
+"mdast-util-gfm-strikethrough@npm:^2.0.0":
+ version: 2.0.0
+ resolution: "mdast-util-gfm-strikethrough@npm:2.0.0"
+ dependencies:
+ "@types/mdast": "npm:^4.0.0"
+ mdast-util-from-markdown: "npm:^2.0.0"
+ mdast-util-to-markdown: "npm:^2.0.0"
+ checksum: 10/b1abc137d78270540585ad94a7a4ed1630683312690b902389dae0ede50a6832e26d1be053687f49728e14fa8a379da9384342725d3beb4480fc30b12866ab37
+ languageName: node
+ linkType: hard
+
+"mdast-util-gfm-table@npm:^2.0.0":
+ version: 2.0.0
+ resolution: "mdast-util-gfm-table@npm:2.0.0"
+ dependencies:
+ "@types/mdast": "npm:^4.0.0"
+ devlop: "npm:^1.0.0"
+ markdown-table: "npm:^3.0.0"
+ mdast-util-from-markdown: "npm:^2.0.0"
+ mdast-util-to-markdown: "npm:^2.0.0"
+ checksum: 10/a043d60d723a86f79c49cbdd1d98b80c89f4a8f9f5fa84b3880c53e132f40150972460aba9be1f44a612ef5abd6810d122c5e7e5d9c54f3ac7560cce8c305c75
+ languageName: node
+ linkType: hard
+
+"mdast-util-gfm-task-list-item@npm:^2.0.0":
+ version: 2.0.0
+ resolution: "mdast-util-gfm-task-list-item@npm:2.0.0"
+ dependencies:
+ "@types/mdast": "npm:^4.0.0"
+ devlop: "npm:^1.0.0"
+ mdast-util-from-markdown: "npm:^2.0.0"
+ mdast-util-to-markdown: "npm:^2.0.0"
+ checksum: 10/679a3ff09b52015c0088cd0616ccecc7cc9d250d56a8762aafdffc640f3f607bbd9fe047d3e7e7078e6a996e83f677be3bfcad7ac7260563825fa80a04f8e09d
+ languageName: node
+ linkType: hard
+
+"mdast-util-gfm@npm:3.1.0":
+ version: 3.1.0
+ resolution: "mdast-util-gfm@npm:3.1.0"
+ dependencies:
+ mdast-util-from-markdown: "npm:^2.0.0"
+ mdast-util-gfm-autolink-literal: "npm:^2.0.0"
+ mdast-util-gfm-footnote: "npm:^2.0.0"
+ mdast-util-gfm-strikethrough: "npm:^2.0.0"
+ mdast-util-gfm-table: "npm:^2.0.0"
+ mdast-util-gfm-task-list-item: "npm:^2.0.0"
+ mdast-util-to-markdown: "npm:^2.0.0"
+ checksum: 10/d66809a07000ee63661ae9044f550989d96101e3c11557a84e12038ed28490667244432dbb1f8b7d9ebb4936cc8770d3de118aff85b7474f33693b4c07a1ffda
+ languageName: node
+ linkType: hard
+
+"mdast-util-math@npm:3.0.0":
+ version: 3.0.0
+ resolution: "mdast-util-math@npm:3.0.0"
+ dependencies:
+ "@types/hast": "npm:^3.0.0"
+ "@types/mdast": "npm:^4.0.0"
+ devlop: "npm:^1.0.0"
+ longest-streak: "npm:^3.0.0"
+ mdast-util-from-markdown: "npm:^2.0.0"
+ mdast-util-to-markdown: "npm:^2.1.0"
+ unist-util-remove-position: "npm:^5.0.0"
+ checksum: 10/26f44933f3ae2bfce85df23e79cd31bcc42ef328eaeef70550f38310e29fc8eece5e79fc404ed1485fd38b9113e1817258ca6c1a602be82a933e0198d812c9af
+ languageName: node
+ linkType: hard
+
+"mdast-util-phrasing@npm:^4.0.0":
+ version: 4.1.0
+ resolution: "mdast-util-phrasing@npm:4.1.0"
+ dependencies:
+ "@types/mdast": "npm:^4.0.0"
+ unist-util-is: "npm:^6.0.0"
+ checksum: 10/3a97533e8ad104a422f8bebb34b3dde4f17167b8ed3a721cf9263c7416bd3447d2364e6d012a594aada40cac9e949db28a060bb71a982231693609034ed5324e
+ languageName: node
+ linkType: hard
+
+"mdast-util-to-markdown@npm:^0.6.5":
+ version: 0.6.5
+ resolution: "mdast-util-to-markdown@npm:0.6.5"
+ dependencies:
+ "@types/unist": "npm:^2.0.0"
+ longest-streak: "npm:^2.0.0"
+ mdast-util-to-string: "npm:^2.0.0"
+ parse-entities: "npm:^2.0.0"
+ repeat-string: "npm:^1.0.0"
+ zwitch: "npm:^1.0.0"
+ checksum: 10/e1fdb7a75f59166abe5d9d26fed5e04cd40bc6ab54cba239350f70c92df093106b9462660a1891210e9d52b2729c14fc107605127e25837b0a4ad74fbdfbd328
+ languageName: node
+ linkType: hard
+
+"mdast-util-to-markdown@npm:^2.0.0, mdast-util-to-markdown@npm:^2.1.0":
+ version: 2.1.2
+ resolution: "mdast-util-to-markdown@npm:2.1.2"
+ dependencies:
+ "@types/mdast": "npm:^4.0.0"
+ "@types/unist": "npm:^3.0.0"
+ longest-streak: "npm:^3.0.0"
+ mdast-util-phrasing: "npm:^4.0.0"
+ mdast-util-to-string: "npm:^4.0.0"
+ micromark-util-classify-character: "npm:^2.0.0"
+ micromark-util-decode-string: "npm:^2.0.0"
+ unist-util-visit: "npm:^5.0.0"
+ zwitch: "npm:^2.0.0"
+ checksum: 10/ab494a32f1ec90f0a502970b403b1847a10f3ba635adddb66ce70994cc47b4924c6c05078ddd29a8c2c5c9bc8c0bcc20e5fc1ef0fcb9b0cb9c0589a000817f1c
+ languageName: node
+ linkType: hard
+
+"mdast-util-to-string@npm:^2.0.0":
+ version: 2.0.0
+ resolution: "mdast-util-to-string@npm:2.0.0"
+ checksum: 10/0b2113ada10e002fbccb014170506dabe2f2ddacaacbe4bc1045c33f986652c5a162732a2c057c5335cdb58419e2ad23e368e5be226855d4d4e280b81c4e9ec2
+ languageName: node
+ linkType: hard
+
+"mdast-util-to-string@npm:^4.0.0":
+ version: 4.0.0
+ resolution: "mdast-util-to-string@npm:4.0.0"
+ dependencies:
+ "@types/mdast": "npm:^4.0.0"
+ checksum: 10/f4a5dbb9ea03521d7d3e26a9ba5652a1d6fbd55706dddd2155427517085688830e0ecd3f12418cfd40892640886eb39a4034c3c967d85e01e2fa64cfb53cff05
+ languageName: node
+ linkType: hard
+
+"mdast-util-wiki-link@npm:0.1.2":
+ version: 0.1.2
+ resolution: "mdast-util-wiki-link@npm:0.1.2"
+ dependencies:
+ "@babel/runtime": "npm:^7.12.1"
+ mdast-util-to-markdown: "npm:^0.6.5"
+ checksum: 10/80a4dd00f412f68d26cb0b23ef6c0efdec9d2b429614dda325eebdffb5c8d91c5c93037965afc29595b02f3fb10b691bd9e65d313a82ccc828074474055610db
+ languageName: node
+ linkType: hard
+
"memorystream@npm:^0.3.1":
version: 0.3.1
resolution: "memorystream@npm:0.3.1"
@@ -6727,6 +7051,359 @@ __metadata:
languageName: node
linkType: hard
+"micromark-core-commonmark@npm:^2.0.0":
+ version: 2.0.3
+ resolution: "micromark-core-commonmark@npm:2.0.3"
+ dependencies:
+ decode-named-character-reference: "npm:^1.0.0"
+ devlop: "npm:^1.0.0"
+ micromark-factory-destination: "npm:^2.0.0"
+ micromark-factory-label: "npm:^2.0.0"
+ micromark-factory-space: "npm:^2.0.0"
+ micromark-factory-title: "npm:^2.0.0"
+ micromark-factory-whitespace: "npm:^2.0.0"
+ micromark-util-character: "npm:^2.0.0"
+ micromark-util-chunked: "npm:^2.0.0"
+ micromark-util-classify-character: "npm:^2.0.0"
+ micromark-util-html-tag-name: "npm:^2.0.0"
+ micromark-util-normalize-identifier: "npm:^2.0.0"
+ micromark-util-resolve-all: "npm:^2.0.0"
+ micromark-util-subtokenize: "npm:^2.0.0"
+ micromark-util-symbol: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/2b98b9eba1463850ebd8f338f966bd2113dafe764b490ebee3dccab3764d3c48b53fe67673297530e56bf54f58de27dfd1952ed79c5b4e32047cb7f29bd807f2
+ languageName: node
+ linkType: hard
+
+"micromark-extension-gfm-autolink-literal@npm:^2.0.0":
+ version: 2.1.0
+ resolution: "micromark-extension-gfm-autolink-literal@npm:2.1.0"
+ dependencies:
+ micromark-util-character: "npm:^2.0.0"
+ micromark-util-sanitize-uri: "npm:^2.0.0"
+ micromark-util-symbol: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/933b9b96ca62cd50732d9e58ae90ba446f4314e0ecbff3127e9aae430d9a295346f88fb33b5532acaf648d659b0db92e0c00c2e9f504c0d7b8bb4553318cac50
+ languageName: node
+ linkType: hard
+
+"micromark-extension-gfm-footnote@npm:^2.0.0":
+ version: 2.1.0
+ resolution: "micromark-extension-gfm-footnote@npm:2.1.0"
+ dependencies:
+ devlop: "npm:^1.0.0"
+ micromark-core-commonmark: "npm:^2.0.0"
+ micromark-factory-space: "npm:^2.0.0"
+ micromark-util-character: "npm:^2.0.0"
+ micromark-util-normalize-identifier: "npm:^2.0.0"
+ micromark-util-sanitize-uri: "npm:^2.0.0"
+ micromark-util-symbol: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/7e019414e31ab53c49c909b7068adbbcb1726433fce82bf735219276fe6e00a42b66288acb5c8831f80e77480fac34880eeeb60b1dc09d5885862b31db4b9ea2
+ languageName: node
+ linkType: hard
+
+"micromark-extension-gfm-strikethrough@npm:^2.0.0":
+ version: 2.1.0
+ resolution: "micromark-extension-gfm-strikethrough@npm:2.1.0"
+ dependencies:
+ devlop: "npm:^1.0.0"
+ micromark-util-chunked: "npm:^2.0.0"
+ micromark-util-classify-character: "npm:^2.0.0"
+ micromark-util-resolve-all: "npm:^2.0.0"
+ micromark-util-symbol: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/eaf2c7b1e3eb2a7d7f405e8abe561be083cc52b8e027225ed286490939f527d18c120df59c8d8e17fdcf284f8d014502bf3db45d8e36e3109457ece8fb1db29b
+ languageName: node
+ linkType: hard
+
+"micromark-extension-gfm-table@npm:^2.0.0":
+ version: 2.1.1
+ resolution: "micromark-extension-gfm-table@npm:2.1.1"
+ dependencies:
+ devlop: "npm:^1.0.0"
+ micromark-factory-space: "npm:^2.0.0"
+ micromark-util-character: "npm:^2.0.0"
+ micromark-util-symbol: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/0391ead408d79a183a9bba325b0e660b85aef2cd6e442a9214afc4e0bdc3105cd7dbf41fc75465acf152883a4050b6203107c2a80bcadb304235581a1340fd8c
+ languageName: node
+ linkType: hard
+
+"micromark-extension-gfm-tagfilter@npm:^2.0.0":
+ version: 2.0.0
+ resolution: "micromark-extension-gfm-tagfilter@npm:2.0.0"
+ dependencies:
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/c5e3f8cdf22e184de3f55968e6b010876a100dff31f509b7d2975f2b981a7fdda6c2d9e452238b9fe54dc51f5d7b069e86de509d421d4efbdfc9194749b3f132
+ languageName: node
+ linkType: hard
+
+"micromark-extension-gfm-task-list-item@npm:^2.0.0":
+ version: 2.1.0
+ resolution: "micromark-extension-gfm-task-list-item@npm:2.1.0"
+ dependencies:
+ devlop: "npm:^1.0.0"
+ micromark-factory-space: "npm:^2.0.0"
+ micromark-util-character: "npm:^2.0.0"
+ micromark-util-symbol: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/c5f72929f0dca77df01442b721356624de6657364e2264ef50fc7226305976f302a49b670836f9494ce70a9b0335d974b5ef8e6457553c4c200bfc06d6951964
+ languageName: node
+ linkType: hard
+
+"micromark-extension-gfm@npm:3.0.0":
+ version: 3.0.0
+ resolution: "micromark-extension-gfm@npm:3.0.0"
+ dependencies:
+ micromark-extension-gfm-autolink-literal: "npm:^2.0.0"
+ micromark-extension-gfm-footnote: "npm:^2.0.0"
+ micromark-extension-gfm-strikethrough: "npm:^2.0.0"
+ micromark-extension-gfm-table: "npm:^2.0.0"
+ micromark-extension-gfm-tagfilter: "npm:^2.0.0"
+ micromark-extension-gfm-task-list-item: "npm:^2.0.0"
+ micromark-util-combine-extensions: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/8493d1041756bf21f9421fa6d357056bff6112aeccebc20595604686cdd908a6816765de297206457ae4c00f85fc58672bdbcbbc36820c25d561b1737af89055
+ languageName: node
+ linkType: hard
+
+"micromark-extension-math@npm:3.1.0":
+ version: 3.1.0
+ resolution: "micromark-extension-math@npm:3.1.0"
+ dependencies:
+ "@types/katex": "npm:^0.16.0"
+ devlop: "npm:^1.0.0"
+ katex: "npm:^0.16.0"
+ micromark-factory-space: "npm:^2.0.0"
+ micromark-util-character: "npm:^2.0.0"
+ micromark-util-symbol: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/37b2002aca15cf354ff754191379942f2b36df5ceeb69509294d80b4e158e8af83dda03c434e1497ccc597d63cf85a1ccc0d46f17770fc7692f76887404c8d1d
+ languageName: node
+ linkType: hard
+
+"micromark-extension-wiki-link@npm:0.0.4":
+ version: 0.0.4
+ resolution: "micromark-extension-wiki-link@npm:0.0.4"
+ dependencies:
+ "@babel/runtime": "npm:^7.12.1"
+ checksum: 10/668294fb5069ba869953d05e0cc79029962ba76d068c7288207b6b0ee2273e15059c810d5b7c10f3dcef030f559610ce31aeb4cd6955a0f2f359acdcca719bde
+ languageName: node
+ linkType: hard
+
+"micromark-factory-destination@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "micromark-factory-destination@npm:2.0.1"
+ dependencies:
+ micromark-util-character: "npm:^2.0.0"
+ micromark-util-symbol: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/9c4baa9ca2ed43c061bbf40ddd3d85154c2a0f1f485de9dea41d7dd2ad994ebb02034a003b2c1dbe228ba83a0576d591f0e90e0bf978713f84ee7d7f3aa98320
+ languageName: node
+ linkType: hard
+
+"micromark-factory-label@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "micromark-factory-label@npm:2.0.1"
+ dependencies:
+ devlop: "npm:^1.0.0"
+ micromark-util-character: "npm:^2.0.0"
+ micromark-util-symbol: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/bd03f5a75f27cdbf03b894ddc5c4480fc0763061fecf9eb927d6429233c930394f223969a99472df142d570c831236134de3dc23245d23d9f046f9d0b623b5c2
+ languageName: node
+ linkType: hard
+
+"micromark-factory-space@npm:2.0.1, micromark-factory-space@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "micromark-factory-space@npm:2.0.1"
+ dependencies:
+ micromark-util-character: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/1bd68a017c1a66f4787506660c1e1c5019169aac3b1cb075d49ac5e360e0b2065e984d4e1d6e9e52a9d44000f2fa1c98e66a743d7aae78b4b05616bf3242ed71
+ languageName: node
+ linkType: hard
+
+"micromark-factory-title@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "micromark-factory-title@npm:2.0.1"
+ dependencies:
+ micromark-factory-space: "npm:^2.0.0"
+ micromark-util-character: "npm:^2.0.0"
+ micromark-util-symbol: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/b4d2e4850a8ba0dff25ce54e55a3eb0d43dda88a16293f53953153288f9d84bcdfa8ca4606b2cfbb4f132ea79587bbb478a73092a349f893f5264fbcdbce2ee1
+ languageName: node
+ linkType: hard
+
+"micromark-factory-whitespace@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "micromark-factory-whitespace@npm:2.0.1"
+ dependencies:
+ micromark-factory-space: "npm:^2.0.0"
+ micromark-util-character: "npm:^2.0.0"
+ micromark-util-symbol: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/67b3944d012a42fee9e10e99178254a04d48af762b54c10a50fcab988688799993efb038daf9f5dbc04001a97b9c1b673fc6f00e6a56997877ab25449f0c8650
+ languageName: node
+ linkType: hard
+
+"micromark-util-character@npm:2.1.1, micromark-util-character@npm:^2.0.0":
+ version: 2.1.1
+ resolution: "micromark-util-character@npm:2.1.1"
+ dependencies:
+ micromark-util-symbol: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/85da8f8e5f7ed16046575bef5b0964ca3fca3162b87b74ae279f1e48eb7160891313eb64f04606baed81c58b514dbdb64f1a9d110a51baaaa79225d72a7b1852
+ languageName: node
+ linkType: hard
+
+"micromark-util-chunked@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "micromark-util-chunked@npm:2.0.1"
+ dependencies:
+ micromark-util-symbol: "npm:^2.0.0"
+ checksum: 10/f8cb2a67bcefe4bd2846d838c97b777101f0043b9f1de4f69baf3e26bb1f9885948444e3c3aec66db7595cad8173bd4567a000eb933576c233d54631f6323fe4
+ languageName: node
+ linkType: hard
+
+"micromark-util-classify-character@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "micromark-util-classify-character@npm:2.0.1"
+ dependencies:
+ micromark-util-character: "npm:^2.0.0"
+ micromark-util-symbol: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/4d8bbe3a6dbf69ac0fc43516866b5bab019fe3f4568edc525d4feaaaf78423fa54e6b6732b5bccbeed924455279a3758ffc9556954aafb903982598a95a02704
+ languageName: node
+ linkType: hard
+
+"micromark-util-combine-extensions@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "micromark-util-combine-extensions@npm:2.0.1"
+ dependencies:
+ micromark-util-chunked: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/5d22fb9ee37e8143adfe128a72b50fa09568c2cc553b3c76160486c96dbbb298c5802a177a10a215144a604b381796071b5d35be1f2c2b2ee17995eda92f0c8e
+ languageName: node
+ linkType: hard
+
+"micromark-util-decode-numeric-character-reference@npm:^2.0.0":
+ version: 2.0.2
+ resolution: "micromark-util-decode-numeric-character-reference@npm:2.0.2"
+ dependencies:
+ micromark-util-symbol: "npm:^2.0.0"
+ checksum: 10/ee11c8bde51e250e302050474c4a2adca094bca05c69f6cdd241af12df285c48c88d19ee6e022b9728281c280be16328904adca994605680c43af56019f4b0b6
+ languageName: node
+ linkType: hard
+
+"micromark-util-decode-string@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "micromark-util-decode-string@npm:2.0.1"
+ dependencies:
+ decode-named-character-reference: "npm:^1.0.0"
+ micromark-util-character: "npm:^2.0.0"
+ micromark-util-decode-numeric-character-reference: "npm:^2.0.0"
+ micromark-util-symbol: "npm:^2.0.0"
+ checksum: 10/2f517e4c613609445db4b9a17f8c77832f55fb341620a8fd598f083c1227027485d601c2021c2f8f9883210b8671e7b3990f0c6feeecd49a136475465808c380
+ languageName: node
+ linkType: hard
+
+"micromark-util-encode@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "micromark-util-encode@npm:2.0.1"
+ checksum: 10/be890b98e78dd0cdd953a313f4148c4692cc2fb05533e56fef5f421287d3c08feee38ca679f318e740530791fc251bfe8c80efa926fcceb4419b269c9343d226
+ languageName: node
+ linkType: hard
+
+"micromark-util-html-tag-name@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "micromark-util-html-tag-name@npm:2.0.1"
+ checksum: 10/dea365f5ad28ad74ff29fcb581f7b74fc1f80271c5141b3b2bc91c454cbb6dfca753f28ae03730d657874fcbd89d0494d0e3965dfdca06d9855f467c576afa9d
+ languageName: node
+ linkType: hard
+
+"micromark-util-normalize-identifier@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "micromark-util-normalize-identifier@npm:2.0.1"
+ dependencies:
+ micromark-util-symbol: "npm:^2.0.0"
+ checksum: 10/1eb9a289d7da067323df9fdc78bfa90ca3207ad8fd893ca02f3133e973adcb3743b233393d23d95c84ccaf5d220ae7f5a28402a644f135dcd4b8cfa60a7b5f84
+ languageName: node
+ linkType: hard
+
+"micromark-util-resolve-all@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "micromark-util-resolve-all@npm:2.0.1"
+ dependencies:
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/9275f3ddb6c26f254dd2158e66215d050454b279707a7d9ce5a3cd0eba23201021cedcb78ae1a746c1b23227dcc418ee40dd074ade195359506797a5493550cc
+ languageName: node
+ linkType: hard
+
+"micromark-util-sanitize-uri@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "micromark-util-sanitize-uri@npm:2.0.1"
+ dependencies:
+ micromark-util-character: "npm:^2.0.0"
+ micromark-util-encode: "npm:^2.0.0"
+ micromark-util-symbol: "npm:^2.0.0"
+ checksum: 10/064c72abfc9777864ca0521a016dde62ab3e7af5215d10fd27e820798500d5d305da638459c589275c1a093cf588f493cc2f65273deac5a5331ecefc6c9ea78a
+ languageName: node
+ linkType: hard
+
+"micromark-util-subtokenize@npm:^2.0.0":
+ version: 2.1.0
+ resolution: "micromark-util-subtokenize@npm:2.1.0"
+ dependencies:
+ devlop: "npm:^1.0.0"
+ micromark-util-chunked: "npm:^2.0.0"
+ micromark-util-symbol: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/5f18c70cb952a414a4d161f5d6a5254d33c7dfcd56577e592ef2e172a0414058d3531a3554f43538f14e243592fffbc2e68ddaf6a41c54577b3ba7beb555d3dc
+ languageName: node
+ linkType: hard
+
+"micromark-util-symbol@npm:2.0.1, micromark-util-symbol@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "micromark-util-symbol@npm:2.0.1"
+ checksum: 10/497e6d95fc21c2bb5265b78a6a60db518c376dc438739b2e7d4aee6f9f165222711724b456c63163314f32b8eea68a064687711d41e986262926eab23ddb9229
+ languageName: node
+ linkType: hard
+
+"micromark-util-types@npm:2.0.2, micromark-util-types@npm:^2.0.0":
+ version: 2.0.2
+ resolution: "micromark-util-types@npm:2.0.2"
+ checksum: 10/a9eb067bd9384eab61942285d53738aa22f3fef4819eaf20249bec6ec13f1e4da2800230fd0ceb7e705108987aa9062fe3e9a8e5e48aa60180db80b9489dc3e2
+ languageName: node
+ linkType: hard
+
+"micromark@npm:^4.0.0":
+ version: 4.0.2
+ resolution: "micromark@npm:4.0.2"
+ dependencies:
+ "@types/debug": "npm:^4.0.0"
+ debug: "npm:^4.0.0"
+ decode-named-character-reference: "npm:^1.0.0"
+ devlop: "npm:^1.0.0"
+ micromark-core-commonmark: "npm:^2.0.0"
+ micromark-factory-space: "npm:^2.0.0"
+ micromark-util-character: "npm:^2.0.0"
+ micromark-util-chunked: "npm:^2.0.0"
+ micromark-util-combine-extensions: "npm:^2.0.0"
+ micromark-util-decode-numeric-character-reference: "npm:^2.0.0"
+ micromark-util-encode: "npm:^2.0.0"
+ micromark-util-normalize-identifier: "npm:^2.0.0"
+ micromark-util-resolve-all: "npm:^2.0.0"
+ micromark-util-sanitize-uri: "npm:^2.0.0"
+ micromark-util-subtokenize: "npm:^2.0.0"
+ micromark-util-symbol: "npm:^2.0.0"
+ micromark-util-types: "npm:^2.0.0"
+ checksum: 10/1b85e49c8f71013df2d07a59e477deb72cd325d41cc15f35b2aa52b8b7a93fed45498ce3e18ed34464a9afa9ba8a9210b2509454b2a2d16ac06c7429f562bfac
+ languageName: node
+ linkType: hard
+
"micromatch@npm:4.0.8, micromatch@npm:^4.0.8":
version: 4.0.8
resolution: "micromatch@npm:4.0.8"
@@ -7711,7 +8388,18 @@ __metadata:
linguist-languages: "npm:9.1.11"
magic-string: "npm:0.30.21"
make-synchronized: "npm:0.8.0"
+ mdast-util-from-markdown: "npm:2.0.2"
+ mdast-util-gfm: "npm:3.1.0"
+ mdast-util-math: "npm:3.0.0"
+ mdast-util-wiki-link: "npm:0.1.2"
meriyah: "npm:7.0.0"
+ micromark-extension-gfm: "npm:3.0.0"
+ micromark-extension-math: "npm:3.1.0"
+ micromark-extension-wiki-link: "npm:0.0.4"
+ micromark-factory-space: "npm:2.0.1"
+ micromark-util-character: "npm:2.1.1"
+ micromark-util-symbol: "npm:2.0.1"
+ micromark-util-types: "npm:2.0.2"
micromatch: "npm:4.0.8"
minimist: "npm:1.2.8"
n-readlines: "npm:3.4.0"
@@ -8033,7 +8721,7 @@ __metadata:
languageName: node
linkType: hard
-"repeat-string@npm:^1.5.4":
+"repeat-string@npm:^1.0.0, repeat-string@npm:^1.5.4":
version: 1.6.1
resolution: "repeat-string@npm:1.6.1"
checksum: 10/1b809fc6db97decdc68f5b12c4d1a671c8e3f65ec4a40c238bc5200e44e85bcc52a54f78268ab9c29fcf5fe4f1343e805420056d1f30fa9a9ee4c2d93e3cc6c0
@@ -9098,6 +9786,15 @@ __metadata:
languageName: node
linkType: hard
+"unist-util-is@npm:^6.0.0":
+ version: 6.0.1
+ resolution: "unist-util-is@npm:6.0.1"
+ dependencies:
+ "@types/unist": "npm:^3.0.0"
+ checksum: 10/dc3ebfb481f097863ae3674c440add6fe2d51a4cfcd565b13fb759c8a2eaefb71903a619b385e892c2ad6db6a5b60d068dfc5592b6dd57f4b60180082b3136d6
+ languageName: node
+ linkType: hard
+
"unist-util-remove-position@npm:^2.0.0":
version: 2.0.1
resolution: "unist-util-remove-position@npm:2.0.1"
@@ -9107,6 +9804,16 @@ __metadata:
languageName: node
linkType: hard
+"unist-util-remove-position@npm:^5.0.0":
+ version: 5.0.0
+ resolution: "unist-util-remove-position@npm:5.0.0"
+ dependencies:
+ "@types/unist": "npm:^3.0.0"
+ unist-util-visit: "npm:^5.0.0"
+ checksum: 10/4d89dc25e2091f9d47d92552145a26bf0e4a32d6b453e9cacac7742d730ada186ee1b820579fee3eeaa31e119850c2cb82f8b5898f977a636d7220e998626967
+ languageName: node
+ linkType: hard
+
"unist-util-stringify-position@npm:^2.0.0":
version: 2.0.3
resolution: "unist-util-stringify-position@npm:2.0.3"
@@ -9116,6 +9823,15 @@ __metadata:
languageName: node
linkType: hard
+"unist-util-stringify-position@npm:^4.0.0":
+ version: 4.0.0
+ resolution: "unist-util-stringify-position@npm:4.0.0"
+ dependencies:
+ "@types/unist": "npm:^3.0.0"
+ checksum: 10/d15c88aca7a31902d95d5b5355bbe09583cf6f6ff6e59e134ef76c76d3c30bc1021f2d7ea5b7897c6d0858ed5f3770c1b19de9c78274f50d72f95a0d05f1af71
+ languageName: node
+ linkType: hard
+
"unist-util-visit-parents@npm:^3.0.0":
version: 3.1.1
resolution: "unist-util-visit-parents@npm:3.1.1"
@@ -9126,6 +9842,16 @@ __metadata:
languageName: node
linkType: hard
+"unist-util-visit-parents@npm:^6.0.0":
+ version: 6.0.2
+ resolution: "unist-util-visit-parents@npm:6.0.2"
+ dependencies:
+ "@types/unist": "npm:^3.0.0"
+ unist-util-is: "npm:^6.0.0"
+ checksum: 10/aa16e97e45bd1d641e1f933d2fb3bf0800865350eaeb5cc0317ab511075480fb4ac5e2a55f57dd72d27311e8ba29fd23908848bd83479849c626be1f7dabcae5
+ languageName: node
+ linkType: hard
+
"unist-util-visit@npm:^2.0.0":
version: 2.0.3
resolution: "unist-util-visit@npm:2.0.3"
@@ -9137,6 +9863,17 @@ __metadata:
languageName: node
linkType: hard
+"unist-util-visit@npm:^5.0.0":
+ version: 5.0.0
+ resolution: "unist-util-visit@npm:5.0.0"
+ dependencies:
+ "@types/unist": "npm:^3.0.0"
+ unist-util-is: "npm:^6.0.0"
+ unist-util-visit-parents: "npm:^6.0.0"
+ checksum: 10/f2bbde23641e9ade7640358c06ddeec0f38342322eb8e7819d9ee380b0f859d25d084dde22bf63db0280b3b2f36575f15aa1d6c23acf276c91c2493cf799e3b0
+ languageName: node
+ linkType: hard
+
"unrs-resolver@npm:^1.7.11":
version: 1.11.1
resolution: "unrs-resolver@npm:1.11.1"
@@ -9636,3 +10373,17 @@ __metadata:
checksum: 10/0679190318928f69fcb07751063719de232c663b13955fcdb55db59839569d39f3f29b955cb0cba7af0b724233f88c06b3e84c550397ad4e68f8088fa6799d88
languageName: node
linkType: hard
+
+"zwitch@npm:^1.0.0":
+ version: 1.0.5
+ resolution: "zwitch@npm:1.0.5"
+ checksum: 10/28a1bebacab3bc60150b6b0a2ba1db2ad033f068e81f05e4892ec0ea13ae63f5d140a1d692062ac0657840c8da076f35b94433b5f1c329d7803b247de80f064a
+ languageName: node
+ linkType: hard
+
+"zwitch@npm:^2.0.0":
+ version: 2.0.4
+ resolution: "zwitch@npm:2.0.4"
+ checksum: 10/f22ec5fc2d5f02c423c93d35cdfa83573a3a3bd98c66b927c368ea4d0e7252a500df2a90a6b45522be536a96a73404393c958e945fdba95e6832c200791702b6
+ languageName: node
+ linkType: hard