@changerawr/markdown 1.1.4 → 1.1.6
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/README.md +94 -9
- package/dist/css/index.css +3 -123
- package/dist/index.d.mts +130 -3
- package/dist/index.d.ts +130 -3
- package/dist/index.js +321 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +318 -31
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +56 -2
- package/dist/react/index.d.ts +56 -2
- package/dist/react/index.js +297 -30
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +297 -30
- package/dist/react/index.mjs.map +1 -1
- package/dist/standalone.browser.js +323 -33
- package/dist/standalone.d.mts +56 -2
- package/dist/standalone.d.ts +56 -2
- package/dist/standalone.js +297 -30
- package/dist/standalone.js.map +1 -1
- package/dist/standalone.mjs +297 -30
- package/dist/standalone.mjs.map +1 -1
- package/dist/tailwind/index.d.mts +4 -35
- package/dist/tailwind/index.d.ts +4 -35
- package/dist/tailwind/index.js +120 -185
- package/dist/tailwind/index.js.map +1 -1
- package/dist/tailwind/index.mjs +119 -183
- package/dist/tailwind/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/tailwind/index.mjs
CHANGED
|
@@ -1,192 +1,128 @@
|
|
|
1
1
|
// src/tailwind/plugin.ts
|
|
2
2
|
import plugin from "tailwindcss/plugin";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const alertColors = ["blue", "amber", "red", "green", "purple", "gray"];
|
|
104
|
-
alertColors.forEach((color) => {
|
|
105
|
-
safelist.push(
|
|
106
|
-
`bg-${color}-500/10`,
|
|
107
|
-
`border-${color}-500/30`,
|
|
108
|
-
`text-${color}-600`,
|
|
109
|
-
`border-l-${color}-500`
|
|
110
|
-
);
|
|
111
|
-
});
|
|
112
|
-
const buttonColors = ["slate", "blue", "gray", "green", "red"];
|
|
113
|
-
const buttonShades = ["400", "500", "600", "700"];
|
|
114
|
-
buttonColors.forEach((color) => {
|
|
115
|
-
buttonShades.forEach((shade) => {
|
|
116
|
-
safelist.push(
|
|
117
|
-
`bg-${color}-${shade}`,
|
|
118
|
-
`border-${color}-${shade}`,
|
|
119
|
-
`text-${color}-${shade}`,
|
|
120
|
-
`hover:bg-${color}-${shade}`,
|
|
121
|
-
`hover:border-${color}-${shade}`,
|
|
122
|
-
`hover:text-${color}-${shade}`,
|
|
123
|
-
`focus:ring-${color}-${shade}`
|
|
124
|
-
);
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
safelist.push(
|
|
128
|
-
"text-white",
|
|
129
|
-
"text-gray-700",
|
|
130
|
-
"text-gray-900",
|
|
131
|
-
"bg-blue-50",
|
|
132
|
-
"bg-gray-100",
|
|
133
|
-
"hover:bg-blue-50",
|
|
134
|
-
"hover:bg-gray-100",
|
|
135
|
-
"hover:text-gray-900"
|
|
136
|
-
);
|
|
137
|
-
safelist.push(
|
|
138
|
-
"before:absolute",
|
|
139
|
-
"before:inset-0",
|
|
140
|
-
"before:rounded-lg",
|
|
141
|
-
"before:bg-gradient-to-br",
|
|
142
|
-
"before:from-white/20",
|
|
143
|
-
"before:to-transparent",
|
|
144
|
-
"before:opacity-0",
|
|
145
|
-
"hover:before:opacity-100",
|
|
146
|
-
"before:transition-opacity",
|
|
147
|
-
"before:duration-200"
|
|
148
|
-
);
|
|
149
|
-
safelist.push(
|
|
150
|
-
// Transform scales
|
|
151
|
-
{ pattern: /^(hover:)?scale-\[1\.02\]$/ },
|
|
152
|
-
{ pattern: /^(active:)?scale-\[0\.98\]$/ },
|
|
153
|
-
// Complex box shadows with arbitrary values
|
|
154
|
-
{ pattern: /^shadow-\[.*\]$/ },
|
|
155
|
-
{ pattern: /^hover:shadow-\[.*\]$/ },
|
|
156
|
-
{ pattern: /^active:shadow-\[.*\]$/ }
|
|
157
|
-
);
|
|
158
|
-
safelist.push(
|
|
159
|
-
"disabled:opacity-50",
|
|
160
|
-
"disabled:cursor-not-allowed",
|
|
161
|
-
"disabled:pointer-events-none"
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
if (darkMode) {
|
|
165
|
-
safelist.push(
|
|
166
|
-
"dark:text-blue-400",
|
|
167
|
-
"dark:text-amber-400",
|
|
168
|
-
"dark:text-red-400",
|
|
169
|
-
"dark:text-green-400",
|
|
170
|
-
"dark:text-purple-400",
|
|
171
|
-
"dark:text-gray-400",
|
|
172
|
-
"dark:bg-gray-800",
|
|
173
|
-
"dark:text-gray-100"
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
return safelist;
|
|
177
|
-
}
|
|
3
|
+
var CORE_CLASSES = [
|
|
4
|
+
// Typography
|
|
5
|
+
"text-3xl",
|
|
6
|
+
"text-2xl",
|
|
7
|
+
"text-xl",
|
|
8
|
+
"text-lg",
|
|
9
|
+
"text-base",
|
|
10
|
+
"text-sm",
|
|
11
|
+
"font-bold",
|
|
12
|
+
"font-semibold",
|
|
13
|
+
"font-medium",
|
|
14
|
+
"italic",
|
|
15
|
+
"underline",
|
|
16
|
+
"line-through",
|
|
17
|
+
"leading-7",
|
|
18
|
+
"leading-relaxed",
|
|
19
|
+
// Spacing
|
|
20
|
+
"mt-8",
|
|
21
|
+
"mt-6",
|
|
22
|
+
"mt-5",
|
|
23
|
+
"mt-4",
|
|
24
|
+
"mt-3",
|
|
25
|
+
"mb-6",
|
|
26
|
+
"mb-4",
|
|
27
|
+
"mb-3",
|
|
28
|
+
"mb-2",
|
|
29
|
+
"my-6",
|
|
30
|
+
"my-4",
|
|
31
|
+
"p-4",
|
|
32
|
+
"p-6",
|
|
33
|
+
"px-1.5",
|
|
34
|
+
"px-2",
|
|
35
|
+
"px-3",
|
|
36
|
+
"px-4",
|
|
37
|
+
"py-0.5",
|
|
38
|
+
"py-1",
|
|
39
|
+
"py-2",
|
|
40
|
+
"pl-4",
|
|
41
|
+
"pl-6",
|
|
42
|
+
// Layout
|
|
43
|
+
"flex",
|
|
44
|
+
"inline-flex",
|
|
45
|
+
"items-center",
|
|
46
|
+
"justify-center",
|
|
47
|
+
"gap-2",
|
|
48
|
+
"space-y-1",
|
|
49
|
+
"list-disc",
|
|
50
|
+
"list-inside",
|
|
51
|
+
"ml-4",
|
|
52
|
+
// Borders and backgrounds
|
|
53
|
+
"border-l-2",
|
|
54
|
+
"border-l-4",
|
|
55
|
+
"rounded",
|
|
56
|
+
"rounded-lg",
|
|
57
|
+
"rounded-md",
|
|
58
|
+
"bg-muted",
|
|
59
|
+
// Images
|
|
60
|
+
"max-w-full",
|
|
61
|
+
"h-auto",
|
|
62
|
+
"overflow-x-auto",
|
|
63
|
+
// Interactions
|
|
64
|
+
"hover:underline",
|
|
65
|
+
"transition-all",
|
|
66
|
+
"duration-200",
|
|
67
|
+
"cursor-pointer"
|
|
68
|
+
];
|
|
69
|
+
var EXTENSION_CLASSES = [
|
|
70
|
+
// Alert colors (using opacity syntax)
|
|
71
|
+
"bg-blue-500/10",
|
|
72
|
+
"border-blue-500/30",
|
|
73
|
+
"text-blue-600",
|
|
74
|
+
"border-l-blue-500",
|
|
75
|
+
"bg-amber-500/10",
|
|
76
|
+
"border-amber-500/30",
|
|
77
|
+
"text-amber-600",
|
|
78
|
+
"border-l-amber-500",
|
|
79
|
+
"bg-red-500/10",
|
|
80
|
+
"border-red-500/30",
|
|
81
|
+
"text-red-600",
|
|
82
|
+
"border-l-red-500",
|
|
83
|
+
"bg-green-500/10",
|
|
84
|
+
"border-green-500/30",
|
|
85
|
+
"text-green-600",
|
|
86
|
+
"border-l-green-500",
|
|
87
|
+
// Button variants
|
|
88
|
+
"bg-blue-600",
|
|
89
|
+
"text-white",
|
|
90
|
+
"hover:bg-blue-700",
|
|
91
|
+
"bg-gray-200",
|
|
92
|
+
"text-gray-900",
|
|
93
|
+
"hover:bg-gray-300"
|
|
94
|
+
];
|
|
95
|
+
var DARK_MODE_CLASSES = [
|
|
96
|
+
"dark:text-blue-400",
|
|
97
|
+
"dark:text-amber-400",
|
|
98
|
+
"dark:text-red-400",
|
|
99
|
+
"dark:text-green-400",
|
|
100
|
+
"dark:bg-gray-800",
|
|
101
|
+
"dark:text-gray-100"
|
|
102
|
+
];
|
|
178
103
|
var changerawrMarkdownPlugin = plugin.withOptions(
|
|
179
|
-
() => () => {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
104
|
+
(options = {}) => ({ addUtilities }) => {
|
|
105
|
+
const { includeExtensions = true, darkMode = true } = options;
|
|
106
|
+
let allClasses = [...CORE_CLASSES];
|
|
107
|
+
if (includeExtensions) {
|
|
108
|
+
allClasses.push(...EXTENSION_CLASSES);
|
|
109
|
+
}
|
|
110
|
+
if (darkMode) {
|
|
111
|
+
allClasses.push(...DARK_MODE_CLASSES);
|
|
112
|
+
}
|
|
113
|
+
const preserveRules = allClasses.reduce((acc, className) => {
|
|
114
|
+
const safeClassName = className.replace(/[^a-zA-Z0-9]/g, "-");
|
|
115
|
+
acc[`.changerawr-preserve-${safeClassName}`] = {
|
|
116
|
+
// Use CSS custom properties to reference the class without creating actual styles
|
|
117
|
+
"--tw-preserve": `"${className}"`
|
|
118
|
+
};
|
|
119
|
+
return acc;
|
|
120
|
+
}, {});
|
|
121
|
+
addUtilities(preserveRules);
|
|
185
122
|
}
|
|
186
123
|
);
|
|
187
124
|
export {
|
|
188
125
|
changerawrMarkdownPlugin,
|
|
189
|
-
changerawrMarkdownPlugin as default
|
|
190
|
-
getSafelist
|
|
126
|
+
changerawrMarkdownPlugin as default
|
|
191
127
|
};
|
|
192
128
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/tailwind/plugin.ts"],"sourcesContent":["/**\r\n * Tailwind CSS plugin for @changerawr/markdown\r\n *\r\n * This plugin
|
|
1
|
+
{"version":3,"sources":["../../src/tailwind/plugin.ts"],"sourcesContent":["/**\r\n * Tailwind CSS safelist plugin for @changerawr/markdown\r\n *\r\n * This plugin ensures standard Tailwind classes used by markdown rendering\r\n * are included in the final CSS build and not purged.\r\n *\r\n */\r\n\r\nimport plugin from 'tailwindcss/plugin';\r\n\r\nexport interface ChangerawrMarkdownPluginOptions {\r\n /** Whether to include extension classes for alerts and buttons (default: true) */\r\n includeExtensions?: boolean;\r\n /** Whether to include dark mode variants (default: true) */\r\n darkMode?: boolean;\r\n}\r\n\r\n/**\r\n * Core Tailwind classes used by markdown components\r\n */\r\nconst CORE_CLASSES = [\r\n // Typography\r\n 'text-3xl', 'text-2xl', 'text-xl', 'text-lg', 'text-base', 'text-sm',\r\n 'font-bold', 'font-semibold', 'font-medium',\r\n 'italic', 'underline', 'line-through',\r\n 'leading-7', 'leading-relaxed',\r\n\r\n // Spacing\r\n 'mt-8', 'mt-6', 'mt-5', 'mt-4', 'mt-3',\r\n 'mb-6', 'mb-4', 'mb-3', 'mb-2',\r\n 'my-6', 'my-4',\r\n 'p-4', 'p-6',\r\n 'px-1.5', 'px-2', 'px-3', 'px-4',\r\n 'py-0.5', 'py-1', 'py-2',\r\n 'pl-4', 'pl-6',\r\n\r\n // Layout\r\n 'flex', 'inline-flex', 'items-center', 'justify-center',\r\n 'gap-2', 'space-y-1',\r\n 'list-disc', 'list-inside', 'ml-4',\r\n\r\n // Borders and backgrounds\r\n 'border-l-2', 'border-l-4',\r\n 'rounded', 'rounded-lg', 'rounded-md',\r\n 'bg-muted',\r\n\r\n // Images\r\n 'max-w-full', 'h-auto', 'overflow-x-auto',\r\n\r\n // Interactions\r\n 'hover:underline', 'transition-all', 'duration-200',\r\n 'cursor-pointer'\r\n];\r\n\r\n/**\r\n * Extension classes for alerts and buttons\r\n */\r\nconst EXTENSION_CLASSES = [\r\n // Alert colors (using opacity syntax)\r\n 'bg-blue-500/10', 'border-blue-500/30', 'text-blue-600', 'border-l-blue-500',\r\n 'bg-amber-500/10', 'border-amber-500/30', 'text-amber-600', 'border-l-amber-500',\r\n 'bg-red-500/10', 'border-red-500/30', 'text-red-600', 'border-l-red-500',\r\n 'bg-green-500/10', 'border-green-500/30', 'text-green-600', 'border-l-green-500',\r\n\r\n // Button variants\r\n 'bg-blue-600', 'text-white', 'hover:bg-blue-700',\r\n 'bg-gray-200', 'text-gray-900', 'hover:bg-gray-300'\r\n];\r\n\r\n/**\r\n * Dark mode variants\r\n */\r\nconst DARK_MODE_CLASSES = [\r\n 'dark:text-blue-400', 'dark:text-amber-400', 'dark:text-red-400', 'dark:text-green-400',\r\n 'dark:bg-gray-800', 'dark:text-gray-100'\r\n];\r\n\r\nexport const changerawrMarkdownPlugin = plugin.withOptions<ChangerawrMarkdownPluginOptions>(\r\n (options = {}) => ({ addUtilities }) => {\r\n const { includeExtensions = true, darkMode = true } = options;\r\n\r\n let allClasses = [...CORE_CLASSES];\r\n\r\n if (includeExtensions) {\r\n allClasses.push(...EXTENSION_CLASSES);\r\n }\r\n\r\n if (darkMode) {\r\n allClasses.push(...DARK_MODE_CLASSES);\r\n }\r\n\r\n // Create hidden utilities that reference the classes\r\n // This ensures Tailwind includes them in the final CSS\r\n const preserveRules = allClasses.reduce((acc, className) => {\r\n const safeClassName = className.replace(/[^a-zA-Z0-9]/g, '-');\r\n acc[`.changerawr-preserve-${safeClassName}`] = {\r\n // Use CSS custom properties to reference the class without creating actual styles\r\n '--tw-preserve': `\"${className}\"`\r\n };\r\n return acc;\r\n }, {} as Record<string, Record<string, string>>);\r\n\r\n addUtilities(preserveRules);\r\n }\r\n);\r\n\r\nexport default changerawrMarkdownPlugin;"],"mappings":";AAQA,OAAO,YAAY;AAYnB,IAAM,eAAe;AAAA;AAAA,EAEjB;AAAA,EAAY;AAAA,EAAY;AAAA,EAAW;AAAA,EAAW;AAAA,EAAa;AAAA,EAC3D;AAAA,EAAa;AAAA,EAAiB;AAAA,EAC9B;AAAA,EAAU;AAAA,EAAa;AAAA,EACvB;AAAA,EAAa;AAAA;AAAA,EAGb;AAAA,EAAQ;AAAA,EAAQ;AAAA,EAAQ;AAAA,EAAQ;AAAA,EAChC;AAAA,EAAQ;AAAA,EAAQ;AAAA,EAAQ;AAAA,EACxB;AAAA,EAAQ;AAAA,EACR;AAAA,E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,iBAAiB,GAAG;AAC5D,UAAI,wBAAwB,aAAa,EAAE,IAAI;AAAA;AAAA,QAE3C,iBAAiB,IAAI,SAAS;AAAA,MAClC;AACA,aAAO;AAAA,IACX,GAAG,CAAC,CAA2C;AAE/C,iBAAa,aAAa;AAAA,EAC9B;AACJ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@changerawr/markdown",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"description": "
|
|
7
|
+
"description": "Powerful markdown renderer with custom extensions for Changerawr - supports HTML, Tailwind CSS, and JSON outputs",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"markdown",
|
|
10
10
|
"parser",
|