@uniweb/content-reader 1.0.5 → 1.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/content-reader",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Markdown to ProseMirror document structure converter",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -146,10 +146,19 @@ function parseInline(token, schema, removeNewLine = false) {
146
146
  }
147
147
 
148
148
  if (token.type === "image") {
149
- let role, src;
150
-
151
- // Find the first colon to handle role:url format correctly (legacy syntax)
152
- if (token.href.includes(":") && !token.href.startsWith("http")) {
149
+ let role, src, iconLibrary, iconName;
150
+
151
+ // Check for icon library prefixes (lucide:, heroicons:, etc.)
152
+ // Note: 'icon:' is NOT included here - it's a role prefix, not a library
153
+ const iconMatch = token.href.match(/^(lucide|heroicons|phosphor|tabler|feather):(.+)$/);
154
+ if (iconMatch) {
155
+ iconLibrary = iconMatch[1];
156
+ iconName = iconMatch[2];
157
+ role = "icon";
158
+ src = null; // Named icons don't have a src URL
159
+ }
160
+ // Find the first colon to handle role:url format correctly (e.g., icon:path/to/file.svg)
161
+ else if (token.href.includes(":") && !token.href.startsWith("http")) {
153
162
  const colonIndex = token.href.indexOf(":");
154
163
  role = token.href.substring(0, colonIndex);
155
164
  src = token.href.substring(colonIndex + 1);
@@ -162,6 +171,7 @@ function parseInline(token, schema, removeNewLine = false) {
162
171
  role: attrRole,
163
172
  width,
164
173
  height,
174
+ size, // Icon size (shorthand for width=height)
165
175
  loading,
166
176
  poster, // For videos: explicit poster image
167
177
  preview, // For PDFs/documents: preview image
@@ -171,6 +181,7 @@ function parseInline(token, schema, removeNewLine = false) {
171
181
  controls,
172
182
  fit, // object-fit: cover, contain, etc.
173
183
  position, // object-position
184
+ color, // Icon color
174
185
  ...otherAttrs
175
186
  } = token.attrs || {};
176
187
 
@@ -185,6 +196,11 @@ function parseInline(token, schema, removeNewLine = false) {
185
196
  caption: token.title || null,
186
197
  alt: text || null,
187
198
  role: finalRole,
199
+ // Icon-specific attributes
200
+ ...(iconLibrary && iconLibrary !== "icon" && { library: iconLibrary }),
201
+ ...(iconName && { name: iconName }),
202
+ ...(size && { size }),
203
+ ...(color && { color }),
188
204
  // Dimension attributes
189
205
  ...(width && { width: parseInt(width, 10) || width }),
190
206
  ...(height && { height: parseInt(height, 10) || height }),