@usequeek/theme-kit 0.5.13 → 0.5.14

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": "@usequeek/theme-kit",
3
- "version": "0.5.13",
3
+ "version": "0.5.14",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "The runtime a Queek storefront theme is built on: hooks, stores, page renderer, navigation, shared blocks and locale strings.",
@@ -1222,6 +1222,17 @@
1222
1222
  line-height: 1.6;
1223
1223
  }
1224
1224
 
1225
+ /* A formatted answer (markdown): paragraphs and lists sit flush with the answer box, one clear gap between them. The `> :is() + :is()`
1226
+ * selector outranks a theme's bare `.theme-x p { margin: 0 }`, so the gap survives every theme. */
1227
+ .core-block-faq__answer > :is(p, ul, ol) {
1228
+ margin-top: 0;
1229
+ margin-bottom: 0;
1230
+ }
1231
+
1232
+ .core-block-faq__answer > :is(p, ul, ol) + :is(p, ul, ol) {
1233
+ margin-top: 1em;
1234
+ }
1235
+
1225
1236
  /* ── Policies listing (core fallback for /policies) ──────────────
1226
1237
  * Themeable via `.theme-<slug> .core-policies__*` overrides. Pure CSS
1227
1238
  * variables — tint follows the active theme automatically.
@@ -2,6 +2,21 @@
2
2
 
3
3
  import type { JSX } from 'react';
4
4
  import type { FaqBlockData } from '../types/block';
5
+ import { renderMarkdown } from '../utils/markdown';
6
+
7
+ /**
8
+ * An answer carrying formatting (a line break, **bold**, _italic_, a [link](/x) or `code`) renders as markdown: paragraphs and inline
9
+ * emphasis, never raw HTML. A plain answer keeps rendering as the bare text it always did, so no existing store's FAQ markup moves.
10
+ */
11
+ const FORMATTED_ANSWER = /\n|\*|_|\[|`/;
12
+
13
+ function FaqAnswer({ answer }: { answer: unknown }): JSX.Element {
14
+ const text = typeof answer === 'string' ? answer : '';
15
+
16
+ return (
17
+ <div className="core-block-faq__answer">{FORMATTED_ANSWER.test(text) ? renderMarkdown(text) : text}</div>
18
+ );
19
+ }
5
20
 
6
21
  /**
7
22
  * Framework-owned FAQ block. Renders an accessible, SSR-friendly accordion
@@ -36,7 +51,7 @@ export function CoreFaqBlock({ heading, items }: FaqBlockData): JSX.Element | nu
36
51
  <polyline points="6 9 12 15 18 9" />
37
52
  </svg>
38
53
  </summary>
39
- <div className="core-block-faq__answer">{item.answer}</div>
54
+ <FaqAnswer answer={item.answer} />
40
55
  </details>
41
56
  ))}
42
57
  </div>