@uniweb/content-reader 1.0.6 → 1.0.8

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.6",
3
+ "version": "1.0.8",
4
4
  "description": "Markdown to ProseMirror document structure converter",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -106,6 +106,7 @@ function parseInline(token, schema, removeNewLine = false) {
106
106
 
107
107
  // Extract known link/button attributes from curly brace attrs
108
108
  const {
109
+ role, // Optional hint for components (e.g., "button", "nav")
109
110
  variant = "primary",
110
111
  download,
111
112
  target,
@@ -130,6 +131,7 @@ function parseInline(token, schema, removeNewLine = false) {
130
131
  attrs: {
131
132
  href,
132
133
  title: token.title || null,
134
+ ...(role && { role }),
133
135
  ...(isButton && { variant }),
134
136
  ...(download !== undefined && { download }),
135
137
  ...(target && { target }),
@@ -148,16 +150,16 @@ function parseInline(token, schema, removeNewLine = false) {
148
150
  if (token.type === "image") {
149
151
  let role, src, iconLibrary, iconName;
150
152
 
151
- // Check for icon protocol prefixes (lucide:, heroicons:, etc.)
152
- const iconMatch = token.href.match(/^(lucide|heroicons|phosphor|tabler|feather|icon):(.+)$/);
153
+ // Check for icon library prefixes (lucide:, heroicons:, etc.)
154
+ // Note: 'icon:' is NOT included here - it's a role prefix, not a library
155
+ const iconMatch = token.href.match(/^(lucide|heroicons|phosphor|tabler|feather):(.+)$/);
153
156
  if (iconMatch) {
154
157
  iconLibrary = iconMatch[1];
155
158
  iconName = iconMatch[2];
156
159
  role = "icon";
157
- // For known icon libraries, use the name; for generic 'icon:', use as URL
158
- src = iconLibrary === "icon" ? iconName : null;
160
+ src = null; // Named icons don't have a src URL
159
161
  }
160
- // Find the first colon to handle role:url format correctly (legacy syntax)
162
+ // Find the first colon to handle role:url format correctly (e.g., icon:path/to/file.svg)
161
163
  else if (token.href.includes(":") && !token.href.startsWith("http")) {
162
164
  const colonIndex = token.href.indexOf(":");
163
165
  role = token.href.substring(0, colonIndex);