@scrider/formatter 1.7.0 → 1.7.2

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/dist/index.d.cts CHANGED
@@ -1026,7 +1026,7 @@ declare const blockFormat: Format<Record<string, unknown>>;
1026
1026
  * Delta: { insert: { codeWidget: "https://codesandbox.io/s/abc123" } }
1027
1027
  *
1028
1028
  * Value is a URL to an interactive code playground (StackBlitz, CodeSandbox,
1029
- * Replit, CodePen, JSFiddle). Rendered as an <iframe> carrying a
1029
+ * Replit, CodePen, JSFiddle, Trinket, OneCompiler). Rendered as an <iframe> carrying a
1030
1030
  * `data-code-widget` marker so it can be told apart from a plain video iframe
1031
1031
  * during HTML → Delta (see videoFormat.match guard).
1032
1032
  *
@@ -1656,6 +1656,8 @@ declare function unescapeHtml(text: string): string;
1656
1656
  * Replit | replit.com/@{u}/{repl} | …?embed=true
1657
1657
  * CodePen | codepen.io/{u}/pen/{id} | codepen.io/{u}/embed/{id}
1658
1658
  * JSFiddle | jsfiddle.net/{u}/{id}/ | jsfiddle.net/{u}/{id}/embedded/
1659
+ * Trinket | trinket.io/{lang}/{id} | trinket.io/embed/{lang}/{id}
1660
+ * OneCompiler | onecompiler.com/{lang}/{id} | onecompiler.com/embed/{lang}/{id}
1659
1661
  *
1660
1662
  * Unknown hosts are returned unchanged (the marker `data-code-widget` still
1661
1663
  * makes them render as an iframe; auto-detection of bare URLs lives in the
package/dist/index.d.ts CHANGED
@@ -1026,7 +1026,7 @@ declare const blockFormat: Format<Record<string, unknown>>;
1026
1026
  * Delta: { insert: { codeWidget: "https://codesandbox.io/s/abc123" } }
1027
1027
  *
1028
1028
  * Value is a URL to an interactive code playground (StackBlitz, CodeSandbox,
1029
- * Replit, CodePen, JSFiddle). Rendered as an <iframe> carrying a
1029
+ * Replit, CodePen, JSFiddle, Trinket, OneCompiler). Rendered as an <iframe> carrying a
1030
1030
  * `data-code-widget` marker so it can be told apart from a plain video iframe
1031
1031
  * during HTML → Delta (see videoFormat.match guard).
1032
1032
  *
@@ -1656,6 +1656,8 @@ declare function unescapeHtml(text: string): string;
1656
1656
  * Replit | replit.com/@{u}/{repl} | …?embed=true
1657
1657
  * CodePen | codepen.io/{u}/pen/{id} | codepen.io/{u}/embed/{id}
1658
1658
  * JSFiddle | jsfiddle.net/{u}/{id}/ | jsfiddle.net/{u}/{id}/embedded/
1659
+ * Trinket | trinket.io/{lang}/{id} | trinket.io/embed/{lang}/{id}
1660
+ * OneCompiler | onecompiler.com/{lang}/{id} | onecompiler.com/embed/{lang}/{id}
1659
1661
  *
1660
1662
  * Unknown hosts are returned unchanged (the marker `data-code-widget` still
1661
1663
  * makes them render as an iframe; auto-detection of bare URLs lives in the
package/dist/index.js CHANGED
@@ -2034,7 +2034,7 @@ function appendQueryParam(url, key, value) {
2034
2034
  const next = query ? `${query}&${key}=${value}` : `?${key}=${value}`;
2035
2035
  return `${base}${next}${hash}`;
2036
2036
  }
2037
- var CODE_WIDGET_IFRAME_ALLOW = "accelerometer; camera; encrypted-media; geolocation; gyroscope; microphone; midi; payment; usb; vr; xr-spatial-tracking; cross-origin-isolated";
2037
+ var CODE_WIDGET_IFRAME_ALLOW = "accelerometer; camera; encrypted-media; geolocation; gyroscope; microphone; midi; payment; usb; xr-spatial-tracking; cross-origin-isolated";
2038
2038
  function renderEmbedIframeIsolationAttrs(context, kind) {
2039
2039
  const opts = context?.embed;
2040
2040
  const parts = [];
@@ -2069,6 +2069,14 @@ function toCodeWidgetEmbedUrl(url) {
2069
2069
  const trimmed = base.replace(/\/+$/, "");
2070
2070
  return `${trimmed}/embedded/${query}${hash}`;
2071
2071
  }
2072
+ if (/(?:\/\/|^)(?:[\w-]+\.)*trinket\.io\//i.test(u)) {
2073
+ if (/trinket\.io\/embed\//i.test(u)) return u;
2074
+ return u.replace(/trinket\.io\//i, "trinket.io/embed/");
2075
+ }
2076
+ if (/(?:\/\/|^)(?:[\w-]+\.)*onecompiler\.com\//i.test(u)) {
2077
+ if (/onecompiler\.com\/embed\//i.test(u)) return u;
2078
+ return u.replace(/onecompiler\.com\//i, "onecompiler.com/embed/");
2079
+ }
2072
2080
  return u;
2073
2081
  }
2074
2082