@sendbird/actionbook-core 0.10.11 → 0.10.12
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/index.d.ts +64 -1
- package/dist/index.js +474 -831
- package/dist/index.js.map +1 -1
- package/dist/ui/index.js +75 -832
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
package/dist/ui/index.js
CHANGED
|
@@ -1447,7 +1447,7 @@ function fromProseMirrorJSON(pmJSON) {
|
|
|
1447
1447
|
}
|
|
1448
1448
|
|
|
1449
1449
|
// src/markdown/serializer.ts
|
|
1450
|
-
import { defaultHandlers as
|
|
1450
|
+
import { defaultHandlers as defaultHandlers2, toMarkdown } from "mdast-util-to-markdown";
|
|
1451
1451
|
|
|
1452
1452
|
// node_modules/devlop/lib/default.js
|
|
1453
1453
|
function ok() {
|
|
@@ -1505,13 +1505,13 @@ function footnoteReferencePeek() {
|
|
|
1505
1505
|
function footnoteReference(node, _, state, info) {
|
|
1506
1506
|
const tracker = state.createTracker(info);
|
|
1507
1507
|
let value = tracker.move("[^");
|
|
1508
|
-
const
|
|
1508
|
+
const exit = state.enter("footnoteReference");
|
|
1509
1509
|
const subexit = state.enter("reference");
|
|
1510
1510
|
value += tracker.move(
|
|
1511
1511
|
state.safe(state.associationId(node), { after: "]", before: value })
|
|
1512
1512
|
);
|
|
1513
1513
|
subexit();
|
|
1514
|
-
|
|
1514
|
+
exit();
|
|
1515
1515
|
value += tracker.move("]");
|
|
1516
1516
|
return value;
|
|
1517
1517
|
}
|
|
@@ -1544,7 +1544,7 @@ function gfmFootnoteToMarkdown(options) {
|
|
|
1544
1544
|
function footnoteDefinition(node, _, state, info) {
|
|
1545
1545
|
const tracker = state.createTracker(info);
|
|
1546
1546
|
let value = tracker.move("[^");
|
|
1547
|
-
const
|
|
1547
|
+
const exit = state.enter("footnoteDefinition");
|
|
1548
1548
|
const subexit = state.enter("label");
|
|
1549
1549
|
value += tracker.move(
|
|
1550
1550
|
state.safe(state.associationId(node), { before: value, after: "]" })
|
|
@@ -1560,7 +1560,7 @@ function gfmFootnoteToMarkdown(options) {
|
|
|
1560
1560
|
)
|
|
1561
1561
|
);
|
|
1562
1562
|
}
|
|
1563
|
-
|
|
1563
|
+
exit();
|
|
1564
1564
|
return value;
|
|
1565
1565
|
}
|
|
1566
1566
|
}
|
|
@@ -1608,7 +1608,7 @@ function exitStrikethrough(token) {
|
|
|
1608
1608
|
}
|
|
1609
1609
|
function handleDelete(node, _, state, info) {
|
|
1610
1610
|
const tracker = state.createTracker(info);
|
|
1611
|
-
const
|
|
1611
|
+
const exit = state.enter("strikethrough");
|
|
1612
1612
|
let value = tracker.move("~~");
|
|
1613
1613
|
value += state.containerPhrasing(node, {
|
|
1614
1614
|
...tracker.current(),
|
|
@@ -1616,310 +1616,15 @@ function handleDelete(node, _, state, info) {
|
|
|
1616
1616
|
after: "~"
|
|
1617
1617
|
});
|
|
1618
1618
|
value += tracker.move("~~");
|
|
1619
|
-
|
|
1619
|
+
exit();
|
|
1620
1620
|
return value;
|
|
1621
1621
|
}
|
|
1622
1622
|
function peekDelete() {
|
|
1623
1623
|
return "~";
|
|
1624
1624
|
}
|
|
1625
1625
|
|
|
1626
|
-
// node_modules/markdown-table/index.js
|
|
1627
|
-
function defaultStringLength(value) {
|
|
1628
|
-
return value.length;
|
|
1629
|
-
}
|
|
1630
|
-
function markdownTable(table2, options) {
|
|
1631
|
-
const settings = options || {};
|
|
1632
|
-
const align = (settings.align || []).concat();
|
|
1633
|
-
const stringLength = settings.stringLength || defaultStringLength;
|
|
1634
|
-
const alignments = [];
|
|
1635
|
-
const cellMatrix = [];
|
|
1636
|
-
const sizeMatrix = [];
|
|
1637
|
-
const longestCellByColumn = [];
|
|
1638
|
-
let mostCellsPerRow = 0;
|
|
1639
|
-
let rowIndex = -1;
|
|
1640
|
-
while (++rowIndex < table2.length) {
|
|
1641
|
-
const row2 = [];
|
|
1642
|
-
const sizes2 = [];
|
|
1643
|
-
let columnIndex2 = -1;
|
|
1644
|
-
if (table2[rowIndex].length > mostCellsPerRow) {
|
|
1645
|
-
mostCellsPerRow = table2[rowIndex].length;
|
|
1646
|
-
}
|
|
1647
|
-
while (++columnIndex2 < table2[rowIndex].length) {
|
|
1648
|
-
const cell = serialize(table2[rowIndex][columnIndex2]);
|
|
1649
|
-
if (settings.alignDelimiters !== false) {
|
|
1650
|
-
const size = stringLength(cell);
|
|
1651
|
-
sizes2[columnIndex2] = size;
|
|
1652
|
-
if (longestCellByColumn[columnIndex2] === void 0 || size > longestCellByColumn[columnIndex2]) {
|
|
1653
|
-
longestCellByColumn[columnIndex2] = size;
|
|
1654
|
-
}
|
|
1655
|
-
}
|
|
1656
|
-
row2.push(cell);
|
|
1657
|
-
}
|
|
1658
|
-
cellMatrix[rowIndex] = row2;
|
|
1659
|
-
sizeMatrix[rowIndex] = sizes2;
|
|
1660
|
-
}
|
|
1661
|
-
let columnIndex = -1;
|
|
1662
|
-
if (typeof align === "object" && "length" in align) {
|
|
1663
|
-
while (++columnIndex < mostCellsPerRow) {
|
|
1664
|
-
alignments[columnIndex] = toAlignment(align[columnIndex]);
|
|
1665
|
-
}
|
|
1666
|
-
} else {
|
|
1667
|
-
const code3 = toAlignment(align);
|
|
1668
|
-
while (++columnIndex < mostCellsPerRow) {
|
|
1669
|
-
alignments[columnIndex] = code3;
|
|
1670
|
-
}
|
|
1671
|
-
}
|
|
1672
|
-
columnIndex = -1;
|
|
1673
|
-
const row = [];
|
|
1674
|
-
const sizes = [];
|
|
1675
|
-
while (++columnIndex < mostCellsPerRow) {
|
|
1676
|
-
const code3 = alignments[columnIndex];
|
|
1677
|
-
let before = "";
|
|
1678
|
-
let after = "";
|
|
1679
|
-
if (code3 === 99) {
|
|
1680
|
-
before = ":";
|
|
1681
|
-
after = ":";
|
|
1682
|
-
} else if (code3 === 108) {
|
|
1683
|
-
before = ":";
|
|
1684
|
-
} else if (code3 === 114) {
|
|
1685
|
-
after = ":";
|
|
1686
|
-
}
|
|
1687
|
-
let size = settings.alignDelimiters === false ? 1 : Math.max(
|
|
1688
|
-
1,
|
|
1689
|
-
longestCellByColumn[columnIndex] - before.length - after.length
|
|
1690
|
-
);
|
|
1691
|
-
const cell = before + "-".repeat(size) + after;
|
|
1692
|
-
if (settings.alignDelimiters !== false) {
|
|
1693
|
-
size = before.length + size + after.length;
|
|
1694
|
-
if (size > longestCellByColumn[columnIndex]) {
|
|
1695
|
-
longestCellByColumn[columnIndex] = size;
|
|
1696
|
-
}
|
|
1697
|
-
sizes[columnIndex] = size;
|
|
1698
|
-
}
|
|
1699
|
-
row[columnIndex] = cell;
|
|
1700
|
-
}
|
|
1701
|
-
cellMatrix.splice(1, 0, row);
|
|
1702
|
-
sizeMatrix.splice(1, 0, sizes);
|
|
1703
|
-
rowIndex = -1;
|
|
1704
|
-
const lines = [];
|
|
1705
|
-
while (++rowIndex < cellMatrix.length) {
|
|
1706
|
-
const row2 = cellMatrix[rowIndex];
|
|
1707
|
-
const sizes2 = sizeMatrix[rowIndex];
|
|
1708
|
-
columnIndex = -1;
|
|
1709
|
-
const line = [];
|
|
1710
|
-
while (++columnIndex < mostCellsPerRow) {
|
|
1711
|
-
const cell = row2[columnIndex] || "";
|
|
1712
|
-
let before = "";
|
|
1713
|
-
let after = "";
|
|
1714
|
-
if (settings.alignDelimiters !== false) {
|
|
1715
|
-
const size = longestCellByColumn[columnIndex] - (sizes2[columnIndex] || 0);
|
|
1716
|
-
const code3 = alignments[columnIndex];
|
|
1717
|
-
if (code3 === 114) {
|
|
1718
|
-
before = " ".repeat(size);
|
|
1719
|
-
} else if (code3 === 99) {
|
|
1720
|
-
if (size % 2) {
|
|
1721
|
-
before = " ".repeat(size / 2 + 0.5);
|
|
1722
|
-
after = " ".repeat(size / 2 - 0.5);
|
|
1723
|
-
} else {
|
|
1724
|
-
before = " ".repeat(size / 2);
|
|
1725
|
-
after = before;
|
|
1726
|
-
}
|
|
1727
|
-
} else {
|
|
1728
|
-
after = " ".repeat(size);
|
|
1729
|
-
}
|
|
1730
|
-
}
|
|
1731
|
-
if (settings.delimiterStart !== false && !columnIndex) {
|
|
1732
|
-
line.push("|");
|
|
1733
|
-
}
|
|
1734
|
-
if (settings.padding !== false && // Don’t add the opening space if we’re not aligning and the cell is
|
|
1735
|
-
// empty: there will be a closing space.
|
|
1736
|
-
!(settings.alignDelimiters === false && cell === "") && (settings.delimiterStart !== false || columnIndex)) {
|
|
1737
|
-
line.push(" ");
|
|
1738
|
-
}
|
|
1739
|
-
if (settings.alignDelimiters !== false) {
|
|
1740
|
-
line.push(before);
|
|
1741
|
-
}
|
|
1742
|
-
line.push(cell);
|
|
1743
|
-
if (settings.alignDelimiters !== false) {
|
|
1744
|
-
line.push(after);
|
|
1745
|
-
}
|
|
1746
|
-
if (settings.padding !== false) {
|
|
1747
|
-
line.push(" ");
|
|
1748
|
-
}
|
|
1749
|
-
if (settings.delimiterEnd !== false || columnIndex !== mostCellsPerRow - 1) {
|
|
1750
|
-
line.push("|");
|
|
1751
|
-
}
|
|
1752
|
-
}
|
|
1753
|
-
lines.push(
|
|
1754
|
-
settings.delimiterEnd === false ? line.join("").replace(/ +$/, "") : line.join("")
|
|
1755
|
-
);
|
|
1756
|
-
}
|
|
1757
|
-
return lines.join("\n");
|
|
1758
|
-
}
|
|
1759
|
-
function serialize(value) {
|
|
1760
|
-
return value === null || value === void 0 ? "" : String(value);
|
|
1761
|
-
}
|
|
1762
|
-
function toAlignment(value) {
|
|
1763
|
-
const code3 = typeof value === "string" ? value.codePointAt(0) : 0;
|
|
1764
|
-
return code3 === 67 || code3 === 99 ? 99 : code3 === 76 || code3 === 108 ? 108 : code3 === 82 || code3 === 114 ? 114 : 0;
|
|
1765
|
-
}
|
|
1766
|
-
|
|
1767
|
-
// node_modules/mdast-util-gfm-table/lib/index.js
|
|
1768
|
-
import { defaultHandlers } from "mdast-util-to-markdown";
|
|
1769
|
-
function gfmTableFromMarkdown() {
|
|
1770
|
-
return {
|
|
1771
|
-
enter: {
|
|
1772
|
-
table: enterTable,
|
|
1773
|
-
tableData: enterCell,
|
|
1774
|
-
tableHeader: enterCell,
|
|
1775
|
-
tableRow: enterRow
|
|
1776
|
-
},
|
|
1777
|
-
exit: {
|
|
1778
|
-
codeText: exitCodeText,
|
|
1779
|
-
table: exitTable,
|
|
1780
|
-
tableData: exit,
|
|
1781
|
-
tableHeader: exit,
|
|
1782
|
-
tableRow: exit
|
|
1783
|
-
}
|
|
1784
|
-
};
|
|
1785
|
-
}
|
|
1786
|
-
function enterTable(token) {
|
|
1787
|
-
const align = token._align;
|
|
1788
|
-
ok(align, "expected `_align` on table");
|
|
1789
|
-
this.enter(
|
|
1790
|
-
{
|
|
1791
|
-
type: "table",
|
|
1792
|
-
align: align.map(function(d) {
|
|
1793
|
-
return d === "none" ? null : d;
|
|
1794
|
-
}),
|
|
1795
|
-
children: []
|
|
1796
|
-
},
|
|
1797
|
-
token
|
|
1798
|
-
);
|
|
1799
|
-
this.data.inTable = true;
|
|
1800
|
-
}
|
|
1801
|
-
function exitTable(token) {
|
|
1802
|
-
this.exit(token);
|
|
1803
|
-
this.data.inTable = void 0;
|
|
1804
|
-
}
|
|
1805
|
-
function enterRow(token) {
|
|
1806
|
-
this.enter({ type: "tableRow", children: [] }, token);
|
|
1807
|
-
}
|
|
1808
|
-
function exit(token) {
|
|
1809
|
-
this.exit(token);
|
|
1810
|
-
}
|
|
1811
|
-
function enterCell(token) {
|
|
1812
|
-
this.enter({ type: "tableCell", children: [] }, token);
|
|
1813
|
-
}
|
|
1814
|
-
function exitCodeText(token) {
|
|
1815
|
-
let value = this.resume();
|
|
1816
|
-
if (this.data.inTable) {
|
|
1817
|
-
value = value.replace(/\\([\\|])/g, replace);
|
|
1818
|
-
}
|
|
1819
|
-
const node = this.stack[this.stack.length - 1];
|
|
1820
|
-
ok(node.type === "inlineCode");
|
|
1821
|
-
node.value = value;
|
|
1822
|
-
this.exit(token);
|
|
1823
|
-
}
|
|
1824
|
-
function replace($0, $1) {
|
|
1825
|
-
return $1 === "|" ? $1 : $0;
|
|
1826
|
-
}
|
|
1827
|
-
function gfmTableToMarkdown(options) {
|
|
1828
|
-
const settings = options || {};
|
|
1829
|
-
const padding = settings.tableCellPadding;
|
|
1830
|
-
const alignDelimiters = settings.tablePipeAlign;
|
|
1831
|
-
const stringLength = settings.stringLength;
|
|
1832
|
-
const around = padding ? " " : "|";
|
|
1833
|
-
return {
|
|
1834
|
-
unsafe: [
|
|
1835
|
-
{ character: "\r", inConstruct: "tableCell" },
|
|
1836
|
-
{ character: "\n", inConstruct: "tableCell" },
|
|
1837
|
-
// A pipe, when followed by a tab or space (padding), or a dash or colon
|
|
1838
|
-
// (unpadded delimiter row), could result in a table.
|
|
1839
|
-
{ atBreak: true, character: "|", after: "[ :-]" },
|
|
1840
|
-
// A pipe in a cell must be encoded.
|
|
1841
|
-
{ character: "|", inConstruct: "tableCell" },
|
|
1842
|
-
// A colon must be followed by a dash, in which case it could start a
|
|
1843
|
-
// delimiter row.
|
|
1844
|
-
{ atBreak: true, character: ":", after: "-" },
|
|
1845
|
-
// A delimiter row can also start with a dash, when followed by more
|
|
1846
|
-
// dashes, a colon, or a pipe.
|
|
1847
|
-
// This is a stricter version than the built in check for lists, thematic
|
|
1848
|
-
// breaks, and setex heading underlines though:
|
|
1849
|
-
// <https://github.com/syntax-tree/mdast-util-to-markdown/blob/51a2038/lib/unsafe.js#L57>
|
|
1850
|
-
{ atBreak: true, character: "-", after: "[:|-]" }
|
|
1851
|
-
],
|
|
1852
|
-
handlers: {
|
|
1853
|
-
inlineCode: inlineCodeWithTable,
|
|
1854
|
-
table: handleTable,
|
|
1855
|
-
tableCell: handleTableCell,
|
|
1856
|
-
tableRow: handleTableRow
|
|
1857
|
-
}
|
|
1858
|
-
};
|
|
1859
|
-
function handleTable(node, _, state, info) {
|
|
1860
|
-
return serializeData(handleTableAsData(node, state, info), node.align);
|
|
1861
|
-
}
|
|
1862
|
-
function handleTableRow(node, _, state, info) {
|
|
1863
|
-
const row = handleTableRowAsData(node, state, info);
|
|
1864
|
-
const value = serializeData([row]);
|
|
1865
|
-
return value.slice(0, value.indexOf("\n"));
|
|
1866
|
-
}
|
|
1867
|
-
function handleTableCell(node, _, state, info) {
|
|
1868
|
-
const exit2 = state.enter("tableCell");
|
|
1869
|
-
const subexit = state.enter("phrasing");
|
|
1870
|
-
const value = state.containerPhrasing(node, {
|
|
1871
|
-
...info,
|
|
1872
|
-
before: around,
|
|
1873
|
-
after: around
|
|
1874
|
-
});
|
|
1875
|
-
subexit();
|
|
1876
|
-
exit2();
|
|
1877
|
-
return value;
|
|
1878
|
-
}
|
|
1879
|
-
function serializeData(matrix, align) {
|
|
1880
|
-
return markdownTable(matrix, {
|
|
1881
|
-
align,
|
|
1882
|
-
// @ts-expect-error: `markdown-table` types should support `null`.
|
|
1883
|
-
alignDelimiters,
|
|
1884
|
-
// @ts-expect-error: `markdown-table` types should support `null`.
|
|
1885
|
-
padding,
|
|
1886
|
-
// @ts-expect-error: `markdown-table` types should support `null`.
|
|
1887
|
-
stringLength
|
|
1888
|
-
});
|
|
1889
|
-
}
|
|
1890
|
-
function handleTableAsData(node, state, info) {
|
|
1891
|
-
const children = node.children;
|
|
1892
|
-
let index = -1;
|
|
1893
|
-
const result = [];
|
|
1894
|
-
const subexit = state.enter("table");
|
|
1895
|
-
while (++index < children.length) {
|
|
1896
|
-
result[index] = handleTableRowAsData(children[index], state, info);
|
|
1897
|
-
}
|
|
1898
|
-
subexit();
|
|
1899
|
-
return result;
|
|
1900
|
-
}
|
|
1901
|
-
function handleTableRowAsData(node, state, info) {
|
|
1902
|
-
const children = node.children;
|
|
1903
|
-
let index = -1;
|
|
1904
|
-
const result = [];
|
|
1905
|
-
const subexit = state.enter("tableRow");
|
|
1906
|
-
while (++index < children.length) {
|
|
1907
|
-
result[index] = handleTableCell(children[index], node, state, info);
|
|
1908
|
-
}
|
|
1909
|
-
subexit();
|
|
1910
|
-
return result;
|
|
1911
|
-
}
|
|
1912
|
-
function inlineCodeWithTable(node, parent, state) {
|
|
1913
|
-
let value = defaultHandlers.inlineCode(node, parent, state);
|
|
1914
|
-
if (state.stack.includes("tableCell")) {
|
|
1915
|
-
value = value.replace(/\|/g, "\\$&");
|
|
1916
|
-
}
|
|
1917
|
-
return value;
|
|
1918
|
-
}
|
|
1919
|
-
}
|
|
1920
|
-
|
|
1921
1626
|
// node_modules/mdast-util-gfm-task-list-item/lib/index.js
|
|
1922
|
-
import { defaultHandlers
|
|
1627
|
+
import { defaultHandlers } from "mdast-util-to-markdown";
|
|
1923
1628
|
function gfmTaskListItemFromMarkdown() {
|
|
1924
1629
|
return {
|
|
1925
1630
|
exit: {
|
|
@@ -1979,7 +1684,7 @@ function listItemWithTaskListItem(node, parent, state, info) {
|
|
|
1979
1684
|
if (checkable) {
|
|
1980
1685
|
tracker.move(checkbox);
|
|
1981
1686
|
}
|
|
1982
|
-
let value =
|
|
1687
|
+
let value = defaultHandlers.listItem(node, parent, state, {
|
|
1983
1688
|
...info,
|
|
1984
1689
|
...tracker.current()
|
|
1985
1690
|
});
|
|
@@ -2186,18 +1891,22 @@ function convertBlock(node, depth = 0) {
|
|
|
2186
1891
|
}
|
|
2187
1892
|
case "table": {
|
|
2188
1893
|
const tbl = node;
|
|
2189
|
-
const
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
1894
|
+
const paragraphs = [];
|
|
1895
|
+
for (const row of tbl.children) {
|
|
1896
|
+
const inlines = [];
|
|
1897
|
+
for (let ci = 0; ci < row.children.length; ci++) {
|
|
1898
|
+
if (ci > 0 && inlines.length > 0) {
|
|
1899
|
+
inlines.push({ type: "text", text: " | " });
|
|
1900
|
+
}
|
|
1901
|
+
for (const child of row.children[ci].children) {
|
|
1902
|
+
inlines.push(...convertInline(child, [], depth + 1));
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
if (inlines.length > 0) {
|
|
1906
|
+
paragraphs.push({ type: "paragraph", content: inlines });
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
return paragraphs;
|
|
2201
1910
|
}
|
|
2202
1911
|
default:
|
|
2203
1912
|
if ("children" in node && Array.isArray(node.children)) {
|
|
@@ -2373,14 +2082,22 @@ function blockToMdast(node, depth = 0) {
|
|
|
2373
2082
|
return result;
|
|
2374
2083
|
}
|
|
2375
2084
|
case "table": {
|
|
2376
|
-
const
|
|
2377
|
-
|
|
2378
|
-
children
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2085
|
+
const result = [];
|
|
2086
|
+
for (const row of node.content) {
|
|
2087
|
+
const children = [];
|
|
2088
|
+
for (let ci = 0; ci < row.content.length; ci++) {
|
|
2089
|
+
if (ci > 0 && children.length > 0) {
|
|
2090
|
+
children.push({ type: "text", value: " | " });
|
|
2091
|
+
}
|
|
2092
|
+
for (const cell of row.content[ci].content) {
|
|
2093
|
+
children.push(...inlineToMdast(cell, depth + 1));
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
if (children.length > 0) {
|
|
2097
|
+
result.push({ type: "paragraph", children });
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
return result;
|
|
2384
2101
|
}
|
|
2385
2102
|
case "noteBlock":
|
|
2386
2103
|
return [];
|
|
@@ -2412,7 +2129,6 @@ var gfmNoAutolinkToMarkdown = () => ({
|
|
|
2412
2129
|
extensions: [
|
|
2413
2130
|
gfmFootnoteToMarkdown(),
|
|
2414
2131
|
gfmStrikethroughToMarkdown(),
|
|
2415
|
-
gfmTableToMarkdown(),
|
|
2416
2132
|
gfmTaskListItemToMarkdown()
|
|
2417
2133
|
]
|
|
2418
2134
|
});
|
|
@@ -2430,7 +2146,7 @@ function isJinjaTagParagraph(node) {
|
|
|
2430
2146
|
function textHandler(node, parent, state, info) {
|
|
2431
2147
|
const originalUnsafe = state.unsafe;
|
|
2432
2148
|
state.unsafe = originalUnsafe.filter((p) => !(p.character === "_" && !p.atBreak));
|
|
2433
|
-
const result =
|
|
2149
|
+
const result = defaultHandlers2.text(node, parent, state, info);
|
|
2434
2150
|
state.unsafe = originalUnsafe;
|
|
2435
2151
|
return result;
|
|
2436
2152
|
}
|
|
@@ -2448,11 +2164,11 @@ function listItemHandler(node, parent, state, info) {
|
|
|
2448
2164
|
const savedStart = list.start;
|
|
2449
2165
|
const idx = list.children.indexOf(node);
|
|
2450
2166
|
list.start = value - idx;
|
|
2451
|
-
const result =
|
|
2167
|
+
const result = defaultHandlers2.listItem(node, parent, state, info);
|
|
2452
2168
|
list.start = savedStart;
|
|
2453
2169
|
return result;
|
|
2454
2170
|
}
|
|
2455
|
-
return
|
|
2171
|
+
return defaultHandlers2.listItem(node, parent, state, info);
|
|
2456
2172
|
}
|
|
2457
2173
|
function serializeToMarkdown(doc2) {
|
|
2458
2174
|
const mdastTree = toMdast(doc2);
|
|
@@ -2479,9 +2195,9 @@ function serializeToMarkdown(doc2) {
|
|
|
2479
2195
|
link: linkHandler,
|
|
2480
2196
|
listItem: listItemHandler,
|
|
2481
2197
|
emphasis: ((node, _parent, state, info) => {
|
|
2482
|
-
const
|
|
2198
|
+
const exit = state.enter("emphasis");
|
|
2483
2199
|
const value = state.containerPhrasing(node, { ...info, before: "_", after: "_" });
|
|
2484
|
-
|
|
2200
|
+
exit();
|
|
2485
2201
|
return `__${value}__`;
|
|
2486
2202
|
}),
|
|
2487
2203
|
...resourceTagToMarkdown().handlers,
|
|
@@ -3354,7 +3070,7 @@ function createHistoryPlugin() {
|
|
|
3354
3070
|
}
|
|
3355
3071
|
|
|
3356
3072
|
// src/ui/plugin/keymapPlugin.ts
|
|
3357
|
-
import { baseKeymap, chainCommands, newlineInCode, createParagraphNear, liftEmptyBlock, splitBlock, toggleMark, setBlockType, joinBackward } from "prosemirror-commands";
|
|
3073
|
+
import { baseKeymap, chainCommands, deleteSelection, newlineInCode, createParagraphNear, liftEmptyBlock, splitBlock, toggleMark, setBlockType, joinBackward } from "prosemirror-commands";
|
|
3358
3074
|
import { AllSelection, Plugin as Plugin2, TextSelection as TextSelection2 } from "prosemirror-state";
|
|
3359
3075
|
import { keymap as keymap3 } from "prosemirror-keymap";
|
|
3360
3076
|
import { liftListItem, sinkListItem, splitListItem, wrapInList } from "prosemirror-schema-list";
|
|
@@ -3607,7 +3323,30 @@ var backspaceDeleteFirstEmptyParagraph = (state, dispatch) => {
|
|
|
3607
3323
|
}
|
|
3608
3324
|
return true;
|
|
3609
3325
|
};
|
|
3326
|
+
var deleteSelectionKeepPosition = (state, dispatch) => {
|
|
3327
|
+
if (state.selection.empty) return false;
|
|
3328
|
+
const { from, to } = state.selection;
|
|
3329
|
+
const $from = state.doc.resolve(from);
|
|
3330
|
+
const $to = state.doc.resolve(to);
|
|
3331
|
+
const fromBlockIdx = $from.index(0);
|
|
3332
|
+
const toBlockIdx = $to.index(0);
|
|
3333
|
+
const fromAtBlockStart = from === $from.start(0) + $from.posAtIndex(fromBlockIdx, 0) - $from.start(0);
|
|
3334
|
+
const toAtBlockEnd = to >= $to.posAtIndex(toBlockIdx, 0) + state.doc.child(toBlockIdx).nodeSize - ($to.start(0) - $from.start(0));
|
|
3335
|
+
if (!dispatch) return deleteSelection(state);
|
|
3336
|
+
const tr = state.tr;
|
|
3337
|
+
tr.deleteSelection();
|
|
3338
|
+
const pos = tr.selection.from;
|
|
3339
|
+
const $pos = tr.doc.resolve(pos);
|
|
3340
|
+
if ($pos.depth === 0 || $pos.parent.type.name !== "paragraph" && $pos.parent.type.name !== "heading" && $pos.parentOffset === 0) {
|
|
3341
|
+
const para = paragraph.create();
|
|
3342
|
+
tr.insert(pos, para);
|
|
3343
|
+
tr.setSelection(TextSelection2.near(tr.doc.resolve(pos + 1)));
|
|
3344
|
+
}
|
|
3345
|
+
dispatch(tr.scrollIntoView());
|
|
3346
|
+
return true;
|
|
3347
|
+
};
|
|
3610
3348
|
var backspaceCommand = chainCommands(
|
|
3349
|
+
deleteSelectionKeepPosition,
|
|
3611
3350
|
backspaceDeleteFirstEmptyParagraph,
|
|
3612
3351
|
backspaceDeleteEmptyBlock,
|
|
3613
3352
|
backspaceAfterList,
|
|
@@ -4377,503 +4116,8 @@ function gfmStrikethrough(options) {
|
|
|
4377
4116
|
}
|
|
4378
4117
|
}
|
|
4379
4118
|
|
|
4380
|
-
// node_modules/micromark-extension-gfm-table/lib/syntax.js
|
|
4381
|
-
import { markdownLineEnding as markdownLineEnding2, markdownLineEndingOrSpace as markdownLineEndingOrSpace3, markdownSpace as markdownSpace3 } from "micromark-util-character";
|
|
4382
|
-
|
|
4383
|
-
// node_modules/micromark-extension-gfm-table/lib/edit-map.js
|
|
4384
|
-
var EditMap = class {
|
|
4385
|
-
/**
|
|
4386
|
-
* Create a new edit map.
|
|
4387
|
-
*/
|
|
4388
|
-
constructor() {
|
|
4389
|
-
this.map = [];
|
|
4390
|
-
}
|
|
4391
|
-
/**
|
|
4392
|
-
* Create an edit: a remove and/or add at a certain place.
|
|
4393
|
-
*
|
|
4394
|
-
* @param {number} index
|
|
4395
|
-
* @param {number} remove
|
|
4396
|
-
* @param {Array<Event>} add
|
|
4397
|
-
* @returns {undefined}
|
|
4398
|
-
*/
|
|
4399
|
-
add(index, remove, add) {
|
|
4400
|
-
addImplementation(this, index, remove, add);
|
|
4401
|
-
}
|
|
4402
|
-
// To do: add this when moving to `micromark`.
|
|
4403
|
-
// /**
|
|
4404
|
-
// * Create an edit: but insert `add` before existing additions.
|
|
4405
|
-
// *
|
|
4406
|
-
// * @param {number} index
|
|
4407
|
-
// * @param {number} remove
|
|
4408
|
-
// * @param {Array<Event>} add
|
|
4409
|
-
// * @returns {undefined}
|
|
4410
|
-
// */
|
|
4411
|
-
// addBefore(index, remove, add) {
|
|
4412
|
-
// addImplementation(this, index, remove, add, true)
|
|
4413
|
-
// }
|
|
4414
|
-
/**
|
|
4415
|
-
* Done, change the events.
|
|
4416
|
-
*
|
|
4417
|
-
* @param {Array<Event>} events
|
|
4418
|
-
* @returns {undefined}
|
|
4419
|
-
*/
|
|
4420
|
-
consume(events) {
|
|
4421
|
-
this.map.sort(function(a, b) {
|
|
4422
|
-
return a[0] - b[0];
|
|
4423
|
-
});
|
|
4424
|
-
if (this.map.length === 0) {
|
|
4425
|
-
return;
|
|
4426
|
-
}
|
|
4427
|
-
let index = this.map.length;
|
|
4428
|
-
const vecs = [];
|
|
4429
|
-
while (index > 0) {
|
|
4430
|
-
index -= 1;
|
|
4431
|
-
vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]);
|
|
4432
|
-
events.length = this.map[index][0];
|
|
4433
|
-
}
|
|
4434
|
-
vecs.push(events.slice());
|
|
4435
|
-
events.length = 0;
|
|
4436
|
-
let slice = vecs.pop();
|
|
4437
|
-
while (slice) {
|
|
4438
|
-
for (const element of slice) {
|
|
4439
|
-
events.push(element);
|
|
4440
|
-
}
|
|
4441
|
-
slice = vecs.pop();
|
|
4442
|
-
}
|
|
4443
|
-
this.map.length = 0;
|
|
4444
|
-
}
|
|
4445
|
-
};
|
|
4446
|
-
function addImplementation(editMap, at, remove, add) {
|
|
4447
|
-
let index = 0;
|
|
4448
|
-
if (remove === 0 && add.length === 0) {
|
|
4449
|
-
return;
|
|
4450
|
-
}
|
|
4451
|
-
while (index < editMap.map.length) {
|
|
4452
|
-
if (editMap.map[index][0] === at) {
|
|
4453
|
-
editMap.map[index][1] += remove;
|
|
4454
|
-
editMap.map[index][2].push(...add);
|
|
4455
|
-
return;
|
|
4456
|
-
}
|
|
4457
|
-
index += 1;
|
|
4458
|
-
}
|
|
4459
|
-
editMap.map.push([at, remove, add]);
|
|
4460
|
-
}
|
|
4461
|
-
|
|
4462
|
-
// node_modules/micromark-extension-gfm-table/lib/infer.js
|
|
4463
|
-
function gfmTableAlign(events, index) {
|
|
4464
|
-
let inDelimiterRow = false;
|
|
4465
|
-
const align = [];
|
|
4466
|
-
while (index < events.length) {
|
|
4467
|
-
const event = events[index];
|
|
4468
|
-
if (inDelimiterRow) {
|
|
4469
|
-
if (event[0] === "enter") {
|
|
4470
|
-
if (event[1].type === "tableContent") {
|
|
4471
|
-
align.push(events[index + 1][1].type === "tableDelimiterMarker" ? "left" : "none");
|
|
4472
|
-
}
|
|
4473
|
-
} else if (event[1].type === "tableContent") {
|
|
4474
|
-
if (events[index - 1][1].type === "tableDelimiterMarker") {
|
|
4475
|
-
const alignIndex = align.length - 1;
|
|
4476
|
-
align[alignIndex] = align[alignIndex] === "left" ? "center" : "right";
|
|
4477
|
-
}
|
|
4478
|
-
} else if (event[1].type === "tableDelimiterRow") {
|
|
4479
|
-
break;
|
|
4480
|
-
}
|
|
4481
|
-
} else if (event[0] === "enter" && event[1].type === "tableDelimiterRow") {
|
|
4482
|
-
inDelimiterRow = true;
|
|
4483
|
-
}
|
|
4484
|
-
index += 1;
|
|
4485
|
-
}
|
|
4486
|
-
return align;
|
|
4487
|
-
}
|
|
4488
|
-
|
|
4489
|
-
// node_modules/micromark-extension-gfm-table/lib/syntax.js
|
|
4490
|
-
function gfmTable() {
|
|
4491
|
-
return {
|
|
4492
|
-
flow: {
|
|
4493
|
-
null: {
|
|
4494
|
-
name: "table",
|
|
4495
|
-
tokenize: tokenizeTable,
|
|
4496
|
-
resolveAll: resolveTable
|
|
4497
|
-
}
|
|
4498
|
-
}
|
|
4499
|
-
};
|
|
4500
|
-
}
|
|
4501
|
-
function tokenizeTable(effects, ok2, nok) {
|
|
4502
|
-
const self = this;
|
|
4503
|
-
let size = 0;
|
|
4504
|
-
let sizeB = 0;
|
|
4505
|
-
let seen;
|
|
4506
|
-
return start;
|
|
4507
|
-
function start(code3) {
|
|
4508
|
-
let index = self.events.length - 1;
|
|
4509
|
-
while (index > -1) {
|
|
4510
|
-
const type = self.events[index][1].type;
|
|
4511
|
-
if (type === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
|
|
4512
|
-
type === "linePrefix") index--;
|
|
4513
|
-
else break;
|
|
4514
|
-
}
|
|
4515
|
-
const tail = index > -1 ? self.events[index][1].type : null;
|
|
4516
|
-
const next = tail === "tableHead" || tail === "tableRow" ? bodyRowStart : headRowBefore;
|
|
4517
|
-
if (next === bodyRowStart && self.parser.lazy[self.now().line]) {
|
|
4518
|
-
return nok(code3);
|
|
4519
|
-
}
|
|
4520
|
-
return next(code3);
|
|
4521
|
-
}
|
|
4522
|
-
function headRowBefore(code3) {
|
|
4523
|
-
effects.enter("tableHead");
|
|
4524
|
-
effects.enter("tableRow");
|
|
4525
|
-
return headRowStart(code3);
|
|
4526
|
-
}
|
|
4527
|
-
function headRowStart(code3) {
|
|
4528
|
-
if (code3 === 124) {
|
|
4529
|
-
return headRowBreak(code3);
|
|
4530
|
-
}
|
|
4531
|
-
seen = true;
|
|
4532
|
-
sizeB += 1;
|
|
4533
|
-
return headRowBreak(code3);
|
|
4534
|
-
}
|
|
4535
|
-
function headRowBreak(code3) {
|
|
4536
|
-
if (code3 === null) {
|
|
4537
|
-
return nok(code3);
|
|
4538
|
-
}
|
|
4539
|
-
if (markdownLineEnding2(code3)) {
|
|
4540
|
-
if (sizeB > 1) {
|
|
4541
|
-
sizeB = 0;
|
|
4542
|
-
self.interrupt = true;
|
|
4543
|
-
effects.exit("tableRow");
|
|
4544
|
-
effects.enter("lineEnding");
|
|
4545
|
-
effects.consume(code3);
|
|
4546
|
-
effects.exit("lineEnding");
|
|
4547
|
-
return headDelimiterStart;
|
|
4548
|
-
}
|
|
4549
|
-
return nok(code3);
|
|
4550
|
-
}
|
|
4551
|
-
if (markdownSpace3(code3)) {
|
|
4552
|
-
return factorySpace(effects, headRowBreak, "whitespace")(code3);
|
|
4553
|
-
}
|
|
4554
|
-
sizeB += 1;
|
|
4555
|
-
if (seen) {
|
|
4556
|
-
seen = false;
|
|
4557
|
-
size += 1;
|
|
4558
|
-
}
|
|
4559
|
-
if (code3 === 124) {
|
|
4560
|
-
effects.enter("tableCellDivider");
|
|
4561
|
-
effects.consume(code3);
|
|
4562
|
-
effects.exit("tableCellDivider");
|
|
4563
|
-
seen = true;
|
|
4564
|
-
return headRowBreak;
|
|
4565
|
-
}
|
|
4566
|
-
effects.enter("data");
|
|
4567
|
-
return headRowData(code3);
|
|
4568
|
-
}
|
|
4569
|
-
function headRowData(code3) {
|
|
4570
|
-
if (code3 === null || code3 === 124 || markdownLineEndingOrSpace3(code3)) {
|
|
4571
|
-
effects.exit("data");
|
|
4572
|
-
return headRowBreak(code3);
|
|
4573
|
-
}
|
|
4574
|
-
effects.consume(code3);
|
|
4575
|
-
return code3 === 92 ? headRowEscape : headRowData;
|
|
4576
|
-
}
|
|
4577
|
-
function headRowEscape(code3) {
|
|
4578
|
-
if (code3 === 92 || code3 === 124) {
|
|
4579
|
-
effects.consume(code3);
|
|
4580
|
-
return headRowData;
|
|
4581
|
-
}
|
|
4582
|
-
return headRowData(code3);
|
|
4583
|
-
}
|
|
4584
|
-
function headDelimiterStart(code3) {
|
|
4585
|
-
self.interrupt = false;
|
|
4586
|
-
if (self.parser.lazy[self.now().line]) {
|
|
4587
|
-
return nok(code3);
|
|
4588
|
-
}
|
|
4589
|
-
effects.enter("tableDelimiterRow");
|
|
4590
|
-
seen = false;
|
|
4591
|
-
if (markdownSpace3(code3)) {
|
|
4592
|
-
return factorySpace(effects, headDelimiterBefore, "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code3);
|
|
4593
|
-
}
|
|
4594
|
-
return headDelimiterBefore(code3);
|
|
4595
|
-
}
|
|
4596
|
-
function headDelimiterBefore(code3) {
|
|
4597
|
-
if (code3 === 45 || code3 === 58) {
|
|
4598
|
-
return headDelimiterValueBefore(code3);
|
|
4599
|
-
}
|
|
4600
|
-
if (code3 === 124) {
|
|
4601
|
-
seen = true;
|
|
4602
|
-
effects.enter("tableCellDivider");
|
|
4603
|
-
effects.consume(code3);
|
|
4604
|
-
effects.exit("tableCellDivider");
|
|
4605
|
-
return headDelimiterCellBefore;
|
|
4606
|
-
}
|
|
4607
|
-
return headDelimiterNok(code3);
|
|
4608
|
-
}
|
|
4609
|
-
function headDelimiterCellBefore(code3) {
|
|
4610
|
-
if (markdownSpace3(code3)) {
|
|
4611
|
-
return factorySpace(effects, headDelimiterValueBefore, "whitespace")(code3);
|
|
4612
|
-
}
|
|
4613
|
-
return headDelimiterValueBefore(code3);
|
|
4614
|
-
}
|
|
4615
|
-
function headDelimiterValueBefore(code3) {
|
|
4616
|
-
if (code3 === 58) {
|
|
4617
|
-
sizeB += 1;
|
|
4618
|
-
seen = true;
|
|
4619
|
-
effects.enter("tableDelimiterMarker");
|
|
4620
|
-
effects.consume(code3);
|
|
4621
|
-
effects.exit("tableDelimiterMarker");
|
|
4622
|
-
return headDelimiterLeftAlignmentAfter;
|
|
4623
|
-
}
|
|
4624
|
-
if (code3 === 45) {
|
|
4625
|
-
sizeB += 1;
|
|
4626
|
-
return headDelimiterLeftAlignmentAfter(code3);
|
|
4627
|
-
}
|
|
4628
|
-
if (code3 === null || markdownLineEnding2(code3)) {
|
|
4629
|
-
return headDelimiterCellAfter(code3);
|
|
4630
|
-
}
|
|
4631
|
-
return headDelimiterNok(code3);
|
|
4632
|
-
}
|
|
4633
|
-
function headDelimiterLeftAlignmentAfter(code3) {
|
|
4634
|
-
if (code3 === 45) {
|
|
4635
|
-
effects.enter("tableDelimiterFiller");
|
|
4636
|
-
return headDelimiterFiller(code3);
|
|
4637
|
-
}
|
|
4638
|
-
return headDelimiterNok(code3);
|
|
4639
|
-
}
|
|
4640
|
-
function headDelimiterFiller(code3) {
|
|
4641
|
-
if (code3 === 45) {
|
|
4642
|
-
effects.consume(code3);
|
|
4643
|
-
return headDelimiterFiller;
|
|
4644
|
-
}
|
|
4645
|
-
if (code3 === 58) {
|
|
4646
|
-
seen = true;
|
|
4647
|
-
effects.exit("tableDelimiterFiller");
|
|
4648
|
-
effects.enter("tableDelimiterMarker");
|
|
4649
|
-
effects.consume(code3);
|
|
4650
|
-
effects.exit("tableDelimiterMarker");
|
|
4651
|
-
return headDelimiterRightAlignmentAfter;
|
|
4652
|
-
}
|
|
4653
|
-
effects.exit("tableDelimiterFiller");
|
|
4654
|
-
return headDelimiterRightAlignmentAfter(code3);
|
|
4655
|
-
}
|
|
4656
|
-
function headDelimiterRightAlignmentAfter(code3) {
|
|
4657
|
-
if (markdownSpace3(code3)) {
|
|
4658
|
-
return factorySpace(effects, headDelimiterCellAfter, "whitespace")(code3);
|
|
4659
|
-
}
|
|
4660
|
-
return headDelimiterCellAfter(code3);
|
|
4661
|
-
}
|
|
4662
|
-
function headDelimiterCellAfter(code3) {
|
|
4663
|
-
if (code3 === 124) {
|
|
4664
|
-
return headDelimiterBefore(code3);
|
|
4665
|
-
}
|
|
4666
|
-
if (code3 === null || markdownLineEnding2(code3)) {
|
|
4667
|
-
if (!seen || size !== sizeB) {
|
|
4668
|
-
return headDelimiterNok(code3);
|
|
4669
|
-
}
|
|
4670
|
-
effects.exit("tableDelimiterRow");
|
|
4671
|
-
effects.exit("tableHead");
|
|
4672
|
-
return ok2(code3);
|
|
4673
|
-
}
|
|
4674
|
-
return headDelimiterNok(code3);
|
|
4675
|
-
}
|
|
4676
|
-
function headDelimiterNok(code3) {
|
|
4677
|
-
return nok(code3);
|
|
4678
|
-
}
|
|
4679
|
-
function bodyRowStart(code3) {
|
|
4680
|
-
effects.enter("tableRow");
|
|
4681
|
-
return bodyRowBreak(code3);
|
|
4682
|
-
}
|
|
4683
|
-
function bodyRowBreak(code3) {
|
|
4684
|
-
if (code3 === 124) {
|
|
4685
|
-
effects.enter("tableCellDivider");
|
|
4686
|
-
effects.consume(code3);
|
|
4687
|
-
effects.exit("tableCellDivider");
|
|
4688
|
-
return bodyRowBreak;
|
|
4689
|
-
}
|
|
4690
|
-
if (code3 === null || markdownLineEnding2(code3)) {
|
|
4691
|
-
effects.exit("tableRow");
|
|
4692
|
-
return ok2(code3);
|
|
4693
|
-
}
|
|
4694
|
-
if (markdownSpace3(code3)) {
|
|
4695
|
-
return factorySpace(effects, bodyRowBreak, "whitespace")(code3);
|
|
4696
|
-
}
|
|
4697
|
-
effects.enter("data");
|
|
4698
|
-
return bodyRowData(code3);
|
|
4699
|
-
}
|
|
4700
|
-
function bodyRowData(code3) {
|
|
4701
|
-
if (code3 === null || code3 === 124 || markdownLineEndingOrSpace3(code3)) {
|
|
4702
|
-
effects.exit("data");
|
|
4703
|
-
return bodyRowBreak(code3);
|
|
4704
|
-
}
|
|
4705
|
-
effects.consume(code3);
|
|
4706
|
-
return code3 === 92 ? bodyRowEscape : bodyRowData;
|
|
4707
|
-
}
|
|
4708
|
-
function bodyRowEscape(code3) {
|
|
4709
|
-
if (code3 === 92 || code3 === 124) {
|
|
4710
|
-
effects.consume(code3);
|
|
4711
|
-
return bodyRowData;
|
|
4712
|
-
}
|
|
4713
|
-
return bodyRowData(code3);
|
|
4714
|
-
}
|
|
4715
|
-
}
|
|
4716
|
-
function resolveTable(events, context) {
|
|
4717
|
-
let index = -1;
|
|
4718
|
-
let inFirstCellAwaitingPipe = true;
|
|
4719
|
-
let rowKind = 0;
|
|
4720
|
-
let lastCell = [0, 0, 0, 0];
|
|
4721
|
-
let cell = [0, 0, 0, 0];
|
|
4722
|
-
let afterHeadAwaitingFirstBodyRow = false;
|
|
4723
|
-
let lastTableEnd = 0;
|
|
4724
|
-
let currentTable;
|
|
4725
|
-
let currentBody;
|
|
4726
|
-
let currentCell;
|
|
4727
|
-
const map2 = new EditMap();
|
|
4728
|
-
while (++index < events.length) {
|
|
4729
|
-
const event = events[index];
|
|
4730
|
-
const token = event[1];
|
|
4731
|
-
if (event[0] === "enter") {
|
|
4732
|
-
if (token.type === "tableHead") {
|
|
4733
|
-
afterHeadAwaitingFirstBodyRow = false;
|
|
4734
|
-
if (lastTableEnd !== 0) {
|
|
4735
|
-
flushTableEnd(map2, context, lastTableEnd, currentTable, currentBody);
|
|
4736
|
-
currentBody = void 0;
|
|
4737
|
-
lastTableEnd = 0;
|
|
4738
|
-
}
|
|
4739
|
-
currentTable = {
|
|
4740
|
-
type: "table",
|
|
4741
|
-
start: Object.assign({}, token.start),
|
|
4742
|
-
// Note: correct end is set later.
|
|
4743
|
-
end: Object.assign({}, token.end)
|
|
4744
|
-
};
|
|
4745
|
-
map2.add(index, 0, [["enter", currentTable, context]]);
|
|
4746
|
-
} else if (token.type === "tableRow" || token.type === "tableDelimiterRow") {
|
|
4747
|
-
inFirstCellAwaitingPipe = true;
|
|
4748
|
-
currentCell = void 0;
|
|
4749
|
-
lastCell = [0, 0, 0, 0];
|
|
4750
|
-
cell = [0, index + 1, 0, 0];
|
|
4751
|
-
if (afterHeadAwaitingFirstBodyRow) {
|
|
4752
|
-
afterHeadAwaitingFirstBodyRow = false;
|
|
4753
|
-
currentBody = {
|
|
4754
|
-
type: "tableBody",
|
|
4755
|
-
start: Object.assign({}, token.start),
|
|
4756
|
-
// Note: correct end is set later.
|
|
4757
|
-
end: Object.assign({}, token.end)
|
|
4758
|
-
};
|
|
4759
|
-
map2.add(index, 0, [["enter", currentBody, context]]);
|
|
4760
|
-
}
|
|
4761
|
-
rowKind = token.type === "tableDelimiterRow" ? 2 : currentBody ? 3 : 1;
|
|
4762
|
-
} else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) {
|
|
4763
|
-
inFirstCellAwaitingPipe = false;
|
|
4764
|
-
if (cell[2] === 0) {
|
|
4765
|
-
if (lastCell[1] !== 0) {
|
|
4766
|
-
cell[0] = cell[1];
|
|
4767
|
-
currentCell = flushCell(map2, context, lastCell, rowKind, void 0, currentCell);
|
|
4768
|
-
lastCell = [0, 0, 0, 0];
|
|
4769
|
-
}
|
|
4770
|
-
cell[2] = index;
|
|
4771
|
-
}
|
|
4772
|
-
} else if (token.type === "tableCellDivider") {
|
|
4773
|
-
if (inFirstCellAwaitingPipe) {
|
|
4774
|
-
inFirstCellAwaitingPipe = false;
|
|
4775
|
-
} else {
|
|
4776
|
-
if (lastCell[1] !== 0) {
|
|
4777
|
-
cell[0] = cell[1];
|
|
4778
|
-
currentCell = flushCell(map2, context, lastCell, rowKind, void 0, currentCell);
|
|
4779
|
-
}
|
|
4780
|
-
lastCell = cell;
|
|
4781
|
-
cell = [lastCell[1], index, 0, 0];
|
|
4782
|
-
}
|
|
4783
|
-
}
|
|
4784
|
-
} else if (token.type === "tableHead") {
|
|
4785
|
-
afterHeadAwaitingFirstBodyRow = true;
|
|
4786
|
-
lastTableEnd = index;
|
|
4787
|
-
} else if (token.type === "tableRow" || token.type === "tableDelimiterRow") {
|
|
4788
|
-
lastTableEnd = index;
|
|
4789
|
-
if (lastCell[1] !== 0) {
|
|
4790
|
-
cell[0] = cell[1];
|
|
4791
|
-
currentCell = flushCell(map2, context, lastCell, rowKind, index, currentCell);
|
|
4792
|
-
} else if (cell[1] !== 0) {
|
|
4793
|
-
currentCell = flushCell(map2, context, cell, rowKind, index, currentCell);
|
|
4794
|
-
}
|
|
4795
|
-
rowKind = 0;
|
|
4796
|
-
} else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) {
|
|
4797
|
-
cell[3] = index;
|
|
4798
|
-
}
|
|
4799
|
-
}
|
|
4800
|
-
if (lastTableEnd !== 0) {
|
|
4801
|
-
flushTableEnd(map2, context, lastTableEnd, currentTable, currentBody);
|
|
4802
|
-
}
|
|
4803
|
-
map2.consume(context.events);
|
|
4804
|
-
index = -1;
|
|
4805
|
-
while (++index < context.events.length) {
|
|
4806
|
-
const event = context.events[index];
|
|
4807
|
-
if (event[0] === "enter" && event[1].type === "table") {
|
|
4808
|
-
event[1]._align = gfmTableAlign(context.events, index);
|
|
4809
|
-
}
|
|
4810
|
-
}
|
|
4811
|
-
return events;
|
|
4812
|
-
}
|
|
4813
|
-
function flushCell(map2, context, range, rowKind, rowEnd, previousCell) {
|
|
4814
|
-
const groupName = rowKind === 1 ? "tableHeader" : rowKind === 2 ? "tableDelimiter" : "tableData";
|
|
4815
|
-
const valueName = "tableContent";
|
|
4816
|
-
if (range[0] !== 0) {
|
|
4817
|
-
previousCell.end = Object.assign({}, getPoint(context.events, range[0]));
|
|
4818
|
-
map2.add(range[0], 0, [["exit", previousCell, context]]);
|
|
4819
|
-
}
|
|
4820
|
-
const now = getPoint(context.events, range[1]);
|
|
4821
|
-
previousCell = {
|
|
4822
|
-
type: groupName,
|
|
4823
|
-
start: Object.assign({}, now),
|
|
4824
|
-
// Note: correct end is set later.
|
|
4825
|
-
end: Object.assign({}, now)
|
|
4826
|
-
};
|
|
4827
|
-
map2.add(range[1], 0, [["enter", previousCell, context]]);
|
|
4828
|
-
if (range[2] !== 0) {
|
|
4829
|
-
const relatedStart = getPoint(context.events, range[2]);
|
|
4830
|
-
const relatedEnd = getPoint(context.events, range[3]);
|
|
4831
|
-
const valueToken = {
|
|
4832
|
-
type: valueName,
|
|
4833
|
-
start: Object.assign({}, relatedStart),
|
|
4834
|
-
end: Object.assign({}, relatedEnd)
|
|
4835
|
-
};
|
|
4836
|
-
map2.add(range[2], 0, [["enter", valueToken, context]]);
|
|
4837
|
-
if (rowKind !== 2) {
|
|
4838
|
-
const start = context.events[range[2]];
|
|
4839
|
-
const end = context.events[range[3]];
|
|
4840
|
-
start[1].end = Object.assign({}, end[1].end);
|
|
4841
|
-
start[1].type = "chunkText";
|
|
4842
|
-
start[1].contentType = "text";
|
|
4843
|
-
if (range[3] > range[2] + 1) {
|
|
4844
|
-
const a = range[2] + 1;
|
|
4845
|
-
const b = range[3] - range[2] - 1;
|
|
4846
|
-
map2.add(a, b, []);
|
|
4847
|
-
}
|
|
4848
|
-
}
|
|
4849
|
-
map2.add(range[3] + 1, 0, [["exit", valueToken, context]]);
|
|
4850
|
-
}
|
|
4851
|
-
if (rowEnd !== void 0) {
|
|
4852
|
-
previousCell.end = Object.assign({}, getPoint(context.events, rowEnd));
|
|
4853
|
-
map2.add(rowEnd, 0, [["exit", previousCell, context]]);
|
|
4854
|
-
previousCell = void 0;
|
|
4855
|
-
}
|
|
4856
|
-
return previousCell;
|
|
4857
|
-
}
|
|
4858
|
-
function flushTableEnd(map2, context, index, table2, tableBody) {
|
|
4859
|
-
const exits = [];
|
|
4860
|
-
const related = getPoint(context.events, index);
|
|
4861
|
-
if (tableBody) {
|
|
4862
|
-
tableBody.end = Object.assign({}, related);
|
|
4863
|
-
exits.push(["exit", tableBody, context]);
|
|
4864
|
-
}
|
|
4865
|
-
table2.end = Object.assign({}, related);
|
|
4866
|
-
exits.push(["exit", table2, context]);
|
|
4867
|
-
map2.add(index + 1, 0, exits);
|
|
4868
|
-
}
|
|
4869
|
-
function getPoint(events, index) {
|
|
4870
|
-
const event = events[index];
|
|
4871
|
-
const side = event[0] === "enter" ? "start" : "end";
|
|
4872
|
-
return event[1][side];
|
|
4873
|
-
}
|
|
4874
|
-
|
|
4875
4119
|
// node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js
|
|
4876
|
-
import { markdownLineEnding as
|
|
4120
|
+
import { markdownLineEnding as markdownLineEnding2, markdownLineEndingOrSpace as markdownLineEndingOrSpace3, markdownSpace as markdownSpace3 } from "micromark-util-character";
|
|
4877
4121
|
var tasklistCheck = {
|
|
4878
4122
|
name: "tasklistCheck",
|
|
4879
4123
|
tokenize: tokenizeTasklistCheck
|
|
@@ -4904,7 +4148,7 @@ function tokenizeTasklistCheck(effects, ok2, nok) {
|
|
|
4904
4148
|
return inside;
|
|
4905
4149
|
}
|
|
4906
4150
|
function inside(code3) {
|
|
4907
|
-
if (
|
|
4151
|
+
if (markdownLineEndingOrSpace3(code3)) {
|
|
4908
4152
|
effects.enter("taskListCheckValueUnchecked");
|
|
4909
4153
|
effects.consume(code3);
|
|
4910
4154
|
effects.exit("taskListCheckValueUnchecked");
|
|
@@ -4929,10 +4173,10 @@ function tokenizeTasklistCheck(effects, ok2, nok) {
|
|
|
4929
4173
|
return nok(code3);
|
|
4930
4174
|
}
|
|
4931
4175
|
function after(code3) {
|
|
4932
|
-
if (
|
|
4176
|
+
if (markdownLineEnding2(code3)) {
|
|
4933
4177
|
return ok2(code3);
|
|
4934
4178
|
}
|
|
4935
|
-
if (
|
|
4179
|
+
if (markdownSpace3(code3)) {
|
|
4936
4180
|
return effects.check({
|
|
4937
4181
|
tokenize: spaceThenNonSpace
|
|
4938
4182
|
}, ok2, nok)(code3);
|
|
@@ -5286,11 +4530,10 @@ function jinjaBlockTransform(tree) {
|
|
|
5286
4530
|
}
|
|
5287
4531
|
|
|
5288
4532
|
// src/markdown/parser.ts
|
|
5289
|
-
var gfmNoAutolink = () => combineExtensions([gfmFootnote(), gfmStrikethrough(),
|
|
4533
|
+
var gfmNoAutolink = () => combineExtensions([gfmFootnote(), gfmStrikethrough(), gfmTaskListItem()]);
|
|
5290
4534
|
var gfmNoAutolinkFromMarkdown = () => [
|
|
5291
4535
|
gfmFootnoteFromMarkdown(),
|
|
5292
4536
|
gfmStrikethroughFromMarkdown(),
|
|
5293
|
-
gfmTableFromMarkdown(),
|
|
5294
4537
|
gfmTaskListItemFromMarkdown()
|
|
5295
4538
|
];
|
|
5296
4539
|
var MAX_DEPTH5 = 128;
|