Upgrade to latest micromark (markdown only) (#18277)

Co-authored-by: fisker Cheung <lionkay@gmail.com>
Co-authored-by: fisker <lionkay@gmail.com>
Co-authored-by: Jed Fox <git@jedfox.com>
Co-authored-by: seiya <20365512+seiyab@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2025-12-26 19:43:49 +08:00
1 parent 4f1c4d9eb8
commit 6c339cd882
84 files changed
+6944 -596

No files matched your search

+5 -1
View File
@@ -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
+5
View File
@@ -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!
+39
View File
@@ -0,0 +1,39 @@
#### Support setext headings (#18473 by @fisker)
<!-- prettier-ignore -->
```md
<!-- Input -->
Setext Heading 1
================
Setext Heading 2
----------------
Multiline
Setext
Heading
-------
<!-- Prettier stable -->
# Setext Heading 1
## Setext Heading 2
Multiline
Setext
Heading
---
<!-- Prettier main -->
Setext Heading 1
================
Setext Heading 2
----------------
Multiline
Setext
Heading
-------
```
+4 -1
View File
@@ -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",
+3
View File
@@ -84,6 +84,9 @@ const config = {
"<rootDir>/tests/integration/integration-test-setup.js",
],
runner: "jest-light-runner/child-process",
testEnvironmentOptions: {
customExportConditions: ["development"],
},
snapshotSerializers: [
"jest-snapshot-serializer-raw",
"jest-snapshot-serializer-ansi",
+11
View File
@@ -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",
+4
View File
@@ -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"),
+8 -4
View File
@@ -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 &&
+3 -1
View File
@@ -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,
);
+2 -1
View File
@@ -1 +1,2 @@
export { parseMarkdown, parseMdx } from "./parse.js";
export { parseMarkdown } from "./parse-markdown.js";
export { parseMdx } from "./parse-mdx.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;
}
@@ -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<Code> | undefined} */
let marker;
/** @type {number} */
let index;
/** @type {State} */
let returnState;
return start;
/**
* Start of HTML (text).
*
* ```markdown
* > | a <b> 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 <b> c
* ^
* > | a <!doctype> c
* ^
* > | a <!--b--> 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 `<!`, at declaration, comment, or CDATA.
*
* ```markdown
* > | a <!doctype> c
* ^
* > | a <!--b--> c
* ^
* > | a <![CDATA[>&<]]> 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 `<!-`, at another `-`.
*
* ```markdown
* > | a <!--b--> c
* ^
* ```
*
* @type {State}
*/
function commentOpenInside(code) {
if (code === codes.dash) {
effects.consume(code);
return commentEnd;
}
return nok(code);
}
/**
* In comment.
*
* ```markdown
* > | a <!--b--> 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 <!--b--> c
* ^
* ```
*
* @type {State}
*/
function commentClose(code) {
if (code === codes.dash) {
effects.consume(code);
return commentEnd;
}
return comment(code);
}
/**
* In comment, after `--`.
*
* ```markdown
* > | a <!--b--> c
* ^
* ```
*
* @type {State}
*/
function commentEnd(code) {
return code === codes.greaterThan
? end(code)
: code === codes.dash
? commentClose(code)
: comment(code);
}
/**
* After `<![`, in CDATA, expecting `CDATA[`.
*
* ```markdown
* > | a <![CDATA[>&<]]> 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 <![CDATA[>&<]]> 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 <![CDATA[>&<]]> b
* ^
* ```
*
* @type {State}
*/
function cdataClose(code) {
if (code === codes.rightSquareBracket) {
effects.consume(code);
return cdataEnd;
}
return cdata(code);
}
/**
* In CDATA, after `]]`, at `>`.
*
* ```markdown
* > | a <![CDATA[>&<]]> 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 <!b> 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 <?b?> 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 <?b?> c
* ^
* ```
*
* @type {State}
*/
function instructionClose(code) {
return code === codes.greaterThan ? end(code) : instruction(code);
}
/**
* After `</`, in closing tag, at tag name.
*
* ```markdown
* > | a </b> c
* ^
* ```
*
* @type {State}
*/
function tagCloseStart(code) {
// ASCII alphabetical.
if (asciiAlpha(code)) {
effects.consume(code);
return tagClose;
}
return nok(code);
}
/**
* After `</x`, in a tag name.
*
* ```markdown
* > | a </b> 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 </b> 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 `<x`, in opening tag name.
*
* ```markdown
* > | a <b> 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 <b> 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 <b c> 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 <b c> 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 <b c=d> 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 <b c="d"> 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 <b c=d> 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 <b c="d"> 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 <b c="d"> 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 <!--a
* ^
* | b-->
* ```
*
* @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 <!--a
* > | b-->
* ^
* ```
*
* @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 <!--a
* > | b-->
* ^
* ```
*
* @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 };
@@ -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 };
@@ -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 };
@@ -22,27 +22,21 @@ import wikiLink from "./unified-plugins/wiki-link.js";
* interface Sentence { children: Array<Word | Whitespace> }
* interface InlineCode { children: Array<Sentence> }
*/
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 };
+75 -12
View File
@@ -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 };
+31
View File
@@ -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 };
+35
View File
@@ -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 };
+1
View File
@@ -1 +1,2 @@
export { printPrettierIgnored } from "./ignored.js";
export { printMdast } from "./mdast.js";
+127 -2
View File
@@ -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 };
+64 -26
View File
@@ -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 [
"![",
node.alt || "",
printImageAlt(node, options),
"](",
printUrl(node.url, ")"),
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 };
+351 -5
View File
@@ -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
+14 -7
View File
@@ -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) {
+13 -11
View File
@@ -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;
}
+97 -1
View File
@@ -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 };
+2 -1
View File
@@ -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 };
+18 -1
View File
@@ -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*(?<numberText>\d+)(\.|\))(?<leadingSpaces>\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,
+7 -1
View File
@@ -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,
+1 -2
View File
@@ -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 (
File diff suppressed because it is too large. Load diff
@@ -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"]
@@ -0,0 +1 @@
long long long long long long long long long long long long long long long > > > > this is not quote
@@ -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.
+17
View File
@@ -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
@@ -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
\\
@@ -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
================================================================================
`;
@@ -0,0 +1,2 @@
runFormatTest(import.meta, ["markdown"]);
runFormatTest(import.meta, ["markdown"], { proseWrap: "always" });
@@ -0,0 +1,4 @@
- 1
foo
- 2\
bar
@@ -32,7 +32,6 @@ proseWrap: "always"
- 1
- 2
- 3
\`\`\`js
md\`
# this is the root indent
@@ -213,11 +212,11 @@ proseWrap: "always"
<!-- prettier/prettier#3459 -->
1. Change to your home directory:
1. Change to your home directory:
cd
2. List the contents:
2. List the contents:
ls -l
@@ -147,7 +147,7 @@ proseWrap: "always"
__a<http://foo.bar?q=__>
=====================================output=====================================
**a<http://foo.bar?q=**>
__a<http://foo.bar?q=__>
================================================================================
`;
@@ -377,7 +377,8 @@ Header
foo
## Header
Header
------
foo
@@ -403,7 +404,7 @@ proseWrap: "always"
\\[foo]: /url "not a reference"
=====================================output=====================================
\\*not emphasized\\* \\<br/> not a tag \\[not a link](/foo) \\\`not code\` 1\\. not a
\\*not emphasized* \\<br/> 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\\* \\<br/> not a tag \\[not a link](/foo) \\\`not code\` 1\\. not a
\\*not emphasized* \\<br/> 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
File diff suppressed because it is too large. Load diff
@@ -1,18 +1,11 @@
import commonmarkTestSuite from "commonmark-test-suite";
const BUGS = new Set([
"example-11.md",
"example-43.md",
"example-47.md",
"example-77.md",
"example-146.md",
"example-196.md",
"example-273.md",
"example-274.md",
"example-349.md",
"example-417.md",
"example-438.md",
"example-493.md",
]);
runFormatTest(
@@ -61,7 +61,7 @@ proseWrap: "always"
!_1_2
0_1_! <!-- remark-misparsing, should be formatted as \`0_1\\_!\` -->
0_1_!
!_1_!
@@ -69,7 +69,7 @@ proseWrap: "always"
!_1_2
0_1_! <!-- remark-misparsing, should be formatted as \`0_1\\_!\` -->
0_1_!
!_1_!
@@ -96,23 +96,23 @@ proseWrap: "always"
0_1_2
!\\_1_2
!_1_2
0*1*! <!-- remark-misparsing, should be formatted as \`0_1\\_!\` -->
0_1_!
!_1_!
0_1_2
!\\_1_2
!_1_2
0*1*! <!-- remark-misparsing, should be formatted as \`0_1\\_!\` -->
0_1_!
!_1_!
1***2***3
1 **_2_** 3
1 _**2**_ 3
================================================================================
`;
+2 -2
View File
@@ -18,7 +18,7 @@
!_1_2
0_1_! <!-- remark-misparsing, should be formatted as `0_1\_!` -->
0_1_!
!_1_!
@@ -26,7 +26,7 @@
!_1_2
0_1_! <!-- remark-misparsing, should be formatted as `0_1\_!` -->
0_1_!
!_1_!
@@ -133,10 +133,47 @@ bar
| abc | def |
| --- | --- |
| bar | baz |
| bar |
bar
bar
================================================================================
`;
exports[`snippet: example-203.md (4.10 Tables (extension)) - {"proseWrap":"always"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
proseWrap: "always"
| printWidth
=====================================input======================================
| abc | def |
| --- |
| bar |
=====================================output=====================================
| abc | def | | --- | | bar |
================================================================================
`;
exports[`snippet: example-204.md (4.10 Tables (extension)) - {"proseWrap":"always"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
proseWrap: "always"
| printWidth
=====================================input======================================
| abc | def |
| --- | --- |
| bar |
| bar | baz | boo |
=====================================output=====================================
| abc | def |
| --- | --- |
| bar |
| bar | baz | boo |
================================================================================
`;
@@ -266,7 +303,7 @@ proseWrap: "always"
__a<http://foo.bar/?q=__>
=====================================output=====================================
**a<http://foo.bar/?q=**>
__a<http://foo.bar/?q=__>
================================================================================
`;
@@ -281,7 +318,7 @@ proseWrap: "always"
~~Hi~~ Hello, ~there~ world!
=====================================output=====================================
~~Hi~~ Hello, ~there~ world!
~~Hi~~ Hello, ~~there~~ world!
================================================================================
`;
@@ -5,7 +5,7 @@ const existsInCommonmarkTestSuite = new Set(
commonmarkTestSuite.latest.testCases.map(({ markdown }) => markdown),
);
const BUGS = new Set(["example-203.md", "example-204.md"]);
const BUGS = new Set();
runFormatTest(
{
@@ -72,27 +72,6 @@ proseWrap: "always"
================================================================================
`;
exports[`setext.md - {"proseWrap":"always"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
proseWrap: "always"
| printWidth
=====================================input======================================
h1
===
h2
---
=====================================output=====================================
# h1
## h2
================================================================================
`;
exports[`unbreakable.md - {"proseWrap":"always"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
@@ -0,0 +1,185 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
exports[`child.md format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
| printWidth
=====================================input======================================
>>> bar
>>> ===
- in list
- in list
heading
=======
- in list
>>> heading
>>> =======
=====================================output=====================================
> > > bar
> > > ===
- in list
- in list
heading
=======
- in list
> > > heading
> > > =======
================================================================================
`;
exports[`definition-before.md format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
| printWidth
=====================================input======================================
<!-- https://spec.commonmark.org/0.31.2/#example-215 -->
[foo]: /url1
[foo]: /url2
bar
===
[foo]: /url1
[foo]: /url2
bar
===
=====================================output=====================================
<!-- https://spec.commonmark.org/0.31.2/#example-215 -->
[foo]: /url1
[foo]: /url2
bar
===
[foo]: /url1
[foo]: /url2
bar
===
================================================================================
`;
exports[`issue-6013.md format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
| printWidth
=====================================input======================================
Setext Heading 1
================
Setext Heading 2
----------------
## ATX Heading 2
=====================================output=====================================
Setext Heading 1
================
Setext Heading 2
----------------
## ATX Heading 2
================================================================================
`;
exports[`issue-6013-2.md format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
| printWidth
=====================================input======================================
Heading
[![Shields.io badge](https://img.shields.io/badge/Shields.io-badge-brightgreen)](https://shields.io)
=======
=====================================output=====================================
Heading
[![Shields.io badge](https://img.shields.io/badge/Shields.io-badge-brightgreen)](https://shields.io)
=======
================================================================================
`;
exports[`setext.md format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
| printWidth
=====================================input======================================
h1
===
h2
---
=====================================output=====================================
h1
===
h2
---
================================================================================
`;
exports[`snippet: #0 format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
| printWidth
=====================================input======================================
Multi\\
Line
Setext\\
Heading
=======
Multi\\
Line
Setext\\
Heading
-------
=====================================output=====================================
Multi\\
Line
Setext\\
Heading
=======
Multi\\
Line
Setext\\
Heading
-------
================================================================================
`;
exports[`snippet: #1 format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
| printWidth
=====================================input======================================
[foo]: /url
bar
===
=====================================output=====================================
[foo]: /url
bar
===
================================================================================
`;
@@ -0,0 +1,10 @@
>>> bar
>>> ===
- in list
- in list
heading
=======
- in list
>>> heading
>>> =======
@@ -0,0 +1,11 @@
<!-- https://spec.commonmark.org/0.31.2/#example-215 -->
[foo]: /url1
[foo]: /url2
bar
===
[foo]: /url1
[foo]: /url2
bar
===
@@ -0,0 +1,30 @@
import { outdent } from "outdent";
runFormatTest(
{
importMeta: import.meta,
snippets: [
// #17807
outdent`
Multi${"\\"}
Line${" ".repeat(2)}
Setext${"\\"}
Heading
=======
Multi${"\\"}
Line${" ".repeat(2)}
Setext${"\\"}
Heading
-------
`,
// https://spec.commonmark.org/0.31.2/#example-215
outdent`
[foo]: /url${" "}
bar
===
`,
],
},
["markdown"],
);
@@ -0,0 +1,3 @@
Heading
[![Shields.io badge](https://img.shields.io/badge/Shields.io-badge-brightgreen)](https://shields.io)
=======
@@ -0,0 +1,7 @@
Setext Heading 1
================
Setext Heading 2
----------------
## ATX Heading 2
@@ -28,6 +28,7 @@ quoted sentence2</p>
=====================================output=====================================
- A list item.
<details><summary>Summary</summary>
<p>
@@ -37,6 +38,109 @@ quoted sentence2</p>
</details>
- A list item.
<blockquote>
<p>quoted sentence1<br>
quoted sentence2</p>
</blockquote>
- indented html is formatted as it is
<blockquote>asdf</blockquote>
================================================================================
`;
exports[`beginning-tag-after-a-list-item.md - {"proseWrap":"never"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
proseWrap: "never"
| printWidth
=====================================input======================================
- A list item.
<details><summary>Summary</summary>
<p>
- A list item.
</p>
</details>
- A list item.
<blockquote>
<p>quoted sentence1<br>
quoted sentence2</p>
</blockquote>
- indented html is formatted as it is
<blockquote>asdf</blockquote>
=====================================output=====================================
- A list item.
<details><summary>Summary</summary>
<p>
- A list item.
</p>
</details>
- A list item.
<blockquote>
<p>quoted sentence1<br>
quoted sentence2</p>
</blockquote>
- indented html is formatted as it is
<blockquote>asdf</blockquote>
================================================================================
`;
exports[`beginning-tag-after-a-list-item.md - {"proseWrap":"preserve"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
proseWrap: "preserve"
| printWidth
=====================================input======================================
- A list item.
<details><summary>Summary</summary>
<p>
- A list item.
</p>
</details>
- A list item.
<blockquote>
<p>quoted sentence1<br>
quoted sentence2</p>
</blockquote>
- indented html is formatted as it is
<blockquote>asdf</blockquote>
=====================================output=====================================
- A list item.
<details><summary>Summary</summary>
<p>
- A list item.
</p>
</details>
- A list item.
<blockquote>
<p>quoted sentence1<br>
@@ -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======================================
<!--lint disable no-html-->
<p align="center"><img src="logo/vertical.png" alt="labelify" height="150px"></p>
<!--lint enable no-html-->
=====================================output=====================================
<!--lint disable no-html-->
<p align="center"><img src="logo/vertical.png" alt="labelify" height="150px"></p>
<!--lint enable no-html-->
================================================================================
`;
exports[`blank-line-between-htmls.md - {"proseWrap":"preserve"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
proseWrap: "preserve"
| printWidth
=====================================input======================================
<!--lint disable no-html-->
<p align="center"><img src="logo/vertical.png" alt="labelify" height="150px"></p>
<!--lint enable no-html-->
=====================================output=====================================
<!--lint disable no-html-->
<p align="center"><img src="logo/vertical.png" alt="labelify" height="150px"></p>
<!--lint enable no-html-->
================================================================================
`;
exports[`inline-html.md - {"proseWrap":"always"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
proseWrap: "always"
| printWidth
=====================================input======================================
text
<em>text</em>
text
text
<em>text</em>
text
<em>text</em>
![image](https://example.com)
<img src="image.png" />
Foo
<div>
bar
</div>
Foo
<div>
bar
</div>
Foo
<div>
bar
</div>
=====================================output=====================================
text <em>text</em> text
text <em>text</em>
text <em>text</em>
![image](https://example.com) <img src="image.png" />
Foo
<div>
bar
</div>
Foo
<div>
bar
</div>
Foo
<div>
bar
</div>
================================================================================
`;
exports[`inline-html.md - {"proseWrap":"never"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
proseWrap: "never"
| printWidth
=====================================input======================================
text
<em>text</em>
text
text
<em>text</em>
text
<em>text</em>
![image](https://example.com)
<img src="image.png" />
Foo
<div>
bar
</div>
Foo
<div>
bar
</div>
Foo
<div>
bar
</div>
=====================================output=====================================
text <em>text</em> text
text <em>text</em>
text <em>text</em>
![image](https://example.com) <img src="image.png" />
Foo
<div>
bar
</div>
Foo
<div>
bar
</div>
Foo
<div>
bar
</div>
================================================================================
`;
exports[`inline-html.md - {"proseWrap":"preserve"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
proseWrap: "preserve"
| printWidth
=====================================input======================================
text
<em>text</em>
text
text
<em>text</em>
text
<em>text</em>
![image](https://example.com)
<img src="image.png" />
Foo
<div>
bar
</div>
Foo
<div>
bar
</div>
Foo
<div>
bar
</div>
=====================================output=====================================
text
<em>text</em>
text
text
<em>text</em>
text
<em>text</em>
![image](https://example.com)
<img src="image.png" />
Foo
<div>
bar
</div>
Foo
<div>
bar
</div>
Foo
<div>
bar
</div>
================================================================================
`;
exports[`inline-vs-block.md - {"proseWrap":"always"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
proseWrap: "always"
| printWidth
=====================================input======================================
- <div>html</div> text
- <span>html</span> text
=====================================output=====================================
- <div>html</div> text
- <span>html</span> text
================================================================================
`;
exports[`inline-vs-block.md - {"proseWrap":"never"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
proseWrap: "never"
| printWidth
=====================================input======================================
- <div>html</div> text
- <span>html</span> text
=====================================output=====================================
- <div>html</div> text
- <span>html</span> text
================================================================================
`;
exports[`inline-vs-block.md - {"proseWrap":"preserve"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
proseWrap: "preserve"
| printWidth
=====================================input======================================
- <div>html</div> text
- <span>html</span> text
=====================================output=====================================
- <div>html</div> text
- <span>html</span> 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.
<table class="table table-striped">
<tr>
<th>Test</th>
<th>Table</th>
</tr>
<tbody>
<tr>
<td>will</td>
<td>be</td>
</tr>
<tr>
<td>pushed</td>
<td>When</td>
</tr>
<tr>
<td>Format on</td>
<td>Save</td>
</tr>
</tbody>
</table>
=====================================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.
<table class="table table-striped">
<tr>
<th>Test</th>
<th>Table</th>
</tr>
<tbody>
<tr>
<td>will</td>
<td>be</td>
</tr>
<tr>
<td>pushed</td>
<td>When</td>
</tr>
<tr>
<td>Format on</td>
<td>Save</td>
</tr>
</tbody>
</table>
================================================================================
`;
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.
<table class="table table-striped">
<tr>
<th>Test</th>
<th>Table</th>
</tr>
<tbody>
<tr>
<td>will</td>
<td>be</td>
</tr>
<tr>
<td>pushed</td>
<td>When</td>
</tr>
<tr>
<td>Format on</td>
<td>Save</td>
</tr>
</tbody>
</table>
=====================================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.
<table class="table table-striped">
<tr>
<th>Test</th>
<th>Table</th>
</tr>
<tbody>
<tr>
<td>will</td>
<td>be</td>
</tr>
<tr>
<td>pushed</td>
<td>When</td>
</tr>
<tr>
<td>Format on</td>
<td>Save</td>
</tr>
</tbody>
</table>
================================================================================
`;
exports[`multiline-attribute.md - {"proseWrap":"always"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
proseWrap: "always"
| printWidth
=====================================input======================================
<unknown title="line 1
line 2
"></unknown>
<div title="line 1
line 2
"></div>
- In list
- In list
<unknown title="line 1
line 2
"></unknown>
<div title="line 1
line 2
"></div>
> in blockquote
>
> <unknown title="line 1
> line 2
> "></unknown>
>
> <div title="line 1
> line 2
> "></div>
text <unknown title="line 1
line 2
">text </unknown> text
=====================================output=====================================
<unknown title="line 1
line 2
"></unknown>
<div title="line 1
line 2
"></div>
- In list
- In list
<unknown title="line 1
line 2
"></unknown>
<div title="line 1
line 2
"></div>
> in blockquote
>
> <unknown title="line 1
> line 2
> "></unknown>
>
> <div title="line 1
> line 2
> "></div>
text <unknown title="line 1
line 2
">text </unknown> text
================================================================================
`;
exports[`multiline-attribute.md - {"proseWrap":"never"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
proseWrap: "never"
| printWidth
=====================================input======================================
<unknown title="line 1
line 2
"></unknown>
<div title="line 1
line 2
"></div>
- In list
- In list
<unknown title="line 1
line 2
"></unknown>
<div title="line 1
line 2
"></div>
> in blockquote
>
> <unknown title="line 1
> line 2
> "></unknown>
>
> <div title="line 1
> line 2
> "></div>
text <unknown title="line 1
line 2
">text </unknown> text
=====================================output=====================================
<unknown title="line 1
line 2
"></unknown>
<div title="line 1
line 2
"></div>
- In list
- In list
<unknown title="line 1
line 2
"></unknown>
<div title="line 1
line 2
"></div>
> in blockquote
>
> <unknown title="line 1
> line 2
> "></unknown>
>
> <div title="line 1
> line 2
> "></div>
text <unknown title="line 1
line 2
">text </unknown> text
================================================================================
`;
exports[`multiline-attribute.md - {"proseWrap":"preserve"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
proseWrap: "preserve"
| printWidth
=====================================input======================================
<unknown title="line 1
line 2
"></unknown>
<div title="line 1
line 2
"></div>
- In list
- In list
<unknown title="line 1
line 2
"></unknown>
<div title="line 1
line 2
"></div>
> in blockquote
>
> <unknown title="line 1
> line 2
> "></unknown>
>
> <div title="line 1
> line 2
> "></div>
text <unknown title="line 1
line 2
">text </unknown> text
=====================================output=====================================
<unknown title="line 1
line 2
"></unknown>
<div title="line 1
line 2
"></div>
- In list
- In list
<unknown title="line 1
line 2
"></unknown>
<div title="line 1
line 2
"></div>
> in blockquote
>
> <unknown title="line 1
> line 2
> "></unknown>
>
> <div title="line 1
> line 2
> "></div>
text <unknown title="line 1
line 2
">text </unknown> 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.
<table class="table table-striped">
<tr>
<th>Test</th>
<th>Table</th>
</tr>
<tbody>
<tr>
<td>will</td>
<td>be</td>
</tr>
<tr>
<td>pushed</td>
<td>When</td>
</tr>
<tr>
<td>Format on</td>
<td>Save</td>
</tr>
</tbody>
</table>
=====================================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.
<table class="table table-striped">
<tr>
<th>Test</th>
<th>Table</th>
</tr>
<tbody>
<tr>
<td>will</td>
<td>be</td>
</tr>
<tr>
<td>pushed</td>
<td>When</td>
</tr>
<tr>
<td>Format on</td>
<td>Save</td>
</tr>
</tbody>
</table>
================================================================================
`;
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.
<table class="table table-striped">
<tr>
<th>Test</th>
<th>Table</th>
</tr>
<tbody>
<tr>
<td>will</td>
<td>be</td>
</tr>
<tr>
<td>pushed</td>
<td>When</td>
</tr>
<tr>
<td>Format on</td>
<td>Save</td>
</tr>
</tbody>
</table>
=====================================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.
<table class="table table-striped">
<tr>
<th>Test</th>
<th>Table</th>
</tr>
<tbody>
<tr>
<td>will</td>
<td>be</td>
</tr>
<tr>
<td>pushed</td>
<td>When</td>
</tr>
<tr>
<td>Format on</td>
<td>Save</td>
</tr>
</tbody>
</table>
================================================================================
`;
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======================================
<!-- hello world -->
=====================================output=====================================
<!-- hello world -->
================================================================================
`;
exports[`simple.md - {"proseWrap":"preserve"} format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
proseWrap: "preserve"
| printWidth
=====================================input======================================
<!-- hello world -->
=====================================output=====================================
<!-- hello world -->
================================================================================
`;
@@ -1 +1,3 @@
runFormatTest(import.meta, ["markdown"], { proseWrap: "always" });
runFormatTest(import.meta, ["markdown"], { proseWrap: "never" });
runFormatTest(import.meta, ["markdown"], { proseWrap: "preserve" });
+28
View File
@@ -0,0 +1,28 @@
text
<em>text</em>
text
text
<em>text</em>
text
<em>text</em>
![image](https://example.com)
<img src="image.png" />
Foo
<div>
bar
</div>
Foo
<div>
bar
</div>
Foo
<div>
bar
</div>
@@ -0,0 +1,2 @@
- <div>html</div> text
- <span>html</span> text
@@ -0,0 +1,33 @@
<unknown title="line 1
line 2
"></unknown>
<div title="line 1
line 2
"></div>
- In list
- In list
<unknown title="line 1
line 2
"></unknown>
<div title="line 1
line 2
"></div>
> in blockquote
>
> <unknown title="line 1
> line 2
> "></unknown>
>
> <div title="line 1
> line 2
> "></div>
text <unknown title="line 1
line 2
">text </unknown> text
@@ -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
<!-- backtick -->
- ![ Image alt with \`\`backtick\`\` ](a.png)
- ![ Image alt 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 \` ][]
<!-- square brackets -->
- ![ 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
<!-- backtick -->
- ![ Image alt with \`\`backtick\`\` ](a.png)
- ![ Image alt 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 \` ][]
<!-- square brackets -->
- ![ 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"]
+17
View File
@@ -0,0 +1,17 @@
[Image-reference]: a.png
[ Image reference with ``backtick`` ]: a.png
[ Image reference with ``backtick ` ]: a.png
<!-- backtick -->
- ![ Image alt with ``backtick`` ](a.png)
- ![ Image alt 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 ` ][]
<!-- square brackets -->
- ![ 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]
@@ -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 '\\\\"')
<!-- magical incantations -->
@@ -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 '\\\\"')
<!-- magical incantations -->
@@ -0,0 +1 @@
"https\://developer.mozilla.org" x
@@ -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"
@@ -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\`
@@ -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`
@@ -1 +1,3 @@
[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落][]
[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落]: /abc
@@ -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* }}
================================================================================
`;
File diff suppressed because it is too large. Load diff
@@ -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
@@ -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======================================
<details>
<summary><h2>Checklist</h2></summary>
- [ ] I checked for duplicate issues.
</details>
<details>
<summary><h2>Checklist</h2></summary>
- [ ] I checked for duplicate issues.
- [ ] I checked for duplicate issues.
</details>
=====================================output=====================================
<details>
<summary><h2>Checklist</h2></summary>
- [ ] I checked for duplicate issues.
</details>
<details>
<summary><h2>Checklist</h2></summary>
- [ ] I checked for duplicate issues.
- [ ] I checked for duplicate issues.
</details>
================================================================================
`;
@@ -0,0 +1 @@
runFormatTest(import.meta, ["markdown"]);
@@ -0,0 +1,11 @@
<details>
<summary><h2>Checklist</h2></summary>
- [ ] I checked for duplicate issues.
</details>
<details>
<summary><h2>Checklist</h2></summary>
- [ ] I checked for duplicate issues.
- [ ] I checked for duplicate issues.
</details>
@@ -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
========
@@ -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
$$
@@ -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))
================================================================================
`;
@@ -34,8 +34,7 @@ nasalカ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク
nasalカ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚カ゚キ゚ク゚ケ゚コ゚
かつてはワ行のワ、ヰ、ヱ、ヲに濁点を付して [v]
音を表現すること(ワ゛、ヰ゛、ヱ゛、ヲ゛)も行われたが、一般的にはならなかった。
かつてはワ行のワ、ヰ、ヱ、ヲに濁点を付して [v] 音を表現すること(ワ゛、ヰ゛、ヱ゛、ヲ゛)も行われたが、一般的にはならなかった。
================================================================================
`;
@@ -180,9 +179,14 @@ proseWrap: "always"
=====================================input======================================
[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落][]
[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落]: /abc
=====================================output=====================================
[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落][]
[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落]:
/abc
================================================================================
`;
@@ -1 +1,3 @@
[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落][]
[這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落]: /abc
@@ -89,11 +89,29 @@ proseWrap: "always"
|:--|:-:|--:|
| \\| | \\| | \\| |
| a | b |
|:--|:-:|
| \`\\|\` | \`\\\\\\|\` |
| \`\\|\\|\` | \`\\\\\\\\\\|\` |
| a | b |
| --- | --- |
| \`not | inline code\` |
=====================================output=====================================
| a | b | c |
| :-- | :-: | --: |
| \\| | \\| | \\| |
| a | b |
| :----- | :------: |
| \`\\|\` | \`\\\\\\|\` |
| \`\\|\\|\` | \`\\\\\\\\\\|\` |
| a | b |
| ---- | ------------ |
| \`not | inline code\` |
================================================================================
`;
+9
View File
@@ -1,3 +1,12 @@
| a | b | c |
|:--|:-:|--:|
| \| | \| | \| |
| a | b |
|:--|:-:|
| `\|` | `\\\|` |
| `\|\|` | `\\\\\|` |
| a | b |
| --- | --- |
| `not | inline code` |
@@ -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 <!--
comment
-->]]
[[test19 <span>text</span>
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 <!--
comment
-->]]
[[test19 <span>text</span>
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 <!--
comment
-->]]
[[test19 <span>text</span>
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 <!--
comment
-->]]
[[test19 <span>text</span>
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 <!--
comment
-->]]
[[test19 <span>text</span>
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 <!--
comment
-->]]
[[test19 <span>text</span>
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 <!--
comment
-->]]
[[test19 <span>text</span>
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 <!--
comment
-->]]
[[test19 <span>text</span>
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. ]]
================================================================================
`;
@@ -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 <!--
comment
-->]]
[[test19 <span>text</span>
text]]
> [[quote test
> text]]
@@ -38,7 +38,7 @@ asd &amp; asd &#132; 123
123&#98765432;123
=====================================output=====================================
hello \\* world \\_ ~~ ya
hello \\* world _ ~~ ya
escape & html < entity > foo
@@ -52,7 +52,7 @@ asd &amp; asd &#132; 123
123*123*123
123 _ 123 _ 123
123 * 123 * 123
## 类的 prototype 属性和\\_\\_proto\\_\\_属性
+754 -3
View File
@@ -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