@changerawr/markdown 1.0.1 → 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 -481
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -454
- package/dist/index.mjs.map +1 -1
- package/dist/standalone.d.mts +3 -2
- package/dist/standalone.d.ts +3 -2
- package/dist/standalone.js +1 -8
- package/dist/standalone.js.map +1 -1
- package/dist/standalone.mjs +1 -8
- package/dist/standalone.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,324 +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
|
-
var globalAPI = {
|
|
1944
|
-
renderCum,
|
|
1945
|
-
parseCum,
|
|
1946
|
-
createCumEngine,
|
|
1947
|
-
renderCumToHtml,
|
|
1948
|
-
renderCumToTailwind,
|
|
1949
|
-
renderCumToJson,
|
|
1950
|
-
// Legacy aliases
|
|
1951
|
-
render: renderCum,
|
|
1952
|
-
parse: parseCum,
|
|
1953
|
-
// Include the main class
|
|
1954
|
-
ChangerawrMarkdown
|
|
1955
|
-
};
|
|
1956
|
-
if (typeof window !== "undefined") {
|
|
1957
|
-
window.ChangerawrMarkdown = globalAPI;
|
|
1958
|
-
}
|
|
1959
|
-
if (typeof globalThis !== "undefined") {
|
|
1960
|
-
globalThis.ChangerawrMarkdown = globalAPI;
|
|
1961
|
-
}
|
|
1962
1638
|
|
|
1963
1639
|
// src/index.ts
|
|
1964
1640
|
function createEngine(config) {
|
|
@@ -1970,8 +1646,7 @@ function createHTMLEngine(config) {
|
|
|
1970
1646
|
renderer: {
|
|
1971
1647
|
format: "html",
|
|
1972
1648
|
sanitize: true,
|
|
1973
|
-
allowUnsafeHtml: false
|
|
1974
|
-
...config?.parser
|
|
1649
|
+
allowUnsafeHtml: false
|
|
1975
1650
|
}
|
|
1976
1651
|
});
|
|
1977
1652
|
}
|
|
@@ -1981,8 +1656,7 @@ function createTailwindEngine(config) {
|
|
|
1981
1656
|
renderer: {
|
|
1982
1657
|
format: "tailwind",
|
|
1983
1658
|
sanitize: true,
|
|
1984
|
-
allowUnsafeHtml: false
|
|
1985
|
-
...config?.parser
|
|
1659
|
+
allowUnsafeHtml: false
|
|
1986
1660
|
}
|
|
1987
1661
|
});
|
|
1988
1662
|
}
|
|
@@ -2040,9 +1714,6 @@ var markdown2 = {
|
|
|
2040
1714
|
createDebugEngine,
|
|
2041
1715
|
createMinimalEngine,
|
|
2042
1716
|
createCustomEngine,
|
|
2043
|
-
// Standalone functions
|
|
2044
|
-
renderCum,
|
|
2045
|
-
parseCum,
|
|
2046
1717
|
// Main class
|
|
2047
1718
|
ChangerawrMarkdown,
|
|
2048
1719
|
// Extensions
|
|
@@ -2063,71 +1734,6 @@ var markdown2 = {
|
|
|
2063
1734
|
}
|
|
2064
1735
|
};
|
|
2065
1736
|
var index_default = markdown2;
|
|
2066
|
-
var presets = {
|
|
2067
|
-
/**
|
|
2068
|
-
* Blog/article preset with prose-friendly styling
|
|
2069
|
-
*/
|
|
2070
|
-
blog: {
|
|
2071
|
-
renderer: {
|
|
2072
|
-
format: "tailwind",
|
|
2073
|
-
customClasses: {
|
|
2074
|
-
"heading-1": "text-4xl font-bold tracking-tight mt-10 mb-6",
|
|
2075
|
-
"heading-2": "text-3xl font-semibold tracking-tight mt-8 mb-4",
|
|
2076
|
-
"heading-3": "text-2xl font-medium tracking-tight mt-6 mb-3",
|
|
2077
|
-
"paragraph": "text-lg leading-8 mb-6",
|
|
2078
|
-
"blockquote": "border-l-4 border-gray-300 pl-6 py-2 italic text-gray-700 my-6",
|
|
2079
|
-
"code-inline": "bg-gray-100 text-gray-800 px-2 py-1 rounded text-sm font-mono",
|
|
2080
|
-
"code-block": "bg-gray-900 text-gray-100 p-6 rounded-lg overflow-x-auto my-6 text-sm"
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2083
|
-
},
|
|
2084
|
-
/**
|
|
2085
|
-
* Documentation preset with clean, technical styling
|
|
2086
|
-
*/
|
|
2087
|
-
docs: {
|
|
2088
|
-
renderer: {
|
|
2089
|
-
format: "tailwind",
|
|
2090
|
-
customClasses: {
|
|
2091
|
-
"heading-1": "text-3xl font-bold border-b border-gray-200 pb-2 mb-6",
|
|
2092
|
-
"heading-2": "text-2xl font-semibold mt-8 mb-4",
|
|
2093
|
-
"heading-3": "text-xl font-medium mt-6 mb-3",
|
|
2094
|
-
"paragraph": "leading-7 mb-4",
|
|
2095
|
-
"code-inline": "bg-blue-50 text-blue-800 px-2 py-1 rounded text-sm font-mono",
|
|
2096
|
-
"code-block": "bg-gray-50 border border-gray-200 p-4 rounded-lg overflow-x-auto my-4 text-sm",
|
|
2097
|
-
"alert": "border border-blue-200 bg-blue-50 text-blue-800 p-4 rounded-lg mb-4"
|
|
2098
|
-
}
|
|
2099
|
-
}
|
|
2100
|
-
},
|
|
2101
|
-
/**
|
|
2102
|
-
* Minimal preset with basic styling
|
|
2103
|
-
*/
|
|
2104
|
-
minimal: {
|
|
2105
|
-
renderer: {
|
|
2106
|
-
format: "html",
|
|
2107
|
-
sanitize: true
|
|
2108
|
-
}
|
|
2109
|
-
},
|
|
2110
|
-
/**
|
|
2111
|
-
* Performance preset with minimal processing
|
|
2112
|
-
*/
|
|
2113
|
-
fast: {
|
|
2114
|
-
parser: {
|
|
2115
|
-
validateMarkdown: false,
|
|
2116
|
-
maxIterations: 1e3
|
|
2117
|
-
},
|
|
2118
|
-
renderer: {
|
|
2119
|
-
format: "html",
|
|
2120
|
-
sanitize: false
|
|
2121
|
-
}
|
|
2122
|
-
}
|
|
2123
|
-
};
|
|
2124
|
-
function createEngineWithPreset(presetName, additionalConfig) {
|
|
2125
|
-
const preset = presets[presetName];
|
|
2126
|
-
return new ChangerawrMarkdown({
|
|
2127
|
-
...preset,
|
|
2128
|
-
...additionalConfig
|
|
2129
|
-
});
|
|
2130
|
-
}
|
|
2131
1737
|
export {
|
|
2132
1738
|
AlertExtension,
|
|
2133
1739
|
ButtonExtension,
|
|
@@ -2137,43 +1743,19 @@ export {
|
|
|
2137
1743
|
MarkdownParser,
|
|
2138
1744
|
MarkdownRenderer,
|
|
2139
1745
|
PerformanceTimer,
|
|
2140
|
-
astToJSONString,
|
|
2141
|
-
astToTokens,
|
|
2142
|
-
basicSanitize,
|
|
2143
|
-
compareTokens,
|
|
2144
|
-
createCumEngine,
|
|
2145
1746
|
createCustomEngine,
|
|
2146
1747
|
createDebugEngine,
|
|
2147
1748
|
createEngine,
|
|
2148
|
-
createEngineWithPreset,
|
|
2149
1749
|
createHTMLEngine,
|
|
2150
1750
|
createMinimalEngine,
|
|
2151
1751
|
createTailwindEngine,
|
|
2152
|
-
debounce,
|
|
2153
|
-
deepMerge,
|
|
2154
1752
|
index_default as default,
|
|
2155
|
-
defaultTailwindClasses,
|
|
2156
1753
|
escapeHtml,
|
|
2157
1754
|
extractDomain,
|
|
2158
1755
|
generateId,
|
|
2159
|
-
getASTStats,
|
|
2160
|
-
getTokenStats,
|
|
2161
|
-
isBrowser,
|
|
2162
|
-
isNode,
|
|
2163
|
-
isValidUrl,
|
|
2164
1756
|
markdown2 as markdown,
|
|
2165
|
-
minimalClasses,
|
|
2166
|
-
parseASTFromJSON,
|
|
2167
|
-
parseCum,
|
|
2168
1757
|
parseMarkdown,
|
|
2169
1758
|
parseOptions,
|
|
2170
|
-
parseTokensFromJSON,
|
|
2171
|
-
presets,
|
|
2172
|
-
proseClasses,
|
|
2173
|
-
renderCum,
|
|
2174
|
-
renderCumToHtml,
|
|
2175
|
-
renderCumToJson,
|
|
2176
|
-
renderCumToTailwind,
|
|
2177
1759
|
renderMarkdown,
|
|
2178
1760
|
renderToAST,
|
|
2179
1761
|
renderToHTML,
|
|
@@ -2183,8 +1765,6 @@ export {
|
|
|
2183
1765
|
renderToTailwind,
|
|
2184
1766
|
renderToTailwindWithClasses,
|
|
2185
1767
|
renderToTailwindWithConfig,
|
|
2186
|
-
sanitizeHtml
|
|
2187
|
-
tokensToAST,
|
|
2188
|
-
tokensToJSONString
|
|
1768
|
+
sanitizeHtml
|
|
2189
1769
|
};
|
|
2190
1770
|
//# sourceMappingURL=index.mjs.map
|