Skip to content

Commit c1b4fae

Browse files
authored
fix(aiicons): emit marker-less base64 data URI so --embed icons render (#82)
The ';base64,' marker (added in #36) breaks draw.io's style parser, which splits style values on ';' — the image= value gets truncated at 'data:image/svg+xml' and the icon renders as a blank box. Switch both embed paths (lobe-icons and simple-icons fallback) to the marker-less form 'data:image/svg+xml,<base64>', draw.io's own convention for embedded images. Verified via drawio CLI 30.2.6: marker-less renders, ';base64,' is blank. Fixes #80
1 parent 6c53172 commit c1b4fae

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

skills/drawio-skill/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: drawio-skill
3-
version: 1.28.1
3+
version: 1.28.2
44
description: Use when the user requests diagrams, flowcharts, architecture diagrams, ER diagrams, UML / sequence / class diagrams, network topology, cloud architecture from Terraform or Kubernetes manifests, ML/DL model figures (Transformer/CNN/LSTM), mind maps, or any visualization. Also use proactively when explaining systems with 3+ components, complex data flows, or relationships that benefit from visual representation. Best suited when the diagram needs custom styling, rich shape vocabulary, swimlanes, or exportable images (PNG/SVG/PDF/JPG). Generates .drawio XML and exports locally via the native draw.io desktop CLI.
55
license: MIT
66
homepage: https://github.com/Agents365-ai/drawio-skill

skills/drawio-skill/scripts/aiicons.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ def main():
164164
continue
165165
# Rewrite the 1em intrinsic size so draw.io scales the inlined SVG.
166166
svg = svg.replace(b'width="1em"', b'width="24"').replace(b'height="1em"', b'height="24"')
167-
image = "data:image/svg+xml;base64," + base64.b64encode(svg).decode()
167+
# Marker-less base64: draw.io splits style values on ';', so a
168+
# ';base64,' marker would truncate the image= value (issue #80).
169+
image = "data:image/svg+xml," + base64.b64encode(svg).decode()
168170
else:
169171
image = url
170172
results.append({"brand": base, "file": file, "w": args.size, "h": args.size,
@@ -179,7 +181,8 @@ def main():
179181
if args.embed:
180182
try:
181183
svg = urllib.request.urlopen(url, timeout=15).read()
182-
image = "data:image/svg+xml;base64," + base64.b64encode(svg).decode()
184+
# Marker-less base64 (see issue #80 note above).
185+
image = "data:image/svg+xml," + base64.b64encode(svg).decode()
183186
except Exception as exc: # noqa: BLE001 - keep the CDN URL
184187
sys.stderr.write(f"warning: could not fetch {url} ({exc}); using CDN URL\n")
185188
results.append({"brand": brand, "file": f"simpleicons:{slug}",

0 commit comments

Comments
 (0)