@scalio-cloud/ui 0.71.0 → 0.73.0

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/README.md CHANGED
@@ -670,6 +670,16 @@ shows `AiCredits` (bar, warning from 80 %, note at 100 %). `AiHelp` is «Frag Sc
670
670
  whose `onAsk` returns `{text, sources: [{title, source, url}]}`; `AiPanel` shows such sources too. Test IDs
671
671
  `ai-scalio`, `ai-credits`, `ai-credits-text`, `ai-credits-note`, `ai-help`, `ai-help-sources-<n>`.
672
672
 
673
+ Since 0.73.0 (BL-332, scalio-infra #757) `AiSuggestion` (the `text`) and `AiPanel`/`AiHelp` (the answers) show
674
+ AI text as safe Markdown, no longer as raw text with `##`, `**` and backticks: headings, bold, italic, lists, inline
675
+ code and code blocks, paragraphs, tables and callouts. The text is parsed into React elements (the `Markdown` block
676
+ with `links="https"` and `anchors={false}`), never HTML: `<script>`, `<img onerror>` and other HTML stay visible as
677
+ text; links work only with `https://` (no `javascript:`, `data:`, `http:`, `mailto:` or relative addresses); images
678
+ stay text; headings get no id. Questions and error messages stay plain text. `format="text"` on `AiSuggestion` or
679
+ `AiPanel` keeps the old display (text as it is, line breaks kept). `AiText` shows any AI text the same way:
680
+ `<AiText text={answer} lang={lang} testId="explain-text" />` (`format`, `className`). Source links (`sources[].url`)
681
+ work only with https or a path of the app (`/help/...`), else only the title is shown.
682
+
673
683
  ## Benachrichtigungen: E-Mail-Versand und E-Mail-Vorlagen (React)
674
684
 
675
685
  Since 0.29.0 (ADR 0069 W5) every app sends mail the same way. The server side is scalio-platform 0.8.0 `mail`
@@ -749,6 +759,9 @@ markdownOutline(page.body) // [{ level, text, id }] for a table of contents; h
749
759
  `labels` overrides the callout titles (`{ note, tip, important, warning, caution }`). Also exported:
750
760
  `parseMarkdownBlocks`, `parseMarkdownInline`, `markdownHeadingId`, `safeHref`. Test IDs: `callout-<kind>`.
751
761
 
762
+ From 0.73.0: `links="https"` makes only https addresses links (images stay text) and `anchors={false}` leaves the
763
+ headings without an id; `AiText` uses both for AI text. Also exported: `safeHttpsHref`.
764
+
752
765
  From 0.70.0: `pageLinks` reads `[[Title]]`, `[[KEY:Title]]` and `[[Title|text]]` as page links (shown as text with a
753
766
  dotted line, `.scalio-md-pagelink`, unless the app renders them). `render={{ image, link, pagelink }}` puts the app's
754
767
  own elements in: `image(node, key)`, `link(node, key, children)`, `pagelink(node, key)`; a function that returns
package/nav.css CHANGED
@@ -910,7 +910,11 @@ ul.scalio-notice { flex-direction: column; gap: 0.25rem; padding-left: 2rem; lis
910
910
  .dark .scalio-ai-badge, .dark .scalio-ai-btn .scalio-icon { color: #8ba6f7; }
911
911
  .scalio-ai-suggestion { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.875rem 1rem; border: 1px solid hsl(var(--primary) / 0.3); border-left-width: 3px; border-radius: var(--radius, 4px); background: hsl(var(--card)); }
912
912
  .scalio-ai-suggestion-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
913
- .scalio-ai-suggestion-text { white-space: pre-wrap; font-size: 0.875rem; }
913
+ .scalio-ai-suggestion-text { font-size: 0.875rem; }
914
+ .scalio-ai-text.is-plain { white-space: pre-wrap; }
915
+ .scalio-ai-text.scalio-md > * + * { margin-top: 0.5rem; }
916
+ .scalio-ai-text .scalio-md-h1, .scalio-ai-text .scalio-md-h2 { font-size: 1rem; line-height: 1.5rem; padding-top: 0.25rem; }
917
+ .scalio-ai-text .scalio-md-h3, .scalio-ai-text .scalio-md-h4 { font-size: 0.875rem; padding-top: 0; }
914
918
  .scalio-ai-suggestion-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
915
919
  .scalio-ai-feature { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; }
916
920
  .scalio-ai-feature + .scalio-ai-feature { border-top: 1px solid hsl(var(--border)); }
@@ -932,7 +936,7 @@ ul.scalio-notice { flex-direction: column; gap: 0.25rem; padding-left: 2rem; lis
932
936
  .scalio-ai-turn { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.875rem; }
933
937
  .scalio-ai-turn.is-user { align-self: flex-end; max-width: 85%; padding: 0.5rem 0.75rem; border-radius: var(--radius, 4px); background: hsl(var(--muted)); }
934
938
  .scalio-ai-turn.is-error .scalio-ai-turn-text { color: hsl(var(--destructive)); }
935
- .scalio-ai-turn-text { white-space: pre-wrap; }
939
+ .scalio-ai-turn-text:not(.scalio-md) { white-space: pre-wrap; }
936
940
  .scalio-ai-panel-form { display: flex; gap: 0.5rem; align-items: flex-end; }
937
941
  .scalio-ai-panel-form textarea { flex: 1; resize: vertical; }
938
942
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalio-cloud/ui",
3
- "version": "0.71.0",
3
+ "version": "0.73.0",
4
4
  "description": "Scalio Control Room design tokens, Tailwind preset, self-hosted fonts, the shared app header, sign-in layout, sidebar and page blocks",
5
5
  "license": "SEE LICENSE IN README.md",
6
6
  "private": false,
package/react/ai.js CHANGED
@@ -6,11 +6,13 @@
6
6
  // - AiBadge: marks text the AI wrote
7
7
  // - AiSuggestion: a proposal with reason and source; «Übernehmen», «Bearbeiten», «Verwerfen» (never runs by itself)
8
8
  // - AiPanel: side panel «Assistent» with the context of the open page
9
+ // - AiText: a text of the AI as safe Markdown (React elements, never HTML; links only https); format="text" as is
9
10
  const React = require("react");
10
11
  const h = React.createElement;
11
12
  const Icons = require("./icons");
12
13
  const { SettingsSection, SettingsField: Field, SettingsRow } = require("./settings");
13
14
  const { askConfirm } = require("./dialog");
15
+ const { Markdown, safeHref } = require("./markdown");
14
16
 
15
17
  const PROVIDERS = ["scalio", "openai", "anthropic", "gemini", "ollama"];
16
18
  const KEY_PROVIDERS = ["openai", "anthropic", "gemini"];
@@ -381,7 +383,23 @@ function AiBadge(props) {
381
383
  h(Icons.Sparkles, { className: "scalio-icon" }), L.badge);
382
384
  }
383
385
 
384
- // Props: suggestion ({title, text, reason, risk, source}), onAccept, onEdit, onReject (each optional), busy, lang, labels, testId.
386
+ // Text the AI wrote: Markdown with headings, bold, italic, lists, code and https links (BL-332, scalio-infra #757);
387
+ // no HTML from the text, no other links, no images, headings without an id. format="text": the text as it is.
388
+ function AiText(props) {
389
+ const cls = props.className ? ` ${props.className}` : "";
390
+ if (props.format === "text") return h("div", { className: `scalio-ai-text is-plain${cls}`, "data-testid": props.testId }, String(props.text ?? ""));
391
+ return h(Markdown, { text: String(props.text ?? ""), lang: props.lang, links: "https", anchors: false,
392
+ className: `scalio-ai-text${cls}`, testId: props.testId });
393
+ }
394
+
395
+ // A source link of an answer: https or a path of the app, else only its title.
396
+ function sourceHref(url) {
397
+ const href = safeHref(url);
398
+ return href && (/^https:\/\//i.test(href) || href.startsWith("/")) ? href : null;
399
+ }
400
+
401
+ // Props: suggestion ({title, text, reason, risk, source}), onAccept, onEdit, onReject (each optional), busy, lang, labels, testId,
402
+ // format ("markdown", default, or "text").
385
403
  // The app runs its normal action in onAccept, with the person's rights and an audit entry (ADR 0111 K3).
386
404
  function AiSuggestion(props) {
387
405
  const L = labels(props.lang, props.labels);
@@ -394,7 +412,7 @@ function AiSuggestion(props) {
394
412
  h("div", { className: "scalio-ai-suggestion-head" }, h(AiBadge, { lang: props.lang, labels: props.labels, testId: `${tid}-badge` }),
395
413
  s.title ? h("strong", null, s.title) : null,
396
414
  risk ? h("span", { className: `scalio-badge ${risk === "high" ? "is-error" : risk === "medium" ? "is-warn" : "is-ok"}`, "data-testid": `${tid}-risk` }, L.risk[risk]) : null),
397
- s.text ? h("div", { className: "scalio-ai-suggestion-text", "data-testid": `${tid}-text` }, s.text) : null,
415
+ s.text ? h(AiText, { text: s.text, format: props.format, lang: props.lang, className: "scalio-ai-suggestion-text", testId: `${tid}-text` }) : null,
398
416
  s.reason ? h("div", { className: "scalio-settings-help" }, `${L.reason}: ${s.reason}`) : null,
399
417
  s.source ? h("div", { className: "scalio-settings-help", "data-testid": `${tid}-source` }, `${L.source}: ${s.source}`) : null,
400
418
  h("div", { className: "scalio-ai-suggestion-actions" },
@@ -402,7 +420,7 @@ function AiSuggestion(props) {
402
420
  }
403
421
 
404
422
  // Props: open, onClose, context (name of the open page or object), onAsk(question, history) -> Promise<string>,
405
- // lang, labels, testId. History is kept while the panel lives; nothing is stored.
423
+ // lang, labels, testId, format ("markdown", default, or "text" for the answers). History is kept while the panel lives; nothing is stored.
406
424
  function AiPanel(props) {
407
425
  const L = labels(props.lang, props.labels);
408
426
  const [turns, setTurns] = React.useState([]);
@@ -442,11 +460,13 @@ function AiPanel(props) {
442
460
  h("div", { className: "scalio-ai-panel-turns", "aria-live": "polite", "data-testid": `${tid}-turns` },
443
461
  turns.length ? turns.map((t, i) => h("div", { key: i, className: `scalio-ai-turn is-${t.role}${t.error ? " is-error" : ""}` },
444
462
  t.role === "assistant" && !t.error ? h(AiBadge, { lang: props.lang, labels: props.labels, testId: `${tid}-badge-${i}` }) : null,
445
- h("div", { className: "scalio-ai-turn-text" }, t.content),
463
+ t.role === "assistant" && !t.error
464
+ ? h(AiText, { text: t.content, format: props.format, lang: props.lang, className: "scalio-ai-turn-text" })
465
+ : h("div", { className: "scalio-ai-turn-text" }, t.content),
446
466
  t.sources && t.sources.length ? h("div", { className: "scalio-ai-sources", "data-testid": `${tid}-sources-${i}` },
447
467
  h("span", null, `${L.helpSources}: `),
448
- t.sources.map((src, j) => h("span", { key: j, className: "scalio-ai-source" }, src.url
449
- ? h("a", { href: src.url, target: "_blank", rel: "noreferrer" }, src.title || src.source) : (src.title || src.source)))) : null))
468
+ t.sources.map((src, j) => h("span", { key: j, className: "scalio-ai-source" }, sourceHref(src.url)
469
+ ? h("a", { href: sourceHref(src.url), target: "_blank", rel: "noopener noreferrer" }, src.title || src.source) : (src.title || src.source)))) : null))
450
470
  : h("p", { className: "scalio-settings-help" }, props.emptyText || L.panelEmpty),
451
471
  busy ? h("div", { className: "scalio-ai-turn is-assistant", "data-testid": `${tid}-busy` }, h("span", { className: "scalio-spinner", "aria-hidden": "true" }), L.working) : null),
452
472
  h("form", { className: "scalio-ai-panel-form", onSubmit: ask },
@@ -462,4 +482,4 @@ function AiHelp(props) {
462
482
  return h(AiPanel, Object.assign({ testId: "ai-help", title: L.helpTitle, emptyText: L.helpEmpty }, props));
463
483
  }
464
484
 
465
- module.exports = { AiSettingsPanel, AiHelp, AiCredits, AiButton, AiBadge, AiSuggestion, AiPanel, aiApi, aiForm, aiPatch, AI_LABELS: LABELS, AI_LEVELS: LEVELS };
485
+ module.exports = { AiSettingsPanel, AiHelp, AiCredits, AiButton, AiBadge, AiSuggestion, AiPanel, AiText, aiApi, aiForm, aiPatch, AI_LABELS: LABELS, AI_LEVELS: LEVELS };
package/react/mail.js CHANGED
@@ -20,6 +20,11 @@ const LABELS = {
20
20
  autoHint: "Die App richtet das Senderecht mit ihrer Verbindung zum Tenant selbst ein, nur für dieses Postfach («RBAC for Applications»). Exchange übernimmt es nach bis zu zwei Stunden.",
21
21
  autoGrant: "Senderecht setzen",
22
22
  autoGranted: "Senderecht gesetzt",
23
+ grantOff: {
24
+ read_only: "Die Verbindung zum Tenant darf Exchange Online nur lesen. Darum setzt die App das Senderecht nicht selbst: Führen Sie das Skript aus.",
25
+ no_exchange: "Die Verbindung zum Tenant hat keinen Zugang zur Exchange-Verwaltung. Darum setzt die App das Senderecht nicht selbst: Führen Sie das Skript aus.",
26
+ identity: "Die App konnte ihre eigene Identität im Tenant nicht lesen. Prüfen Sie die Tenant-Verbindung oder führen Sie das Skript aus.",
27
+ },
23
28
  rightsCheck: "Status prüfen",
24
29
  rightsState: { ok: "Senderecht vorhanden", missing: "Senderecht fehlt", unknown: "Senderecht nicht prüfbar, die Testmail zeigt es" },
25
30
  rightsScriptAlso: "Lieber selbst ausführen? Skript anzeigen",
@@ -54,7 +59,7 @@ const LABELS = {
54
59
  tenantChoose: "Bitte wählen",
55
60
  noTenants: "Noch kein Tenant verbunden. Verbinden Sie zuerst einen Tenant, dann wählen Sie ihn hier.",
56
61
  rightsTitle: "Senderecht in Exchange Online",
57
- rightsHint: "Damit die App nur als dieses Postfach senden darf: Führen Sie das Skript einmal als Exchange-Administrator in der Azure Cloud Shell (PowerShell) aus. Es nutzt «RBAC for Applications» und kann erneut laufen, auch nach einem Wechsel des Postfachs. Exchange übernimmt das Recht nach bis zu zwei Stunden; dann die Testmail senden.",
62
+ rightsHint: "Damit die App nur als dieses Postfach senden darf: Führen Sie das Skript einmal als Exchange-Administrator in der Azure Cloud Shell oder in PowerShell 7 auf Ihrem Computer aus (fehlende Module installiert es selbst). Es nutzt «RBAC for Applications» und kann erneut laufen, auch nach einem Wechsel des Postfachs. Exchange übernimmt das Recht nach bis zu zwei Stunden; dann die Testmail senden.",
58
63
  showScript: "Skript anzeigen",
59
64
  copy: "Kopieren",
60
65
  copied: "Skript kopiert",
@@ -107,6 +112,11 @@ const LABELS = {
107
112
  autoHint: "The app sets up the send right itself with its connection to the tenant, for this mailbox only (RBAC for Applications). Exchange applies it within up to two hours.",
108
113
  autoGrant: "Set send right",
109
114
  autoGranted: "Send right set",
115
+ grantOff: {
116
+ read_only: "The connection to the tenant may only read Exchange Online, so the app does not set the send right itself: run the script.",
117
+ no_exchange: "The connection to the tenant has no access to the Exchange administration, so the app does not set the send right itself: run the script.",
118
+ identity: "The app could not read its own identity in the tenant. Check the tenant connection or run the script.",
119
+ },
110
120
  rightsCheck: "Check status",
111
121
  rightsState: { ok: "Send right in place", missing: "Send right missing", unknown: "Send right can not be checked, the test mail shows it" },
112
122
  rightsScriptAlso: "Rather run it yourself? Show script",
@@ -141,7 +151,7 @@ const LABELS = {
141
151
  tenantChoose: "Please choose",
142
152
  noTenants: "No tenant connected yet. Connect a tenant first, then choose it here.",
143
153
  rightsTitle: "Send right in Exchange Online",
144
- rightsHint: "So the app may send only as this mailbox: run the script once as an Exchange administrator in Azure Cloud Shell (PowerShell). It uses RBAC for Applications and can run again, also after changing the mailbox. Exchange applies the right within up to two hours; then send the test mail.",
154
+ rightsHint: "So the app may send only as this mailbox: run the script once as an Exchange administrator in Azure Cloud Shell or in PowerShell 7 on your computer (it installs missing modules itself). It uses RBAC for Applications and can run again, also after changing the mailbox. Exchange applies the right within up to two hours; then send the test mail.",
145
155
  showScript: "Show script",
146
156
  copy: "Copy",
147
157
  copied: "Script copied",
@@ -272,6 +282,9 @@ function select(id, value, options, onChange, extra) {
272
282
  // Exchange Online» shows the PowerShell from GET /mail/send-rights). With scalio-platform 0.19.0 (ADR 0090) the backend may
273
283
  // list the provider `default` («Vorgabe verwenden») and send `default` {available, source, provider, from_name,
274
284
  // from_address, tenant_id, smtp_host}: the page shows where the default comes from and where mails go.
285
+ // With scalio-platform 0.45.0 the status names a `reason` when the app can not set the send right itself: the button
286
+ // «Senderecht setzen» stays visible but greyed out with that reason (grantOffHint {read_only, no_exchange, identity}:
287
+ // the app's own texts, e.g. Citadel «Mit Scalio Schreiben setzt Citadel das Senderecht selbst»).
275
288
  function MailTransport(props) {
276
289
  const { client, lang } = props;
277
290
  const L = mailLabels(lang, props.labels);
@@ -514,6 +527,10 @@ function MailTransport(props) {
514
527
  );
515
528
 
516
529
  const auto = !!(rightsInfo && rightsInfo.mode === "auto" && client.grantRights);
530
+ // The button «Senderecht setzen» is there in every app (like Foundry); greyed out with the reason where the app's
531
+ // own connection may not set it (scalio-platform 0.45.0 `reason`). Not for an own app registration (provider graph).
532
+ const offReason = rightsInfo && rightsInfo.mode === "script" && L.grantOff[rightsInfo.reason] ? rightsInfo.reason : "";
533
+ const showGrant = auto || (!!offReason && !!client.grantRights);
517
534
  const rights = form.send_rights && (form.provider === "graph" || form.provider === "tenant" || form.provider === "default")
518
535
  ? h(
519
536
  SettingsSection,
@@ -524,9 +541,18 @@ function MailTransport(props) {
524
541
  L.rightsState[rightsInfo.state] || rightsInfo.state),
525
542
  h("button", { type: "button", className: "scalio-btn is-ghost", onClick: loadRights, "data-testid": "mail-rights-check" }, L.rightsCheck))
526
543
  : null,
527
- auto
544
+ rightsInfo && rightsInfo.detail
545
+ ? h("p", { className: "scalio-settings-help is-error", "data-testid": "mail-rights-detail" }, rightsInfo.detail)
546
+ : null,
547
+ showGrant
528
548
  ? h("div", { className: "scalio-settings-section-footer" },
529
- h("button", { type: "button", className: "scalio-btn is-primary", onClick: grant, disabled: granting, "data-testid": "mail-rights-grant" },
549
+ offReason
550
+ ? h("p", { className: "scalio-settings-help", "data-testid": "mail-rights-grant-off" },
551
+ (props.grantOffHint && props.grantOffHint[offReason]) || L.grantOff[offReason])
552
+ : null,
553
+ h("button", { type: "button", className: "scalio-btn is-primary", onClick: grant, disabled: granting || !auto,
554
+ title: offReason ? ((props.grantOffHint && props.grantOffHint[offReason]) || L.grantOff[offReason]) : undefined,
555
+ "data-testid": "mail-rights-grant" },
530
556
  h(Icons.Check, { className: "scalio-icon" }), L.autoGrant))
531
557
  : null,
532
558
  script
package/react/markdown.js CHANGED
@@ -19,6 +19,12 @@ function safeHref(href) {
19
19
  return h || null;
20
20
  }
21
21
 
22
+ // AI texts (links="https"): only https addresses become links.
23
+ function safeHttpsHref(href) {
24
+ const h = String(href || "").trim();
25
+ return /^https:\/\/[^\s/]/i.test(h) ? h : null;
26
+ }
27
+
22
28
  function splitRow(line) {
23
29
  let s = line.trim();
24
30
  if (s.startsWith("|")) s = s.slice(1);
@@ -143,8 +149,11 @@ const INLINE = new RegExp(INLINE_SRC, "g");
143
149
  const INLINE_PAGES = new RegExp(INLINE_SRC + "|\\[\\[([^[\\]\\n]+)\\]\\]", "g");
144
150
 
145
151
  // opts.pageLinks: [[...]] becomes {type: "pagelink", space, title, label} (else it stays text).
152
+ // opts.httpsOnly (AI texts): links only with https, images stay text.
146
153
  function parseInline(src, opts) {
147
154
  const pages = !!(opts && opts.pageLinks);
155
+ const httpsOnly = !!(opts && opts.httpsOnly);
156
+ const linkHref = httpsOnly ? safeHttpsHref : safeHref;
148
157
  const out = [];
149
158
  const text = String(src || "");
150
159
  let last = 0;
@@ -152,14 +161,15 @@ function parseInline(src, opts) {
152
161
  if (m.index > last) out.push({ type: "text", text: text.slice(last, m.index) });
153
162
  if (m[1]) out.push({ type: "code", text: m[2].trim() ? m[2].replace(/^ (.*) $/, "$1") : m[2] });
154
163
  else if (m[4] !== undefined) {
155
- const href = safeHref(m[4]);
164
+ const href = httpsOnly ? null : safeHref(m[4]);
156
165
  out.push(href ? { type: "image", alt: m[3], href } : { type: "text", text: m[0] });
157
166
  } else if (m[6] !== undefined) {
158
- const href = safeHref(m[6]);
167
+ const href = linkHref(m[6]);
159
168
  out.push(href ? { type: "link", href, children: parseInline(m[5], opts) } : { type: "text", text: m[5] });
160
169
  } else if (m[7] !== undefined || m[8] !== undefined) out.push({ type: "bold", children: parseInline(m[7] ?? m[8], opts) });
161
170
  else if (m[9] !== undefined) out.push({ type: "strike", children: parseInline(m[9], opts) });
162
171
  else if (m[10] !== undefined || m[11] !== undefined) out.push({ type: "italic", children: parseInline(m[10] ?? m[11], opts) });
172
+ else if (m[12] && httpsOnly && !safeHttpsHref(m[12])) out.push({ type: "text", text: m[12] });
163
173
  else if (m[12]) out.push({ type: "link", href: m[12], children: [{ type: "text", text: m[12] }] });
164
174
  else if (m[13] !== undefined) {
165
175
  const link = parsePageLink(m[13]);
@@ -204,7 +214,7 @@ function pageLinks(src) {
204
214
 
205
215
  // The app's own elements (props.render): image(node, key), link(node, key, children), pagelink(node, key). A function
206
216
  // that returns undefined leaves the building block's own element.
207
- const Ctx = React.createContext({ render: {}, opts: null });
217
+ const Ctx = React.createContext({ render: {}, opts: null, anchors: true });
208
218
 
209
219
  function own(ctx, kind, args) {
210
220
  const fn = ctx.render && ctx.render[kind];
@@ -266,8 +276,9 @@ const CALLOUT_ICON = { note: "Info", tip: "Info", important: "Info", warning: "A
266
276
 
267
277
  function Blocks(props) {
268
278
  const L = props.labels;
279
+ const anchors = React.useContext(Ctx).anchors;
269
280
  return h(React.Fragment, null, props.blocks.map((b, i) => {
270
- if (b.type === "heading") return h("h" + b.level, { key: i, id: headingId(b.text), className: "scalio-md-h" + b.level }, inline(b.text));
281
+ if (b.type === "heading") return h("h" + b.level, { key: i, id: anchors ? headingId(b.text) : undefined, className: "scalio-md-h" + b.level }, inline(b.text));
271
282
  if (b.type === "code") return h("pre", { key: i, "data-lang": b.lang || undefined, className: "scalio-md-pre" }, b.text);
272
283
  if (b.type === "rule") return h("hr", { key: i, className: "scalio-md-rule" });
273
284
  if (b.type === "list") return h(List, { key: i, list: b });
@@ -290,11 +301,15 @@ function Blocks(props) {
290
301
 
291
302
  // <Markdown text="..." lang="de" /> shows the text; labels.markdown overrides the callout titles. pageLinks reads
292
303
  // [[...]] as page links; render = {image, link, pagelink} puts the app's own elements in (Folio: images of the space,
293
- // router links, resolved page links).
304
+ // router links, resolved page links). links="https" (AI texts): only https links, images stay text; anchors={false}:
305
+ // headings without an id (several answers on one page).
294
306
  function Markdown(props) {
295
307
  const L = Object.assign({}, labelsFor(props.lang).markdown, props.labels);
296
- const ctx = React.useMemo(() => ({ render: props.render || {}, opts: props.pageLinks ? { pageLinks: true } : null }),
297
- [props.render, props.pageLinks]);
308
+ const httpsOnly = props.links === "https";
309
+ const ctx = React.useMemo(() => {
310
+ const opts = props.pageLinks || httpsOnly ? { pageLinks: !!props.pageLinks, httpsOnly } : null;
311
+ return { render: props.render || {}, opts, anchors: props.anchors !== false };
312
+ }, [props.render, props.pageLinks, httpsOnly, props.anchors]);
298
313
  return h(Ctx.Provider, { value: ctx },
299
314
  h("div", { className: "scalio-md" + (props.className ? " " + props.className : ""), "data-testid": props.testId },
300
315
  h(Blocks, { blocks: parseBlocks(props.text), labels: L })));
@@ -310,4 +325,5 @@ module.exports = {
310
325
  markdownPageLinkKey: pageLinkKey,
311
326
  parseMarkdownPageLink: parsePageLink,
312
327
  safeHref,
328
+ safeHttpsHref,
313
329
  };