@marimo-team/islands 0.17.3 → 0.17.4

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": "@marimo-team/islands",
3
- "version": "0.17.3",
3
+ "version": "0.17.4",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
package/src/css/md.css CHANGED
@@ -78,8 +78,14 @@ a .markdown iconify-icon:first-child {
78
78
  margin-inline-end: 0.4em;
79
79
  }
80
80
 
81
+ iconify-icon {
82
+ display: inline-flex;
83
+ align-items: center;
84
+ }
85
+
81
86
  /* align icons with buttons better */
82
87
  button .markdown .paragraph {
88
+ display: inline-flex;
83
89
  align-items: baseline;
84
90
  gap: 0.4em;
85
91
 
@@ -462,4 +462,31 @@ describe("sanitizeHtml", () => {
462
462
  `"<details><summary>Click me</summary><p>Hidden content</p></details>"`,
463
463
  );
464
464
  });
465
+
466
+ test("preserves iconify-icon custom element", () => {
467
+ const html = '<iconify-icon icon="lucide:leaf"></iconify-icon>';
468
+ expect(sanitizeHtml(html)).toMatchInlineSnapshot(
469
+ `"<iconify-icon icon="lucide:leaf"></iconify-icon>"`,
470
+ );
471
+ });
472
+
473
+ test("preserves iconify-icon with all attributes", () => {
474
+ const html =
475
+ '<iconify-icon icon="lucide:rocket" width="24px" height="24px" inline="" flip="horizontal" rotate="90deg" style="color: blue;"></iconify-icon>';
476
+ expect(sanitizeHtml(html)).toMatchInlineSnapshot(
477
+ `"<iconify-icon icon="lucide:rocket" width="24px" height="24px" inline="" flip="horizontal" rotate="90deg" style="color: blue;"></iconify-icon>"`,
478
+ );
479
+ });
480
+
481
+ test("preserves self-closing iconify-icon", () => {
482
+ const html = '<iconify-icon icon="lucide:star" />';
483
+ expect(sanitizeHtml(html)).toMatchInlineSnapshot(
484
+ `"<iconify-icon icon="lucide:star"></iconify-icon>"`,
485
+ );
486
+ });
487
+
488
+ test("still removes other non-marimo/non-iconify custom elements", () => {
489
+ const html = "<some-custom-element>Content</some-custom-element>";
490
+ expect(sanitizeHtml(html)).toMatchInlineSnapshot(`"Content"`);
491
+ });
465
492
  });
@@ -75,7 +75,7 @@ export function sanitizeHtml(html: string) {
75
75
  // glue elements like style, script or others to document.body and prevent unintuitive browser behavior in several edge-cases
76
76
  FORCE_BODY: true,
77
77
  CUSTOM_ELEMENT_HANDLING: {
78
- tagNameCheck: /^marimo-[A-Za-z][\w-]*$/,
78
+ tagNameCheck: /^(marimo-[A-Za-z][\w-]*|iconify-icon)$/,
79
79
  attributeNameCheck: /^[A-Za-z][\w-]*$/,
80
80
  },
81
81
  };