@changerawr/markdown 1.0.2 → 1.0.3
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.mts +8 -233
- package/dist/index.d.ts +8 -233
- package/dist/index.js +35 -462
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -435
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -545,38 +545,6 @@ function sanitizeHtml(html) {
|
|
|
545
545
|
function basicSanitize(html) {
|
|
546
546
|
return html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/on\w+\s*=\s*"[^"]*"/gi, "").replace(/on\w+\s*=\s*'[^']*'/gi, "").replace(/javascript:/gi, "");
|
|
547
547
|
}
|
|
548
|
-
function isBrowser() {
|
|
549
|
-
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
550
|
-
}
|
|
551
|
-
function isNode() {
|
|
552
|
-
return typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
553
|
-
}
|
|
554
|
-
function debounce(func, wait) {
|
|
555
|
-
let timeout;
|
|
556
|
-
return function executedFunction(...args) {
|
|
557
|
-
const later = () => {
|
|
558
|
-
clearTimeout(timeout);
|
|
559
|
-
func(...args);
|
|
560
|
-
};
|
|
561
|
-
clearTimeout(timeout);
|
|
562
|
-
timeout = setTimeout(later, wait);
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
|
-
function deepMerge(target, source) {
|
|
566
|
-
const output = { ...target };
|
|
567
|
-
for (const key in source) {
|
|
568
|
-
if (source[key] && typeof source[key] === "object" && !Array.isArray(source[key])) {
|
|
569
|
-
if (key in target && typeof target[key] === "object" && !Array.isArray(target[key])) {
|
|
570
|
-
output[key] = deepMerge(target[key], source[key]);
|
|
571
|
-
} else {
|
|
572
|
-
output[key] = source[key];
|
|
573
|
-
}
|
|
574
|
-
} else {
|
|
575
|
-
output[key] = source[key];
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
return output;
|
|
579
|
-
}
|
|
580
548
|
function extractDomain(url) {
|
|
581
549
|
try {
|
|
582
550
|
return new URL(url).hostname;
|
|
@@ -584,14 +552,6 @@ function extractDomain(url) {
|
|
|
584
552
|
return url;
|
|
585
553
|
}
|
|
586
554
|
}
|
|
587
|
-
function isValidUrl(url) {
|
|
588
|
-
try {
|
|
589
|
-
new URL(url);
|
|
590
|
-
return true;
|
|
591
|
-
} catch {
|
|
592
|
-
return false;
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
555
|
function parseOptions(options) {
|
|
596
556
|
const parsed = {};
|
|
597
557
|
if (!options) return parsed;
|
|
@@ -1560,6 +1520,37 @@ function renderToHTMLUnsafe(markdown3) {
|
|
|
1560
1520
|
});
|
|
1561
1521
|
}
|
|
1562
1522
|
|
|
1523
|
+
// src/outputs/tailwind.ts
|
|
1524
|
+
function renderToTailwind(markdown3, config) {
|
|
1525
|
+
const engine = new ChangerawrMarkdown({
|
|
1526
|
+
...config,
|
|
1527
|
+
renderer: {
|
|
1528
|
+
format: "tailwind",
|
|
1529
|
+
sanitize: true,
|
|
1530
|
+
allowUnsafeHtml: false
|
|
1531
|
+
}
|
|
1532
|
+
});
|
|
1533
|
+
return engine.toHtml(markdown3);
|
|
1534
|
+
}
|
|
1535
|
+
function renderToTailwindWithClasses(markdown3, customClasses) {
|
|
1536
|
+
const engine = new ChangerawrMarkdown({
|
|
1537
|
+
renderer: {
|
|
1538
|
+
format: "tailwind",
|
|
1539
|
+
...customClasses && { customClasses }
|
|
1540
|
+
}
|
|
1541
|
+
});
|
|
1542
|
+
return engine.toHtml(markdown3);
|
|
1543
|
+
}
|
|
1544
|
+
function renderToTailwindWithConfig(markdown3, rendererConfig) {
|
|
1545
|
+
const engine = new ChangerawrMarkdown({
|
|
1546
|
+
renderer: {
|
|
1547
|
+
format: "tailwind",
|
|
1548
|
+
...rendererConfig
|
|
1549
|
+
}
|
|
1550
|
+
});
|
|
1551
|
+
return engine.toHtml(markdown3);
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1563
1554
|
// src/outputs/json.ts
|
|
1564
1555
|
function renderToJSON(markdown3, config) {
|
|
1565
1556
|
const engine = new ChangerawrMarkdown(config);
|
|
@@ -1641,305 +1632,9 @@ function tokensToAST(tokens) {
|
|
|
1641
1632
|
}
|
|
1642
1633
|
return ast;
|
|
1643
1634
|
}
|
|
1644
|
-
function astToTokens(ast) {
|
|
1645
|
-
const tokens = [];
|
|
1646
|
-
function processNode(node) {
|
|
1647
|
-
if (node.children && node.children.length > 0) {
|
|
1648
|
-
if (node.type === "list" || node.type === "task-list" || node.type === "blockquote-group") {
|
|
1649
|
-
node.children.forEach(processNode);
|
|
1650
|
-
return;
|
|
1651
|
-
}
|
|
1652
|
-
if (node.type === "paragraph") {
|
|
1653
|
-
node.children.forEach((child, index) => {
|
|
1654
|
-
const token2 = {
|
|
1655
|
-
type: child.type,
|
|
1656
|
-
content: child.content,
|
|
1657
|
-
raw: child.content,
|
|
1658
|
-
...child.attributes && { attributes: child.attributes }
|
|
1659
|
-
};
|
|
1660
|
-
tokens.push(token2);
|
|
1661
|
-
if (index < node.children.length - 1 && isInlineToken(child)) {
|
|
1662
|
-
tokens.push({
|
|
1663
|
-
type: "soft-break",
|
|
1664
|
-
content: " ",
|
|
1665
|
-
raw: " "
|
|
1666
|
-
});
|
|
1667
|
-
}
|
|
1668
|
-
});
|
|
1669
|
-
tokens.push({
|
|
1670
|
-
type: "paragraph-break",
|
|
1671
|
-
content: "",
|
|
1672
|
-
raw: "\n\n"
|
|
1673
|
-
});
|
|
1674
|
-
return;
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1677
|
-
const token = {
|
|
1678
|
-
type: node.type,
|
|
1679
|
-
content: node.content,
|
|
1680
|
-
raw: node.content,
|
|
1681
|
-
...node.attributes && { attributes: node.attributes }
|
|
1682
|
-
};
|
|
1683
|
-
tokens.push(token);
|
|
1684
|
-
}
|
|
1685
|
-
ast.forEach(processNode);
|
|
1686
|
-
return tokens;
|
|
1687
|
-
}
|
|
1688
|
-
function tokensToJSONString(tokens, pretty = true) {
|
|
1689
|
-
if (pretty) {
|
|
1690
|
-
return JSON.stringify(tokens, null, 2);
|
|
1691
|
-
}
|
|
1692
|
-
return JSON.stringify(tokens);
|
|
1693
|
-
}
|
|
1694
|
-
function astToJSONString(ast, pretty = true) {
|
|
1695
|
-
if (pretty) {
|
|
1696
|
-
return JSON.stringify(ast, null, 2);
|
|
1697
|
-
}
|
|
1698
|
-
return JSON.stringify(ast);
|
|
1699
|
-
}
|
|
1700
|
-
function parseTokensFromJSON(jsonString) {
|
|
1701
|
-
try {
|
|
1702
|
-
const parsed = JSON.parse(jsonString);
|
|
1703
|
-
if (!Array.isArray(parsed)) {
|
|
1704
|
-
throw new Error("JSON must be an array of tokens");
|
|
1705
|
-
}
|
|
1706
|
-
for (const token of parsed) {
|
|
1707
|
-
if (!token.type || typeof token.type !== "string") {
|
|
1708
|
-
throw new Error("Invalid token structure: missing or invalid type");
|
|
1709
|
-
}
|
|
1710
|
-
if (token.content === void 0 && token.raw === void 0) {
|
|
1711
|
-
throw new Error("Invalid token structure: missing content and raw");
|
|
1712
|
-
}
|
|
1713
|
-
}
|
|
1714
|
-
return parsed;
|
|
1715
|
-
} catch (error) {
|
|
1716
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
1717
|
-
throw new Error(`Failed to parse tokens from JSON: ${message}`);
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
function parseASTFromJSON(jsonString) {
|
|
1721
|
-
try {
|
|
1722
|
-
const parsed = JSON.parse(jsonString);
|
|
1723
|
-
if (!Array.isArray(parsed)) {
|
|
1724
|
-
throw new Error("JSON must be an array of AST nodes");
|
|
1725
|
-
}
|
|
1726
|
-
for (const node of parsed) {
|
|
1727
|
-
if (!node.type || typeof node.type !== "string") {
|
|
1728
|
-
throw new Error("Invalid AST node: missing or invalid type");
|
|
1729
|
-
}
|
|
1730
|
-
}
|
|
1731
|
-
return parsed;
|
|
1732
|
-
} catch (error) {
|
|
1733
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
1734
|
-
throw new Error(`Failed to parse AST from JSON: ${message}`);
|
|
1735
|
-
}
|
|
1736
|
-
}
|
|
1737
|
-
function getTokenStats(tokens) {
|
|
1738
|
-
const tokenTypes = {};
|
|
1739
|
-
const extensionTokens = {};
|
|
1740
|
-
let totalContent = 0;
|
|
1741
|
-
let totalRaw = 0;
|
|
1742
|
-
let tokensWithAttributes = 0;
|
|
1743
|
-
for (const token of tokens) {
|
|
1744
|
-
tokenTypes[token.type] = (tokenTypes[token.type] || 0) + 1;
|
|
1745
|
-
if (["alert", "button", "embed"].includes(token.type)) {
|
|
1746
|
-
extensionTokens[token.type] = (extensionTokens[token.type] || 0) + 1;
|
|
1747
|
-
}
|
|
1748
|
-
totalContent += (token.content || "").length;
|
|
1749
|
-
totalRaw += (token.raw || "").length;
|
|
1750
|
-
if (token.attributes && Object.keys(token.attributes).length > 0) {
|
|
1751
|
-
tokensWithAttributes++;
|
|
1752
|
-
}
|
|
1753
|
-
}
|
|
1754
|
-
const totalTokens = tokens.length;
|
|
1755
|
-
return {
|
|
1756
|
-
totalTokens,
|
|
1757
|
-
tokenTypes,
|
|
1758
|
-
extensionTokens,
|
|
1759
|
-
totalContent,
|
|
1760
|
-
totalRaw,
|
|
1761
|
-
tokensWithAttributes,
|
|
1762
|
-
averageContentLength: totalTokens > 0 ? Math.round(totalContent / totalTokens) : 0,
|
|
1763
|
-
averageRawLength: totalTokens > 0 ? Math.round(totalRaw / totalTokens) : 0,
|
|
1764
|
-
attributeUsageRate: totalTokens > 0 ? Math.round(tokensWithAttributes / totalTokens * 100) : 0
|
|
1765
|
-
};
|
|
1766
|
-
}
|
|
1767
|
-
function getASTStats(ast) {
|
|
1768
|
-
let totalNodes = 0;
|
|
1769
|
-
let maxDepth = 0;
|
|
1770
|
-
let nodesWithChildren = 0;
|
|
1771
|
-
let totalChildren = 0;
|
|
1772
|
-
const nodeTypes = {};
|
|
1773
|
-
function analyzeNode(node, depth = 0) {
|
|
1774
|
-
totalNodes++;
|
|
1775
|
-
maxDepth = Math.max(maxDepth, depth);
|
|
1776
|
-
nodeTypes[node.type] = (nodeTypes[node.type] || 0) + 1;
|
|
1777
|
-
if (node.children && node.children.length > 0) {
|
|
1778
|
-
nodesWithChildren++;
|
|
1779
|
-
totalChildren += node.children.length;
|
|
1780
|
-
node.children.forEach((child) => analyzeNode(child, depth + 1));
|
|
1781
|
-
}
|
|
1782
|
-
}
|
|
1783
|
-
ast.forEach((node) => analyzeNode(node));
|
|
1784
|
-
return {
|
|
1785
|
-
totalNodes,
|
|
1786
|
-
maxDepth,
|
|
1787
|
-
nodesWithChildren,
|
|
1788
|
-
totalChildren,
|
|
1789
|
-
nodeTypes,
|
|
1790
|
-
averageChildrenPerParent: nodesWithChildren > 0 ? Math.round(totalChildren / nodesWithChildren) : 0,
|
|
1791
|
-
hierarchyComplexity: maxDepth > 0 ? Math.round(totalChildren / totalNodes * maxDepth) : 0
|
|
1792
|
-
};
|
|
1793
|
-
}
|
|
1794
|
-
function compareTokens(tokensA, tokensB) {
|
|
1795
|
-
const differences = [];
|
|
1796
|
-
const maxLength = Math.max(tokensA.length, tokensB.length);
|
|
1797
|
-
for (let i = 0; i < maxLength; i++) {
|
|
1798
|
-
const tokenA = tokensA[i];
|
|
1799
|
-
const tokenB = tokensB[i];
|
|
1800
|
-
if (!tokenA && tokenB) {
|
|
1801
|
-
differences.push({
|
|
1802
|
-
index: i,
|
|
1803
|
-
type: "added",
|
|
1804
|
-
tokenB
|
|
1805
|
-
});
|
|
1806
|
-
} else if (tokenA && !tokenB) {
|
|
1807
|
-
differences.push({
|
|
1808
|
-
index: i,
|
|
1809
|
-
type: "removed",
|
|
1810
|
-
tokenA
|
|
1811
|
-
});
|
|
1812
|
-
} else if (tokenA && tokenB) {
|
|
1813
|
-
if (tokenA.type !== tokenB.type || tokenA.content !== tokenB.content) {
|
|
1814
|
-
differences.push({
|
|
1815
|
-
index: i,
|
|
1816
|
-
type: "modified",
|
|
1817
|
-
tokenA,
|
|
1818
|
-
tokenB
|
|
1819
|
-
});
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
}
|
|
1823
|
-
return {
|
|
1824
|
-
identical: differences.length === 0,
|
|
1825
|
-
differences,
|
|
1826
|
-
addedCount: differences.filter((d) => d.type === "added").length,
|
|
1827
|
-
removedCount: differences.filter((d) => d.type === "removed").length,
|
|
1828
|
-
modifiedCount: differences.filter((d) => d.type === "modified").length
|
|
1829
|
-
};
|
|
1830
|
-
}
|
|
1831
1635
|
function isParagraphContent(token) {
|
|
1832
1636
|
return ["text", "bold", "italic", "code", "link", "soft-break"].includes(token.type);
|
|
1833
1637
|
}
|
|
1834
|
-
function isInlineToken(node) {
|
|
1835
|
-
return ["bold", "italic", "code", "link"].includes(node.type);
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
// src/outputs/tailwind.ts
|
|
1839
|
-
function renderToTailwind(markdown3, config) {
|
|
1840
|
-
const engine = new ChangerawrMarkdown({
|
|
1841
|
-
...config,
|
|
1842
|
-
renderer: {
|
|
1843
|
-
format: "tailwind",
|
|
1844
|
-
sanitize: true,
|
|
1845
|
-
allowUnsafeHtml: false
|
|
1846
|
-
}
|
|
1847
|
-
});
|
|
1848
|
-
return engine.toHtml(markdown3);
|
|
1849
|
-
}
|
|
1850
|
-
function renderToTailwindWithClasses(markdown3, customClasses) {
|
|
1851
|
-
const engine = new ChangerawrMarkdown({
|
|
1852
|
-
renderer: {
|
|
1853
|
-
format: "tailwind",
|
|
1854
|
-
...customClasses && { customClasses }
|
|
1855
|
-
}
|
|
1856
|
-
});
|
|
1857
|
-
return engine.toHtml(markdown3);
|
|
1858
|
-
}
|
|
1859
|
-
function renderToTailwindWithConfig(markdown3, rendererConfig) {
|
|
1860
|
-
const engine = new ChangerawrMarkdown({
|
|
1861
|
-
renderer: {
|
|
1862
|
-
format: "tailwind",
|
|
1863
|
-
...rendererConfig
|
|
1864
|
-
}
|
|
1865
|
-
});
|
|
1866
|
-
return engine.toHtml(markdown3);
|
|
1867
|
-
}
|
|
1868
|
-
var defaultTailwindClasses = {
|
|
1869
|
-
// Typography
|
|
1870
|
-
"heading-1": "text-3xl font-bold mt-8 mb-4",
|
|
1871
|
-
"heading-2": "text-2xl font-semibold mt-6 mb-3",
|
|
1872
|
-
"heading-3": "text-xl font-medium mt-5 mb-3",
|
|
1873
|
-
"heading-4": "text-lg font-medium mt-4 mb-2",
|
|
1874
|
-
"heading-5": "text-base font-medium mt-3 mb-2",
|
|
1875
|
-
"heading-6": "text-sm font-medium mt-3 mb-2",
|
|
1876
|
-
"paragraph": "leading-7 mb-4",
|
|
1877
|
-
"blockquote": "pl-4 py-2 border-l-2 border-border italic text-muted-foreground my-4",
|
|
1878
|
-
// Code
|
|
1879
|
-
"code-inline": "bg-muted px-1.5 py-0.5 rounded text-sm font-mono",
|
|
1880
|
-
"code-block": "bg-muted p-4 rounded-md overflow-x-auto my-4",
|
|
1881
|
-
// Links and buttons
|
|
1882
|
-
"link": "text-primary hover:underline inline-flex items-center gap-1",
|
|
1883
|
-
"button": "inline-flex items-center justify-center font-medium rounded-lg transition-all duration-200",
|
|
1884
|
-
// Lists
|
|
1885
|
-
"list": "list-disc list-inside space-y-1",
|
|
1886
|
-
"list-item": "ml-4",
|
|
1887
|
-
// Images and media
|
|
1888
|
-
"image": "max-w-full h-auto rounded-lg my-4",
|
|
1889
|
-
"embed": "rounded-lg border bg-card text-card-foreground shadow-sm mb-6 overflow-hidden",
|
|
1890
|
-
// Alerts
|
|
1891
|
-
"alert": "border-l-4 p-4 mb-4 rounded-md transition-colors duration-200",
|
|
1892
|
-
"alert-info": "bg-blue-500/10 border-blue-500/30 text-blue-600 border-l-blue-500",
|
|
1893
|
-
"alert-warning": "bg-amber-500/10 border-amber-500/30 text-amber-600 border-l-amber-500",
|
|
1894
|
-
"alert-error": "bg-red-500/10 border-red-500/30 text-red-600 border-l-red-500",
|
|
1895
|
-
"alert-success": "bg-green-500/10 border-green-500/30 text-green-600 border-l-green-500"
|
|
1896
|
-
};
|
|
1897
|
-
var proseClasses = {
|
|
1898
|
-
"heading-1": "text-4xl font-bold tracking-tight mt-10 mb-6",
|
|
1899
|
-
"heading-2": "text-3xl font-semibold tracking-tight mt-8 mb-4",
|
|
1900
|
-
"heading-3": "text-2xl font-medium tracking-tight mt-6 mb-3",
|
|
1901
|
-
"paragraph": "text-lg leading-8 mb-6",
|
|
1902
|
-
"blockquote": "border-l-4 border-gray-300 pl-6 py-2 italic text-gray-700 my-6",
|
|
1903
|
-
"code-inline": "bg-gray-100 text-gray-800 px-2 py-1 rounded text-sm font-mono",
|
|
1904
|
-
"code-block": "bg-gray-900 text-gray-100 p-6 rounded-lg overflow-x-auto my-6 text-sm",
|
|
1905
|
-
"link": "text-blue-600 hover:text-blue-800 underline decoration-2 underline-offset-2"
|
|
1906
|
-
};
|
|
1907
|
-
var minimalClasses = {
|
|
1908
|
-
"heading-1": "text-2xl font-semibold mb-4",
|
|
1909
|
-
"heading-2": "text-xl font-medium mb-3",
|
|
1910
|
-
"heading-3": "text-lg font-medium mb-2",
|
|
1911
|
-
"paragraph": "mb-4",
|
|
1912
|
-
"blockquote": "border-l-2 border-gray-300 pl-4 italic mb-4",
|
|
1913
|
-
"code-inline": "bg-gray-100 px-1 rounded font-mono text-sm",
|
|
1914
|
-
"code-block": "bg-gray-100 p-3 rounded font-mono text-sm mb-4",
|
|
1915
|
-
"link": "text-blue-600 hover:underline"
|
|
1916
|
-
};
|
|
1917
|
-
|
|
1918
|
-
// src/standalone.ts
|
|
1919
|
-
function renderCum(markdown3, config) {
|
|
1920
|
-
const engine = new ChangerawrMarkdown(config);
|
|
1921
|
-
return engine.toHtml(markdown3);
|
|
1922
|
-
}
|
|
1923
|
-
function parseCum(markdown3, config) {
|
|
1924
|
-
const engine = new ChangerawrMarkdown(config);
|
|
1925
|
-
return engine.parse(markdown3);
|
|
1926
|
-
}
|
|
1927
|
-
function createCumEngine(config) {
|
|
1928
|
-
return new ChangerawrMarkdown(config);
|
|
1929
|
-
}
|
|
1930
|
-
function renderCumToHtml(markdown3) {
|
|
1931
|
-
return renderCum(markdown3, {
|
|
1932
|
-
renderer: { format: "html" }
|
|
1933
|
-
});
|
|
1934
|
-
}
|
|
1935
|
-
function renderCumToTailwind(markdown3) {
|
|
1936
|
-
return renderCum(markdown3, {
|
|
1937
|
-
renderer: { format: "tailwind" }
|
|
1938
|
-
});
|
|
1939
|
-
}
|
|
1940
|
-
function renderCumToJson(markdown3) {
|
|
1941
|
-
return parseCum(markdown3);
|
|
1942
|
-
}
|
|
1943
1638
|
|
|
1944
1639
|
// src/index.ts
|
|
1945
1640
|
function createEngine(config) {
|
|
@@ -1951,8 +1646,7 @@ function createHTMLEngine(config) {
|
|
|
1951
1646
|
renderer: {
|
|
1952
1647
|
format: "html",
|
|
1953
1648
|
sanitize: true,
|
|
1954
|
-
allowUnsafeHtml: false
|
|
1955
|
-
...config?.parser
|
|
1649
|
+
allowUnsafeHtml: false
|
|
1956
1650
|
}
|
|
1957
1651
|
});
|
|
1958
1652
|
}
|
|
@@ -1962,8 +1656,7 @@ function createTailwindEngine(config) {
|
|
|
1962
1656
|
renderer: {
|
|
1963
1657
|
format: "tailwind",
|
|
1964
1658
|
sanitize: true,
|
|
1965
|
-
allowUnsafeHtml: false
|
|
1966
|
-
...config?.parser
|
|
1659
|
+
allowUnsafeHtml: false
|
|
1967
1660
|
}
|
|
1968
1661
|
});
|
|
1969
1662
|
}
|
|
@@ -2021,9 +1714,6 @@ var markdown2 = {
|
|
|
2021
1714
|
createDebugEngine,
|
|
2022
1715
|
createMinimalEngine,
|
|
2023
1716
|
createCustomEngine,
|
|
2024
|
-
// Standalone functions
|
|
2025
|
-
renderCum,
|
|
2026
|
-
parseCum,
|
|
2027
1717
|
// Main class
|
|
2028
1718
|
ChangerawrMarkdown,
|
|
2029
1719
|
// Extensions
|
|
@@ -2044,71 +1734,6 @@ var markdown2 = {
|
|
|
2044
1734
|
}
|
|
2045
1735
|
};
|
|
2046
1736
|
var index_default = markdown2;
|
|
2047
|
-
var presets = {
|
|
2048
|
-
/**
|
|
2049
|
-
* Blog/article preset with prose-friendly styling
|
|
2050
|
-
*/
|
|
2051
|
-
blog: {
|
|
2052
|
-
renderer: {
|
|
2053
|
-
format: "tailwind",
|
|
2054
|
-
customClasses: {
|
|
2055
|
-
"heading-1": "text-4xl font-bold tracking-tight mt-10 mb-6",
|
|
2056
|
-
"heading-2": "text-3xl font-semibold tracking-tight mt-8 mb-4",
|
|
2057
|
-
"heading-3": "text-2xl font-medium tracking-tight mt-6 mb-3",
|
|
2058
|
-
"paragraph": "text-lg leading-8 mb-6",
|
|
2059
|
-
"blockquote": "border-l-4 border-gray-300 pl-6 py-2 italic text-gray-700 my-6",
|
|
2060
|
-
"code-inline": "bg-gray-100 text-gray-800 px-2 py-1 rounded text-sm font-mono",
|
|
2061
|
-
"code-block": "bg-gray-900 text-gray-100 p-6 rounded-lg overflow-x-auto my-6 text-sm"
|
|
2062
|
-
}
|
|
2063
|
-
}
|
|
2064
|
-
},
|
|
2065
|
-
/**
|
|
2066
|
-
* Documentation preset with clean, technical styling
|
|
2067
|
-
*/
|
|
2068
|
-
docs: {
|
|
2069
|
-
renderer: {
|
|
2070
|
-
format: "tailwind",
|
|
2071
|
-
customClasses: {
|
|
2072
|
-
"heading-1": "text-3xl font-bold border-b border-gray-200 pb-2 mb-6",
|
|
2073
|
-
"heading-2": "text-2xl font-semibold mt-8 mb-4",
|
|
2074
|
-
"heading-3": "text-xl font-medium mt-6 mb-3",
|
|
2075
|
-
"paragraph": "leading-7 mb-4",
|
|
2076
|
-
"code-inline": "bg-blue-50 text-blue-800 px-2 py-1 rounded text-sm font-mono",
|
|
2077
|
-
"code-block": "bg-gray-50 border border-gray-200 p-4 rounded-lg overflow-x-auto my-4 text-sm",
|
|
2078
|
-
"alert": "border border-blue-200 bg-blue-50 text-blue-800 p-4 rounded-lg mb-4"
|
|
2079
|
-
}
|
|
2080
|
-
}
|
|
2081
|
-
},
|
|
2082
|
-
/**
|
|
2083
|
-
* Minimal preset with basic styling
|
|
2084
|
-
*/
|
|
2085
|
-
minimal: {
|
|
2086
|
-
renderer: {
|
|
2087
|
-
format: "html",
|
|
2088
|
-
sanitize: true
|
|
2089
|
-
}
|
|
2090
|
-
},
|
|
2091
|
-
/**
|
|
2092
|
-
* Performance preset with minimal processing
|
|
2093
|
-
*/
|
|
2094
|
-
fast: {
|
|
2095
|
-
parser: {
|
|
2096
|
-
validateMarkdown: false,
|
|
2097
|
-
maxIterations: 1e3
|
|
2098
|
-
},
|
|
2099
|
-
renderer: {
|
|
2100
|
-
format: "html",
|
|
2101
|
-
sanitize: false
|
|
2102
|
-
}
|
|
2103
|
-
}
|
|
2104
|
-
};
|
|
2105
|
-
function createEngineWithPreset(presetName, additionalConfig) {
|
|
2106
|
-
const preset = presets[presetName];
|
|
2107
|
-
return new ChangerawrMarkdown({
|
|
2108
|
-
...preset,
|
|
2109
|
-
...additionalConfig
|
|
2110
|
-
});
|
|
2111
|
-
}
|
|
2112
1737
|
export {
|
|
2113
1738
|
AlertExtension,
|
|
2114
1739
|
ButtonExtension,
|
|
@@ -2118,43 +1743,19 @@ export {
|
|
|
2118
1743
|
MarkdownParser,
|
|
2119
1744
|
MarkdownRenderer,
|
|
2120
1745
|
PerformanceTimer,
|
|
2121
|
-
astToJSONString,
|
|
2122
|
-
astToTokens,
|
|
2123
|
-
basicSanitize,
|
|
2124
|
-
compareTokens,
|
|
2125
|
-
createCumEngine,
|
|
2126
1746
|
createCustomEngine,
|
|
2127
1747
|
createDebugEngine,
|
|
2128
1748
|
createEngine,
|
|
2129
|
-
createEngineWithPreset,
|
|
2130
1749
|
createHTMLEngine,
|
|
2131
1750
|
createMinimalEngine,
|
|
2132
1751
|
createTailwindEngine,
|
|
2133
|
-
debounce,
|
|
2134
|
-
deepMerge,
|
|
2135
1752
|
index_default as default,
|
|
2136
|
-
defaultTailwindClasses,
|
|
2137
1753
|
escapeHtml,
|
|
2138
1754
|
extractDomain,
|
|
2139
1755
|
generateId,
|
|
2140
|
-
getASTStats,
|
|
2141
|
-
getTokenStats,
|
|
2142
|
-
isBrowser,
|
|
2143
|
-
isNode,
|
|
2144
|
-
isValidUrl,
|
|
2145
1756
|
markdown2 as markdown,
|
|
2146
|
-
minimalClasses,
|
|
2147
|
-
parseASTFromJSON,
|
|
2148
|
-
parseCum,
|
|
2149
1757
|
parseMarkdown,
|
|
2150
1758
|
parseOptions,
|
|
2151
|
-
parseTokensFromJSON,
|
|
2152
|
-
presets,
|
|
2153
|
-
proseClasses,
|
|
2154
|
-
renderCum,
|
|
2155
|
-
renderCumToHtml,
|
|
2156
|
-
renderCumToJson,
|
|
2157
|
-
renderCumToTailwind,
|
|
2158
1759
|
renderMarkdown,
|
|
2159
1760
|
renderToAST,
|
|
2160
1761
|
renderToHTML,
|
|
@@ -2164,8 +1765,6 @@ export {
|
|
|
2164
1765
|
renderToTailwind,
|
|
2165
1766
|
renderToTailwindWithClasses,
|
|
2166
1767
|
renderToTailwindWithConfig,
|
|
2167
|
-
sanitizeHtml
|
|
2168
|
-
tokensToAST,
|
|
2169
|
-
tokensToJSONString
|
|
1768
|
+
sanitizeHtml
|
|
2170
1769
|
};
|
|
2171
1770
|
//# sourceMappingURL=index.mjs.map
|