markdown-codec 1.3.31 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ast/ast.cjs +2 -1
- package/dist/ast/ast.d.cts +2 -2
- package/dist/ast/ast.d.ts +2 -2
- package/dist/ast/ast.js +2 -1
- package/dist/{ast-BXYwy08e.d.cts → ast-DbjiuYr8.d.cts} +13 -3
- package/dist/{ast-BXYwy08e.d.ts → ast-DbjiuYr8.d.ts} +13 -3
- package/dist/block/block.cjs +44 -4
- package/dist/block/block.d.cts +3 -3
- package/dist/block/block.d.ts +3 -3
- package/dist/block/block.js +44 -4
- package/dist/block/definitions.d.cts +1 -1
- package/dist/block/definitions.d.ts +1 -1
- package/dist/block/node.cjs +1 -1
- package/dist/block/node.d.cts +2 -2
- package/dist/block/node.d.ts +2 -2
- package/dist/block/node.js +1 -1
- package/dist/block/table.d.cts +1 -1
- package/dist/block/table.d.ts +1 -1
- package/dist/diagnostics/diagnostics.cjs +3 -0
- package/dist/diagnostics/diagnostics.d.cts +1 -1
- package/dist/diagnostics/diagnostics.d.ts +1 -1
- package/dist/diagnostics/diagnostics.js +3 -0
- package/dist/{diagnostics-DmuWc7d8.d.cts → diagnostics-B72W0P_E.d.cts} +3 -0
- package/dist/{diagnostics-DmuWc7d8.d.ts → diagnostics-B72W0P_E.d.ts} +3 -0
- package/dist/emit/emit.cjs +3 -1
- package/dist/emit/emit.js +4 -2
- package/dist/emit/inline.cjs +2 -3
- package/dist/emit/inline.d.cts +1 -1
- package/dist/emit/inline.d.ts +1 -1
- package/dist/emit/inline.js +2 -3
- package/dist/emit/table.d.cts +1 -1
- package/dist/emit/table.d.ts +1 -1
- package/dist/html/render.cjs +6 -0
- package/dist/html/render.d.cts +1 -1
- package/dist/html/render.d.ts +1 -1
- package/dist/html/render.js +6 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/inline/inline.cjs +16 -0
- package/dist/inline/inline.d.cts +1 -1
- package/dist/inline/inline.d.ts +1 -1
- package/dist/inline/inline.js +16 -0
- package/dist/inline/math.cjs +10 -0
- package/dist/inline/math.d.cts +4 -0
- package/dist/inline/math.d.ts +4 -0
- package/dist/inline/math.js +9 -0
- package/dist/inline/node.d.cts +1 -1
- package/dist/inline/node.d.ts +1 -1
- package/dist/{inline-B50cM6cn.d.ts → inline-TuBQ2TUr.d.ts} +1 -1
- package/dist/{inline-C9YEGDV5.d.cts → inline-uVHJ5xzT.d.cts} +1 -1
- package/dist/lower/front-matter.d.cts +1 -1
- package/dist/lower/front-matter.d.ts +1 -1
- package/dist/lower/inline.cjs +7 -0
- package/dist/lower/inline.d.cts +2 -2
- package/dist/lower/inline.d.ts +2 -2
- package/dist/lower/inline.js +8 -1
- package/dist/lower/lower.cjs +14 -0
- package/dist/lower/lower.js +15 -1
- package/dist/lower/table.d.cts +1 -1
- package/dist/lower/table.d.ts +1 -1
- package/dist/options/options.d.cts +1 -1
- package/dist/options/options.d.ts +1 -1
- package/dist/read.d.cts +1 -1
- package/dist/read.d.ts +1 -1
- package/dist/shared/style-constants.cjs +4 -0
- package/dist/shared/style-constants.d.cts +3 -1
- package/dist/shared/style-constants.d.ts +3 -1
- package/dist/shared/style-constants.js +3 -1
- package/package.json +1 -1
package/dist/emit/inline.js
CHANGED
|
@@ -10,8 +10,6 @@ const ESCAPE_CHARS = /* @__PURE__ */ new Set([
|
|
|
10
10
|
"%",
|
|
11
11
|
"&",
|
|
12
12
|
"'",
|
|
13
|
-
"(",
|
|
14
|
-
")",
|
|
15
13
|
"*",
|
|
16
14
|
"+",
|
|
17
15
|
",",
|
|
@@ -86,6 +84,7 @@ function renderLeaf(run, context) {
|
|
|
86
84
|
});
|
|
87
85
|
return renderCodeSpan(run.text);
|
|
88
86
|
}
|
|
87
|
+
if (run.fontFamily === "Cambria Math") return `\\(${run.text}\\)`;
|
|
89
88
|
return escapeMarkdownText(run.text);
|
|
90
89
|
}
|
|
91
90
|
const STYLE_KEYS = [
|
|
@@ -135,7 +134,7 @@ function renderNestedStyles(runs, depth, context) {
|
|
|
135
134
|
return out;
|
|
136
135
|
}
|
|
137
136
|
function isPlainAutolink(run) {
|
|
138
|
-
if (run.hyperlink === void 0 || run.hyperlink.length === 0 || run.bold === true || run.italic === true || run.strike === true || run.fontFamily === "Courier New") return false;
|
|
137
|
+
if (run.hyperlink === void 0 || run.hyperlink.length === 0 || run.bold === true || run.italic === true || run.strike === true || run.fontFamily === "Courier New" || run.fontFamily === "Cambria Math") return false;
|
|
139
138
|
return run.text === run.hyperlink || run.hyperlink === `mailto:${run.text}`;
|
|
140
139
|
}
|
|
141
140
|
function escapeLinkDestination(destination) {
|
package/dist/emit/table.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-B72W0P_E.cjs";
|
|
2
2
|
import { InlineEmitContext } from "./inline.cjs";
|
|
3
3
|
import { ContentTable } from "document-schema.js";
|
|
4
4
|
//#region src/emit/table.d.ts
|
package/dist/emit/table.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-B72W0P_E.js";
|
|
2
2
|
import { InlineEmitContext } from "./inline.js";
|
|
3
3
|
import { ContentTable } from "document-schema.js";
|
|
4
4
|
//#region src/emit/table.d.ts
|
package/dist/html/render.cjs
CHANGED
|
@@ -79,6 +79,7 @@ function renderInline(node) {
|
|
|
79
79
|
case "rawHtml": return node.literal;
|
|
80
80
|
case "hardBreak": return "<br />\n";
|
|
81
81
|
case "softBreak": return "\n";
|
|
82
|
+
case "mathInline": return `\\(${escapeHtml(node.literal)}\\)`;
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
function renderInlines(nodes) {
|
|
@@ -134,6 +135,11 @@ var HtmlRenderer = class {
|
|
|
134
135
|
case "table":
|
|
135
136
|
this.renderTable(node);
|
|
136
137
|
return;
|
|
138
|
+
case "mathBlock":
|
|
139
|
+
this.cr();
|
|
140
|
+
this.out += `$$\n${escapeHtml(node.literal)}\n$$\n`;
|
|
141
|
+
this.cr();
|
|
142
|
+
return;
|
|
137
143
|
case "document":
|
|
138
144
|
case "listItem":
|
|
139
145
|
case "tableRow":
|
package/dist/html/render.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as MarkdownInlineNode, s as MarkdownDocumentNode } from "../ast-
|
|
1
|
+
import { g as MarkdownInlineNode, s as MarkdownDocumentNode } from "../ast-DbjiuYr8.cjs";
|
|
2
2
|
//#region src/html/render.d.ts
|
|
3
3
|
declare function escapeHtml(text: string): string;
|
|
4
4
|
declare function escapeHref(href: string): string;
|
package/dist/html/render.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as MarkdownInlineNode, s as MarkdownDocumentNode } from "../ast-
|
|
1
|
+
import { g as MarkdownInlineNode, s as MarkdownDocumentNode } from "../ast-DbjiuYr8.js";
|
|
2
2
|
//#region src/html/render.d.ts
|
|
3
3
|
declare function escapeHtml(text: string): string;
|
|
4
4
|
declare function escapeHref(href: string): string;
|
package/dist/html/render.js
CHANGED
|
@@ -78,6 +78,7 @@ function renderInline(node) {
|
|
|
78
78
|
case "rawHtml": return node.literal;
|
|
79
79
|
case "hardBreak": return "<br />\n";
|
|
80
80
|
case "softBreak": return "\n";
|
|
81
|
+
case "mathInline": return `\\(${escapeHtml(node.literal)}\\)`;
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
function renderInlines(nodes) {
|
|
@@ -133,6 +134,11 @@ var HtmlRenderer = class {
|
|
|
133
134
|
case "table":
|
|
134
135
|
this.renderTable(node);
|
|
135
136
|
return;
|
|
137
|
+
case "mathBlock":
|
|
138
|
+
this.cr();
|
|
139
|
+
this.out += `$$\n${escapeHtml(node.literal)}\n$$\n`;
|
|
140
|
+
this.cr();
|
|
141
|
+
return;
|
|
136
142
|
case "document":
|
|
137
143
|
case "listItem":
|
|
138
144
|
case "tableRow":
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as MarkdownInputTooLargeError, c as MarkdownParseError, d as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownUnsupportedDocumentKindError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidUtf8Error, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownWriteError } from "./diagnostics-
|
|
1
|
+
import { a as MarkdownInputTooLargeError, c as MarkdownParseError, d as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownUnsupportedDocumentKindError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidUtf8Error, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownWriteError } from "./diagnostics-B72W0P_E.cjs";
|
|
2
2
|
import { MarkdownBytesSchema, markdownCodec } from "./codec.cjs";
|
|
3
3
|
import { n as MarkdownImageResolver, r as MarkdownResolvedImageBytes, t as MarkdownImageResolveContext } from "./image-C4KYmz_L.cjs";
|
|
4
4
|
import { MarkdownBulletListMarker, MarkdownCodeFenceChar, MarkdownEmphasisMarker, MarkdownHeadingStyle, MarkdownLineEnding, MarkdownOrderedListDelimiter, MarkdownThematicBreakChar, ReadMarkdownOptions, WriteMarkdownOptions, WriteMarkdownStyleOptions } from "./options/options.cjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as MarkdownInputTooLargeError, c as MarkdownParseError, d as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownUnsupportedDocumentKindError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidUtf8Error, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownWriteError } from "./diagnostics-
|
|
1
|
+
import { a as MarkdownInputTooLargeError, c as MarkdownParseError, d as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownUnsupportedDocumentKindError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidUtf8Error, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownWriteError } from "./diagnostics-B72W0P_E.js";
|
|
2
2
|
import { MarkdownBytesSchema, markdownCodec } from "./codec.js";
|
|
3
3
|
import { n as MarkdownImageResolver, r as MarkdownResolvedImageBytes, t as MarkdownImageResolveContext } from "./image-Cm3hT5PS.js";
|
|
4
4
|
import { MarkdownBulletListMarker, MarkdownCodeFenceChar, MarkdownEmphasisMarker, MarkdownHeadingStyle, MarkdownLineEnding, MarkdownOrderedListDelimiter, MarkdownThematicBreakChar, ReadMarkdownOptions, WriteMarkdownOptions, WriteMarkdownStyleOptions } from "./options/options.js";
|
package/dist/inline/inline.cjs
CHANGED
|
@@ -6,6 +6,7 @@ const require_inline_delimiter = require("./delimiter.cjs");
|
|
|
6
6
|
const require_inline_node = require("./node.cjs");
|
|
7
7
|
const require_inline_gfm_autolink = require("./gfm-autolink.cjs");
|
|
8
8
|
const require_inline_link = require("./link.cjs");
|
|
9
|
+
const require_inline_math = require("./math.cjs");
|
|
9
10
|
//#region src/inline/inline.ts
|
|
10
11
|
const PLAIN_TEXT_PATTERN = /[^\n`[\]\\!<&*_~]+/y;
|
|
11
12
|
const URI_AUTOLINK_PATTERN = /<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>]*>/y;
|
|
@@ -102,6 +103,7 @@ var InlineParser = class {
|
|
|
102
103
|
while (this.text.charAt(this.pos) === " ") this.pos += 1;
|
|
103
104
|
}
|
|
104
105
|
parseBackslash() {
|
|
106
|
+
const backslashIndex = this.pos;
|
|
105
107
|
this.pos += 1;
|
|
106
108
|
const next = this.text.charAt(this.pos);
|
|
107
109
|
if (next === "\n") {
|
|
@@ -109,6 +111,16 @@ var InlineParser = class {
|
|
|
109
111
|
this.container.appendChild(new require_inline_node.InlineNode("hardBreak"));
|
|
110
112
|
return;
|
|
111
113
|
}
|
|
114
|
+
if (next === "(") {
|
|
115
|
+
const span = require_inline_math.matchMathInlineSpan(this.text, backslashIndex);
|
|
116
|
+
if (span !== void 0) {
|
|
117
|
+
const node = new require_inline_node.InlineNode("mathInline");
|
|
118
|
+
node.literal = span.slice(2, span.length - 2);
|
|
119
|
+
this.container.appendChild(node);
|
|
120
|
+
this.pos = backslashIndex + span.length;
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
112
124
|
if (require_inline_chars.isAsciiPunctuation(next)) {
|
|
113
125
|
this.appendText(next);
|
|
114
126
|
this.pos += 1;
|
|
@@ -442,6 +454,10 @@ function toAstNode(node) {
|
|
|
442
454
|
raw: node.raw,
|
|
443
455
|
value: node.literal
|
|
444
456
|
};
|
|
457
|
+
case "mathInline": return {
|
|
458
|
+
type: "mathInline",
|
|
459
|
+
literal: node.literal
|
|
460
|
+
};
|
|
445
461
|
case "container": return;
|
|
446
462
|
}
|
|
447
463
|
}
|
package/dist/inline/inline.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as parseInlines, t as InlineParseOptions } from "../inline-
|
|
1
|
+
import { n as parseInlines, t as InlineParseOptions } from "../inline-uVHJ5xzT.cjs";
|
|
2
2
|
export { InlineParseOptions, parseInlines };
|
package/dist/inline/inline.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as parseInlines, t as InlineParseOptions } from "../inline-
|
|
1
|
+
import { n as parseInlines, t as InlineParseOptions } from "../inline-TuBQ2TUr.js";
|
|
2
2
|
export { InlineParseOptions, parseInlines };
|
package/dist/inline/inline.js
CHANGED
|
@@ -5,6 +5,7 @@ import { DelimiterStack, isDelimiterChar, processEmphasis, scanDelimiterRun } fr
|
|
|
5
5
|
import { InlineNode, createTextNode } from "./node.js";
|
|
6
6
|
import { applyGfmAutolinks } from "./gfm-autolink.js";
|
|
7
7
|
import { matchLinkLabel, normalizeLinkLabel, parseLinkDestination, parseLinkTitle, skipInlineWhitespace } from "./link.js";
|
|
8
|
+
import { matchMathInlineSpan } from "./math.js";
|
|
8
9
|
//#region src/inline/inline.ts
|
|
9
10
|
const PLAIN_TEXT_PATTERN = /[^\n`[\]\\!<&*_~]+/y;
|
|
10
11
|
const URI_AUTOLINK_PATTERN = /<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>]*>/y;
|
|
@@ -101,6 +102,7 @@ var InlineParser = class {
|
|
|
101
102
|
while (this.text.charAt(this.pos) === " ") this.pos += 1;
|
|
102
103
|
}
|
|
103
104
|
parseBackslash() {
|
|
105
|
+
const backslashIndex = this.pos;
|
|
104
106
|
this.pos += 1;
|
|
105
107
|
const next = this.text.charAt(this.pos);
|
|
106
108
|
if (next === "\n") {
|
|
@@ -108,6 +110,16 @@ var InlineParser = class {
|
|
|
108
110
|
this.container.appendChild(new InlineNode("hardBreak"));
|
|
109
111
|
return;
|
|
110
112
|
}
|
|
113
|
+
if (next === "(") {
|
|
114
|
+
const span = matchMathInlineSpan(this.text, backslashIndex);
|
|
115
|
+
if (span !== void 0) {
|
|
116
|
+
const node = new InlineNode("mathInline");
|
|
117
|
+
node.literal = span.slice(2, span.length - 2);
|
|
118
|
+
this.container.appendChild(node);
|
|
119
|
+
this.pos = backslashIndex + span.length;
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
111
123
|
if (isAsciiPunctuation(next)) {
|
|
112
124
|
this.appendText(next);
|
|
113
125
|
this.pos += 1;
|
|
@@ -441,6 +453,10 @@ function toAstNode(node) {
|
|
|
441
453
|
raw: node.raw,
|
|
442
454
|
value: node.literal
|
|
443
455
|
};
|
|
456
|
+
case "mathInline": return {
|
|
457
|
+
type: "mathInline",
|
|
458
|
+
literal: node.literal
|
|
459
|
+
};
|
|
444
460
|
case "container": return;
|
|
445
461
|
}
|
|
446
462
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/inline/math.ts
|
|
3
|
+
function matchMathInlineSpan(text, index) {
|
|
4
|
+
if (text.charAt(index) !== "\\" || text.charAt(index + 1) !== "(") return;
|
|
5
|
+
const closeIndex = text.indexOf("\\)", index + 2);
|
|
6
|
+
if (closeIndex === -1) return;
|
|
7
|
+
return text.slice(index, closeIndex + 2);
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.matchMathInlineSpan = matchMathInlineSpan;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/inline/math.ts
|
|
2
|
+
function matchMathInlineSpan(text, index) {
|
|
3
|
+
if (text.charAt(index) !== "\\" || text.charAt(index + 1) !== "(") return;
|
|
4
|
+
const closeIndex = text.indexOf("\\)", index + 2);
|
|
5
|
+
if (closeIndex === -1) return;
|
|
6
|
+
return text.slice(index, closeIndex + 2);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { matchMathInlineSpan };
|
package/dist/inline/node.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/inline/node.d.ts
|
|
2
|
-
type InlineNodeKind = 'text' | 'emphasis' | 'strong' | 'strikethrough' | 'codeSpan' | 'link' | 'image' | 'autolink' | 'hardBreak' | 'softBreak' | 'rawHtml' | 'entity' | 'container';
|
|
2
|
+
type InlineNodeKind = 'text' | 'emphasis' | 'strong' | 'strikethrough' | 'codeSpan' | 'link' | 'image' | 'autolink' | 'hardBreak' | 'softBreak' | 'rawHtml' | 'entity' | 'mathInline' | 'container';
|
|
3
3
|
declare class InlineNode {
|
|
4
4
|
readonly kind: InlineNodeKind;
|
|
5
5
|
literal: string;
|
package/dist/inline/node.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/inline/node.d.ts
|
|
2
|
-
type InlineNodeKind = 'text' | 'emphasis' | 'strong' | 'strikethrough' | 'codeSpan' | 'link' | 'image' | 'autolink' | 'hardBreak' | 'softBreak' | 'rawHtml' | 'entity' | 'container';
|
|
2
|
+
type InlineNodeKind = 'text' | 'emphasis' | 'strong' | 'strikethrough' | 'codeSpan' | 'link' | 'image' | 'autolink' | 'hardBreak' | 'softBreak' | 'rawHtml' | 'entity' | 'mathInline' | 'container';
|
|
3
3
|
declare class InlineNode {
|
|
4
4
|
readonly kind: InlineNodeKind;
|
|
5
5
|
literal: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-B72W0P_E.cjs";
|
|
2
2
|
import { LayoutMetadata } from "document-schema.js";
|
|
3
3
|
//#region src/lower/front-matter.d.ts
|
|
4
4
|
interface FrontMatterResult {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-B72W0P_E.js";
|
|
2
2
|
import { LayoutMetadata } from "document-schema.js";
|
|
3
3
|
//#region src/lower/front-matter.d.ts
|
|
4
4
|
interface FrontMatterResult {
|
package/dist/lower/inline.cjs
CHANGED
|
@@ -46,6 +46,13 @@ function lowerInlineNode(node, style, context) {
|
|
|
46
46
|
message: "inline raw HTML was preserved as literal text; it will not be rendered as HTML by any consumer of the resulting ContentDocument"
|
|
47
47
|
});
|
|
48
48
|
return node.literal.length === 0 ? [] : [buildRun(node.literal, style)];
|
|
49
|
+
case "mathInline":
|
|
50
|
+
context.sink({
|
|
51
|
+
code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.MATH_INLINE_PRESERVED_AS_TEXT,
|
|
52
|
+
severity: "info",
|
|
53
|
+
message: "inline math (\\( \\)) was preserved as literal raw LaTeX text; it is not parsed as LaTeX or converted to MathML by this package"
|
|
54
|
+
});
|
|
55
|
+
return [buildRun(node.literal, style, require_shared_style_constants.MATH_INLINE_FONT_MARKER)];
|
|
49
56
|
case "autolink": {
|
|
50
57
|
const destination = node.email ? `mailto:${node.destination}` : node.destination;
|
|
51
58
|
return [buildRun(node.destination, {
|
package/dist/lower/inline.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as MarkdownInlineNode } from "../ast-
|
|
2
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
1
|
+
import { g as MarkdownInlineNode } from "../ast-DbjiuYr8.cjs";
|
|
2
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-B72W0P_E.cjs";
|
|
3
3
|
import { ContentRun } from "document-schema.js";
|
|
4
4
|
//#region src/lower/inline.d.ts
|
|
5
5
|
interface InlineLowerContext {
|
package/dist/lower/inline.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as MarkdownInlineNode } from "../ast-
|
|
2
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
1
|
+
import { g as MarkdownInlineNode } from "../ast-DbjiuYr8.js";
|
|
2
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-B72W0P_E.js";
|
|
3
3
|
import { ContentRun } from "document-schema.js";
|
|
4
4
|
//#region src/lower/inline.d.ts
|
|
5
5
|
interface InlineLowerContext {
|
package/dist/lower/inline.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MarkdownDiagnosticCodes } from "../diagnostics/diagnostics.js";
|
|
2
|
-
import { MONOSPACE_FONT_FAMILY } from "../shared/style-constants.js";
|
|
2
|
+
import { MATH_INLINE_FONT_MARKER, MONOSPACE_FONT_FAMILY } from "../shared/style-constants.js";
|
|
3
3
|
//#region src/lower/inline.ts
|
|
4
4
|
function buildRun(text, style, fontFamily) {
|
|
5
5
|
return {
|
|
@@ -45,6 +45,13 @@ function lowerInlineNode(node, style, context) {
|
|
|
45
45
|
message: "inline raw HTML was preserved as literal text; it will not be rendered as HTML by any consumer of the resulting ContentDocument"
|
|
46
46
|
});
|
|
47
47
|
return node.literal.length === 0 ? [] : [buildRun(node.literal, style)];
|
|
48
|
+
case "mathInline":
|
|
49
|
+
context.sink({
|
|
50
|
+
code: MarkdownDiagnosticCodes.MATH_INLINE_PRESERVED_AS_TEXT,
|
|
51
|
+
severity: "info",
|
|
52
|
+
message: "inline math (\\( \\)) was preserved as literal raw LaTeX text; it is not parsed as LaTeX or converted to MathML by this package"
|
|
53
|
+
});
|
|
54
|
+
return [buildRun(node.literal, style, MATH_INLINE_FONT_MARKER)];
|
|
48
55
|
case "autolink": {
|
|
49
56
|
const destination = node.email ? `mailto:${node.destination}` : node.destination;
|
|
50
57
|
return [buildRun(node.destination, {
|
package/dist/lower/lower.cjs
CHANGED
|
@@ -132,6 +132,19 @@ function lowerHtmlBlock(node, context) {
|
|
|
132
132
|
styleId: require_shared_style_constants.HTML_PREFORMATTED_STYLE_ID
|
|
133
133
|
}, context)];
|
|
134
134
|
}
|
|
135
|
+
function lowerMathBlock(node, context) {
|
|
136
|
+
context.sink({
|
|
137
|
+
code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.MATH_BLOCK_PRESERVED_AS_TEXT,
|
|
138
|
+
severity: "info",
|
|
139
|
+
message: "block math ($$...$$) was preserved as literal raw LaTeX text (styleId \"MathBlock\"); it is not parsed as LaTeX or converted to MathML by this package"
|
|
140
|
+
});
|
|
141
|
+
const literal = node.literal.replace(/\n$/, "");
|
|
142
|
+
return [decorateParagraph({
|
|
143
|
+
kind: "paragraph",
|
|
144
|
+
runs: literal.length === 0 ? [] : [{ text: literal }],
|
|
145
|
+
styleId: require_shared_style_constants.MATH_BLOCK_STYLE_ID
|
|
146
|
+
}, context)];
|
|
147
|
+
}
|
|
135
148
|
function lowerBlockquote(node, context, contentWidthPt) {
|
|
136
149
|
if (context.quoteDepth >= 1) context.sink({
|
|
137
150
|
code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.BLOCKQUOTE_NESTED_DEPTH,
|
|
@@ -225,6 +238,7 @@ function lowerBlock(node, context, contentWidthPt) {
|
|
|
225
238
|
case "codeBlock": return lowerCodeBlock(node, context);
|
|
226
239
|
case "thematicBreak": return lowerThematicBreak(context);
|
|
227
240
|
case "htmlBlock": return lowerHtmlBlock(node, context);
|
|
241
|
+
case "mathBlock": return lowerMathBlock(node, context);
|
|
228
242
|
case "table":
|
|
229
243
|
if (context.list !== void 0) context.sink({
|
|
230
244
|
code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.LIST_ITEM_BLOCK_UNLISTED,
|
package/dist/lower/lower.js
CHANGED
|
@@ -2,7 +2,7 @@ import { DEFAULT_MARGINS } from "../defaults/defaults.js";
|
|
|
2
2
|
import { MarkdownDiagnosticCodes, MarkdownInputTooLargeError, NOOP_MARKDOWN_DIAGNOSTIC_SINK } from "../diagnostics/diagnostics.js";
|
|
3
3
|
import { parseMarkdown } from "../block/block.js";
|
|
4
4
|
import { createNumIdMintState, mintListNumId, mintedListType } from "../shared/list-id.js";
|
|
5
|
-
import { CODE_BLOCK_STYLE_ID, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, QUOTE_STYLE_ID, headingStyleId } from "../shared/style-constants.js";
|
|
5
|
+
import { CODE_BLOCK_STYLE_ID, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MATH_BLOCK_STYLE_ID, QUOTE_STYLE_ID, headingStyleId } from "../shared/style-constants.js";
|
|
6
6
|
import { extractFrontMatter } from "./front-matter.js";
|
|
7
7
|
import { resolveMarkdownImage } from "./image.js";
|
|
8
8
|
import { lowerCodeBlockRun, lowerInlineNodes } from "./inline.js";
|
|
@@ -131,6 +131,19 @@ function lowerHtmlBlock(node, context) {
|
|
|
131
131
|
styleId: HTML_PREFORMATTED_STYLE_ID
|
|
132
132
|
}, context)];
|
|
133
133
|
}
|
|
134
|
+
function lowerMathBlock(node, context) {
|
|
135
|
+
context.sink({
|
|
136
|
+
code: MarkdownDiagnosticCodes.MATH_BLOCK_PRESERVED_AS_TEXT,
|
|
137
|
+
severity: "info",
|
|
138
|
+
message: "block math ($$...$$) was preserved as literal raw LaTeX text (styleId \"MathBlock\"); it is not parsed as LaTeX or converted to MathML by this package"
|
|
139
|
+
});
|
|
140
|
+
const literal = node.literal.replace(/\n$/, "");
|
|
141
|
+
return [decorateParagraph({
|
|
142
|
+
kind: "paragraph",
|
|
143
|
+
runs: literal.length === 0 ? [] : [{ text: literal }],
|
|
144
|
+
styleId: MATH_BLOCK_STYLE_ID
|
|
145
|
+
}, context)];
|
|
146
|
+
}
|
|
134
147
|
function lowerBlockquote(node, context, contentWidthPt) {
|
|
135
148
|
if (context.quoteDepth >= 1) context.sink({
|
|
136
149
|
code: MarkdownDiagnosticCodes.BLOCKQUOTE_NESTED_DEPTH,
|
|
@@ -224,6 +237,7 @@ function lowerBlock(node, context, contentWidthPt) {
|
|
|
224
237
|
case "codeBlock": return lowerCodeBlock(node, context);
|
|
225
238
|
case "thematicBreak": return lowerThematicBreak(context);
|
|
226
239
|
case "htmlBlock": return lowerHtmlBlock(node, context);
|
|
240
|
+
case "mathBlock": return lowerMathBlock(node, context);
|
|
227
241
|
case "table":
|
|
228
242
|
if (context.list !== void 0) context.sink({
|
|
229
243
|
code: MarkdownDiagnosticCodes.LIST_ITEM_BLOCK_UNLISTED,
|
package/dist/lower/table.d.cts
CHANGED
package/dist/lower/table.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-B72W0P_E.cjs";
|
|
2
2
|
import { n as MarkdownImageResolver } from "../image-C4KYmz_L.cjs";
|
|
3
3
|
import { Margins, PageSize } from "document-schema.js";
|
|
4
4
|
//#region src/options/options.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-B72W0P_E.js";
|
|
2
2
|
import { n as MarkdownImageResolver } from "../image-Cm3hT5PS.js";
|
|
3
3
|
import { Margins, PageSize } from "document-schema.js";
|
|
4
4
|
//#region src/options/options.d.ts
|
package/dist/read.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as MarkdownDiagnostic } from "./diagnostics-
|
|
1
|
+
import { t as MarkdownDiagnostic } from "./diagnostics-B72W0P_E.cjs";
|
|
2
2
|
import { ReadMarkdownOptions } from "./options/options.cjs";
|
|
3
3
|
import { ContentDocument } from "document-schema.js";
|
|
4
4
|
//#region src/read.d.ts
|
package/dist/read.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as MarkdownDiagnostic } from "./diagnostics-
|
|
1
|
+
import { t as MarkdownDiagnostic } from "./diagnostics-B72W0P_E.js";
|
|
2
2
|
import { ReadMarkdownOptions } from "./options/options.js";
|
|
3
3
|
import { ContentDocument } from "document-schema.js";
|
|
4
4
|
//#region src/read.d.ts
|
|
@@ -16,7 +16,9 @@ const QUOTE_STYLE_ID = "Quote";
|
|
|
16
16
|
const CODE_BLOCK_STYLE_ID = "CodeBlock";
|
|
17
17
|
const HORIZONTAL_RULE_STYLE_ID = "HorizontalRule";
|
|
18
18
|
const HTML_PREFORMATTED_STYLE_ID = "HTMLPreformatted";
|
|
19
|
+
const MATH_BLOCK_STYLE_ID = "MathBlock";
|
|
19
20
|
const MONOSPACE_FONT_FAMILY = "Courier New";
|
|
21
|
+
const MATH_INLINE_FONT_MARKER = "Cambria Math";
|
|
20
22
|
const QUOTE_INDENT_PT = 36;
|
|
21
23
|
const TASK_CHECKBOX_UNCHECKED = "☐";
|
|
22
24
|
const TASK_CHECKBOX_CHECKED = "☒";
|
|
@@ -24,6 +26,8 @@ const TASK_CHECKBOX_CHECKED = "☒";
|
|
|
24
26
|
exports.CODE_BLOCK_STYLE_ID = CODE_BLOCK_STYLE_ID;
|
|
25
27
|
exports.HORIZONTAL_RULE_STYLE_ID = HORIZONTAL_RULE_STYLE_ID;
|
|
26
28
|
exports.HTML_PREFORMATTED_STYLE_ID = HTML_PREFORMATTED_STYLE_ID;
|
|
29
|
+
exports.MATH_BLOCK_STYLE_ID = MATH_BLOCK_STYLE_ID;
|
|
30
|
+
exports.MATH_INLINE_FONT_MARKER = MATH_INLINE_FONT_MARKER;
|
|
27
31
|
exports.MAX_HEADING_STYLE_LEVEL = MAX_HEADING_STYLE_LEVEL;
|
|
28
32
|
exports.MONOSPACE_FONT_FAMILY = MONOSPACE_FONT_FAMILY;
|
|
29
33
|
exports.QUOTE_INDENT_PT = QUOTE_INDENT_PT;
|
|
@@ -6,9 +6,11 @@ declare const QUOTE_STYLE_ID = "Quote";
|
|
|
6
6
|
declare const CODE_BLOCK_STYLE_ID = "CodeBlock";
|
|
7
7
|
declare const HORIZONTAL_RULE_STYLE_ID = "HorizontalRule";
|
|
8
8
|
declare const HTML_PREFORMATTED_STYLE_ID = "HTMLPreformatted";
|
|
9
|
+
declare const MATH_BLOCK_STYLE_ID = "MathBlock";
|
|
9
10
|
declare const MONOSPACE_FONT_FAMILY = "Courier New";
|
|
11
|
+
declare const MATH_INLINE_FONT_MARKER = "Cambria Math";
|
|
10
12
|
declare const QUOTE_INDENT_PT = 36;
|
|
11
13
|
declare const TASK_CHECKBOX_UNCHECKED = "☐";
|
|
12
14
|
declare const TASK_CHECKBOX_CHECKED = "☒";
|
|
13
15
|
//#endregion
|
|
14
|
-
export { CODE_BLOCK_STYLE_ID, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID, TASK_CHECKBOX_CHECKED, TASK_CHECKBOX_UNCHECKED, headingStyleId, parseHeadingStyleId };
|
|
16
|
+
export { CODE_BLOCK_STYLE_ID, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MATH_BLOCK_STYLE_ID, MATH_INLINE_FONT_MARKER, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID, TASK_CHECKBOX_CHECKED, TASK_CHECKBOX_UNCHECKED, headingStyleId, parseHeadingStyleId };
|
|
@@ -6,9 +6,11 @@ declare const QUOTE_STYLE_ID = "Quote";
|
|
|
6
6
|
declare const CODE_BLOCK_STYLE_ID = "CodeBlock";
|
|
7
7
|
declare const HORIZONTAL_RULE_STYLE_ID = "HorizontalRule";
|
|
8
8
|
declare const HTML_PREFORMATTED_STYLE_ID = "HTMLPreformatted";
|
|
9
|
+
declare const MATH_BLOCK_STYLE_ID = "MathBlock";
|
|
9
10
|
declare const MONOSPACE_FONT_FAMILY = "Courier New";
|
|
11
|
+
declare const MATH_INLINE_FONT_MARKER = "Cambria Math";
|
|
10
12
|
declare const QUOTE_INDENT_PT = 36;
|
|
11
13
|
declare const TASK_CHECKBOX_UNCHECKED = "☐";
|
|
12
14
|
declare const TASK_CHECKBOX_CHECKED = "☒";
|
|
13
15
|
//#endregion
|
|
14
|
-
export { CODE_BLOCK_STYLE_ID, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID, TASK_CHECKBOX_CHECKED, TASK_CHECKBOX_UNCHECKED, headingStyleId, parseHeadingStyleId };
|
|
16
|
+
export { CODE_BLOCK_STYLE_ID, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MATH_BLOCK_STYLE_ID, MATH_INLINE_FONT_MARKER, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID, TASK_CHECKBOX_CHECKED, TASK_CHECKBOX_UNCHECKED, headingStyleId, parseHeadingStyleId };
|
|
@@ -15,9 +15,11 @@ const QUOTE_STYLE_ID = "Quote";
|
|
|
15
15
|
const CODE_BLOCK_STYLE_ID = "CodeBlock";
|
|
16
16
|
const HORIZONTAL_RULE_STYLE_ID = "HorizontalRule";
|
|
17
17
|
const HTML_PREFORMATTED_STYLE_ID = "HTMLPreformatted";
|
|
18
|
+
const MATH_BLOCK_STYLE_ID = "MathBlock";
|
|
18
19
|
const MONOSPACE_FONT_FAMILY = "Courier New";
|
|
20
|
+
const MATH_INLINE_FONT_MARKER = "Cambria Math";
|
|
19
21
|
const QUOTE_INDENT_PT = 36;
|
|
20
22
|
const TASK_CHECKBOX_UNCHECKED = "☐";
|
|
21
23
|
const TASK_CHECKBOX_CHECKED = "☒";
|
|
22
24
|
//#endregion
|
|
23
|
-
export { CODE_BLOCK_STYLE_ID, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID, TASK_CHECKBOX_CHECKED, TASK_CHECKBOX_UNCHECKED, headingStyleId, parseHeadingStyleId };
|
|
25
|
+
export { CODE_BLOCK_STYLE_ID, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MATH_BLOCK_STYLE_ID, MATH_INLINE_FONT_MARKER, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID, TASK_CHECKBOX_CHECKED, TASK_CHECKBOX_UNCHECKED, headingStyleId, parseHeadingStyleId };
|