mrkdwn.js 7.0.1 → 8.0.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/emit/html-table.cjs
CHANGED
|
@@ -92,12 +92,13 @@ function emitCellTag(cell, isHeader, context) {
|
|
|
92
92
|
return `<${tag}${attrs.length > 0 ? ` ${attrs.join(" ")}` : ""}>${emitCellHtml(cell, context)}</${tag}>`;
|
|
93
93
|
}
|
|
94
94
|
function emitHtmlTable(table, context) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
return [
|
|
96
|
+
"<table>",
|
|
97
|
+
...(0, document_schema_js.walkTableGrid)(table).map((positions, rowIndex) => {
|
|
98
|
+
return `<tr>${positions.flatMap((position) => position.anchorRowIndex === void 0 ? [emitCellTag(position.cell, rowIndex === 0, context)] : []).join("")}</tr>`;
|
|
99
|
+
}),
|
|
100
|
+
"</table>"
|
|
101
|
+
].join("\n");
|
|
101
102
|
}
|
|
102
103
|
//#endregion
|
|
103
104
|
exports.emitHtmlTable = emitHtmlTable;
|
package/dist/emit/html-table.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MarkdownDiagnosticCodes } from "../diagnostics/diagnostics.js";
|
|
2
2
|
import "../shared/style-constants.js";
|
|
3
|
-
import { colorToRgbHex } from "document-schema.js";
|
|
3
|
+
import { colorToRgbHex, walkTableGrid } from "document-schema.js";
|
|
4
4
|
//#region src/emit/html-table.ts
|
|
5
5
|
function escapeHtmlText(text) {
|
|
6
6
|
return text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
@@ -91,12 +91,13 @@ function emitCellTag(cell, isHeader, context) {
|
|
|
91
91
|
return `<${tag}${attrs.length > 0 ? ` ${attrs.join(" ")}` : ""}>${emitCellHtml(cell, context)}</${tag}>`;
|
|
92
92
|
}
|
|
93
93
|
function emitHtmlTable(table, context) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
return [
|
|
95
|
+
"<table>",
|
|
96
|
+
...walkTableGrid(table).map((positions, rowIndex) => {
|
|
97
|
+
return `<tr>${positions.flatMap((position) => position.anchorRowIndex === void 0 ? [emitCellTag(position.cell, rowIndex === 0, context)] : []).join("")}</tr>`;
|
|
98
|
+
}),
|
|
99
|
+
"</table>"
|
|
100
|
+
].join("\n");
|
|
100
101
|
}
|
|
101
102
|
//#endregion
|
|
102
103
|
export { emitHtmlTable, tableNeedsHtmlFallback };
|
package/dist/html/html-table.cjs
CHANGED
|
@@ -202,20 +202,20 @@ function buildCell(cell, contentWidthPt) {
|
|
|
202
202
|
...background === void 0 ? {} : { background }
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
|
+
const NO_DECLARED_COLUMN_COUNT = 0;
|
|
205
206
|
function parseTableRows(inner, contentWidthPt) {
|
|
206
207
|
const rowElements = extractTopLevelElements(inner, ["tr"]);
|
|
207
208
|
if (rowElements === void 0 || rowElements.length === 0) return;
|
|
208
|
-
const
|
|
209
|
+
const anchorRows = [];
|
|
209
210
|
for (const row of rowElements) {
|
|
210
211
|
const cellElements = extractTopLevelElements(row.inner, ["td", "th"]);
|
|
211
212
|
if (cellElements === void 0 || cellElements.length === 0) return;
|
|
212
|
-
|
|
213
|
+
anchorRows.push({ cells: cellElements.map((cell) => buildCell(cell, contentWidthPt)) });
|
|
213
214
|
}
|
|
214
|
-
return
|
|
215
|
+
return (0, document_schema_js.placeAnchorTableRows)(anchorRows, NO_DECLARED_COLUMN_COUNT);
|
|
215
216
|
}
|
|
216
217
|
function buildContentTable(rows, contentWidthPt) {
|
|
217
|
-
const
|
|
218
|
-
const columnCount = Math.max(1, header.cells.reduce((sum, cell) => sum + (cell.colSpan ?? 1), 0));
|
|
218
|
+
const columnCount = rows[0].cells.length;
|
|
219
219
|
return {
|
|
220
220
|
kind: "table",
|
|
221
221
|
rows,
|
package/dist/html/html-table.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveMarkdownImage } from "../lower/image.js";
|
|
2
2
|
import { MONOSPACE_FONT_FAMILY } from "../shared/style-constants.js";
|
|
3
|
-
import { rgbHexToColor } from "document-schema.js";
|
|
3
|
+
import { placeAnchorTableRows, rgbHexToColor } from "document-schema.js";
|
|
4
4
|
//#region src/html/html-table.ts
|
|
5
5
|
function findBalancedClose(text, openEnd, tagNames) {
|
|
6
6
|
const names = tagNames.join("|");
|
|
@@ -201,20 +201,20 @@ function buildCell(cell, contentWidthPt) {
|
|
|
201
201
|
...background === void 0 ? {} : { background }
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
|
+
const NO_DECLARED_COLUMN_COUNT = 0;
|
|
204
205
|
function parseTableRows(inner, contentWidthPt) {
|
|
205
206
|
const rowElements = extractTopLevelElements(inner, ["tr"]);
|
|
206
207
|
if (rowElements === void 0 || rowElements.length === 0) return;
|
|
207
|
-
const
|
|
208
|
+
const anchorRows = [];
|
|
208
209
|
for (const row of rowElements) {
|
|
209
210
|
const cellElements = extractTopLevelElements(row.inner, ["td", "th"]);
|
|
210
211
|
if (cellElements === void 0 || cellElements.length === 0) return;
|
|
211
|
-
|
|
212
|
+
anchorRows.push({ cells: cellElements.map((cell) => buildCell(cell, contentWidthPt)) });
|
|
212
213
|
}
|
|
213
|
-
return
|
|
214
|
+
return placeAnchorTableRows(anchorRows, NO_DECLARED_COLUMN_COUNT);
|
|
214
215
|
}
|
|
215
216
|
function buildContentTable(rows, contentWidthPt) {
|
|
216
|
-
const
|
|
217
|
-
const columnCount = Math.max(1, header.cells.reduce((sum, cell) => sum + (cell.colSpan ?? 1), 0));
|
|
217
|
+
const columnCount = rows[0].cells.length;
|
|
218
218
|
return {
|
|
219
219
|
kind: "table",
|
|
220
220
|
rows,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mrkdwn.js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Hand-written CommonMark+GFM <-> DocumentTree codec, built on document-schema.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"license": "MIT",
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"byte-codec": "1.6.3",
|
|
60
|
-
"document-schema.js": "7.
|
|
60
|
+
"document-schema.js": "7.12.0",
|
|
61
61
|
"zod": "4.4.3"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|