arcane-os 0.16.0 → 0.16.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.16.1
4
+
5
+ - Remove raw script elements and inline event-handler attributes at the
6
+ `markdown-document` insertion boundary, including nested template contents.
7
+ Preserve literal fenced and inline code examples, formatting, navigation,
8
+ and asynchronous document loading. This targeted reader correction does not
9
+ provide a general-purpose HTML sanitizer or alter other Markdown consumers.
10
+
3
11
  ## 0.16.0
4
12
 
5
13
  - Make mail hosting domain-based: use the current browser origin by default,
package/README.md CHANGED
@@ -19,7 +19,7 @@ version-locked SDK runtime, while an integrated Arcane checkout uses its live
19
19
  `arcane/` runtime. Both profiles preserve the same app URLs, theme, packaging,
20
20
  event, cancellation, and browser run contracts.
21
21
 
22
- This checkout defines the `0.16.0` SDK contract. Applications pin one exact npm
22
+ This checkout defines the `0.16.1` SDK contract. Applications pin one exact npm
23
23
  version and lockfile; registry state is deliberately not baked into application
24
24
  artifacts.
25
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arcane-os",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "Arcane OS JavaScript SDK, project-local CLI, browser runtime, and repository-portable application packager.",
5
5
  "type": "module",
6
6
  "main": "./src/index.mjs",
@@ -616,8 +616,8 @@
616
616
  return true;
617
617
  }
618
618
 
619
- // MD.safeRendered owns Markdown rendering. The detached template keeps
620
- // source-relative links and images coherent before insertion.
619
+ // MD renders Markdown; the detached fragment removes active script
620
+ // markup and resolves source-relative assets before insertion.
621
621
  const safeRendered=new MD(markdown).safeRendered;
622
622
  const fragment=renderedMarkdownFragment(safeRendered,sourceURL);
623
623
  const meaningful=Boolean(
@@ -648,6 +648,27 @@
648
648
  const template=document.createElement('template');
649
649
  template.innerHTML=html;
650
650
 
651
+ // Code examples are text nodes, so their literal markup stays intact.
652
+ // Visit nested template contents too, without reparsing cleaned HTML.
653
+ const pendingFragments=[template.content];
654
+ while(pendingFragments.length){
655
+ const fragment=pendingFragments.pop();
656
+ for(const element of fragment.querySelectorAll('*')){
657
+ if(element.localName.toLowerCase()==='script'){
658
+ element.remove();
659
+ continue;
660
+ }
661
+ for(const attribute of Array.from(element.attributes)){
662
+ if(attribute.name.toLowerCase().startsWith('on')){
663
+ element.removeAttributeNode(attribute);
664
+ }
665
+ }
666
+ if(element.localName==='template'&&element.content){
667
+ pendingFragments.push(element.content);
668
+ }
669
+ }
670
+ }
671
+
651
672
  for(const link of template.content.querySelectorAll('a[href]')){
652
673
  const originalHref=link.getAttribute('href')||'';
653
674
  const policy=markdownDocumentLinkPolicy(originalHref,sourceURL,pageOrigin);