@mirrordown/remd-tabs 0.1.2 → 0.2.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/CHANGELOG.md CHANGED
@@ -2,6 +2,43 @@
2
2
 
3
3
 
4
4
 
5
+
6
+
7
+ ## 0.2.0
8
+ <sub>2026-10-28</sub>
9
+
10
+ - *(minor)*
11
+ Make `mdit-tabs` and `remd-tabs` render identical HTML. `remd-tabs` no longer drops a depth-skipping header line (`% Tab One` followed by `%%% Too Deep`) and pulls the following content into the previous tab: the skipped-depth line now ends the group and renders as an ordinary paragraph, and a depth-1 header after it starts a new group, as in `mdit-tabs`. `remd-tabs` also splits a tab header that a nested blockquote lazily absorbed (`> > quote` followed by `% Tab Two`), which previously merged the next tab into the quote. `mdit-tabs` now emits the radio inputs' `hidden` and `checked` attributes bare, as `remd-tabs` does, instead of `hidden=""` and `checked=""`.
12
+ - *(minor)*
13
+ Tab labels behave the same in every engine:
14
+
15
+ - `remd-tabs` keeps a tab's label in the tree, as a `tabsLabel` node that is the first child of each `tabsItem` (the `label` field is gone), so remark plugins that run after it also apply to the label, and a panel's `aria-label` is the label's final text.
16
+ - `data-tabs-group` hashes each label's plain text without a trailing attrs block, as the tabs specification describes. `mdit-tabs` hashed the raw markdown, so labels with links, images, entities or escapes got different ids in markdown-it and remark; labels with a trailing `{…}` change id in both.
17
+ - `mdit-tabs` escapes a panel's `aria-label` once: `npm & yarn` rendered as `aria-label="npm &amp;amp; yarn"`.
18
+ - `mdit-tabs` nests its panel tokens inside the tabs tokens, so `mdit-sectionize` no longer opens a `<section>` around a heading in a tab panel that closed outside the panel.
19
+ - *(minor)*
20
+ Tab groups nested in step bodies and other containers work in every engine:
21
+
22
+ - Block ids (the radio `name` and input ids) number the document's tab groups in the order they open, combined with the group id, instead of hashing a start line that nested groups don't reliably have. Two groups with the same labels in different steps shared radio names, so the first loaded with no panel open and the second's tabs switched the first. Ids of the first group on a page are unchanged; later groups' ids change. Core exports `tabsBlockId`, and `TabsListNode` no longer carries a `blockId`.
23
+ - `mdit-tabs` keeps a group together across blank lines inside a container (a step body, tab panel, blockquote or list item) when another entry follows, as `remd-tabs` does: the empty `>` lines between entries are the container's own. At the top level a blank line still ends a group.
24
+ - *(patch)*
25
+ A tab header written right after nested tab content (`> > Option C body.` then `% Code`) starts a tab in the outer group in every engine. CommonMark lazily continues the nested paragraph with it, so the remark and Sätteri plugins put it in the inner group (the tabs guide's own "Default open tab" demo showed `Code` beside `Option C`); they now read the source's `>` markers as markdown-it does, keeping the header at the depth it was written with and the blockquote structure of the lines after it. `processTabs` takes the document's source for this; the marker handling is shared with steps.
26
+ - *(patch)*
27
+ A tab header that skips a level no longer loses content in the remark and Sätteri plugins, which dropped it and its body; they now render it as `mdit-tabs` does. In a tab's explicit `> %` body it stays in that panel as text, after any group nested there; in a group of plain `>` bodies it ends the group, and it and the lines after it follow the group as ordinary content, with the blockquotes their `>` markers give. A panel's content now also renders in document order in both plugins, rather than its body before its nested groups.
28
+ - *(patch)*
29
+ Paragraphs in tab panels and step bodies keep what they had when recognition splits them around a header:
30
+
31
+ - A hard break (`line\` then `more`) stays a `<br>` in `remd-tabs`, `remd-steps`, `sat-tabs` and `sat-steps`; it became a plain line break, unlike in `mdit-tabs` and `mdit-steps`.
32
+ - Text split around a header keeps its source position, and the lines left together are one text node again, as remark gives them.
33
+ - In `sat-tabs` and `sat-steps`, a paragraph keeps the attributes Sätteri read from its end. A header right after a panel's last paragraph continues that paragraph in CommonMark, so Sätteri saw the paragraph's attribute block mid-paragraph; with Sätteri's `attributes` feature on, the plugins now place that block once the header is split off, where Sätteri would have.
34
+ - `mdit-tabs` and `mdit-steps` give the panel's opening token its body as `meta.attrsSource`, since the tokens inside index the body's lines, so `mdit-attrs` can read a line's indentation there.
35
+
36
+ ## 0.1.3
37
+ <sub>2026-06-28</sub>
38
+
39
+ - *(patch)*
40
+ Improve JSR package scores: add package descriptions, document all exported symbols (JSDoc), add READMEs for the inline-svg packages, clear slow-type errors on the exported hast handlers, and trim internal regex constants from the public API.
41
+
5
42
  ## 0.1.2
6
43
  <sub>2026-06-28</sub>
7
44
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @mirrordown/remd-tabs
2
2
 
3
- > Part of [Mirrordown](https://github.com/mirrordown/mirrordown) — a suite of markdown syntax extensions for the unified and markdown-it ecosystems.
3
+ > Part of [Mirrordown](https://github.com/mirrordown/mirrordown) — a suite of markdown syntax extensions for the unified, markdown-it and Sätteri ecosystems.
4
4
 
5
5
  A remark/rehype (unified) plugin for the `tabs` syntax extension.
6
6
 
@@ -21,20 +21,15 @@ Write a `% Label` line followed by a `>` blockquote for each tab's content:
21
21
 
22
22
  ````markdown
23
23
  % JavaScript
24
-
25
24
  > ```js
26
25
  > console.log("Hello, world!");
27
26
  > ```
28
- >
29
- > % TypeScript
30
- >
27
+ % TypeScript
31
28
  > ```ts
32
29
  > const greeting: string = "Hello, world!";
33
30
  > console.log(greeting);
34
31
  > ```
35
- >
36
- > % Python
37
- >
32
+ % Python
38
33
  > ```py
39
34
  > print("Hello, world!")
40
35
  > ```
@@ -44,15 +39,14 @@ Write a `% Label` line followed by a `>` blockquote for each tab's content:
44
39
 
45
40
  Mark a tab with `%+` to make it open by default (the first tab is open by default otherwise):
46
41
 
47
- ```markdown
42
+ ````markdown
48
43
  % Option A
49
-
50
44
  > This tab is not selected by default.
51
- > %+ Option B
45
+ %+ Option B
52
46
  > This tab opens by default.
53
- > % Option C
47
+ % Option C
54
48
  > This tab is not selected by default.
55
- ```
49
+ ````
56
50
 
57
51
  ### Nested tabs
58
52
 
@@ -61,20 +55,16 @@ Use `%%` for a second level of nesting inside a tab:
61
55
  ````markdown
62
56
  % Frontend
63
57
  %% React
64
-
65
58
  > ```tsx
66
59
  > export function App() {
67
60
  > return <h1>Hello</h1>;
68
61
  > }
69
62
  > ```
70
- >
71
- > %% Vue
72
- >
63
+ %% Vue
73
64
  > ```vue
74
65
  > <template><h1>Hello</h1></template>
75
66
  > ```
76
- >
77
- > % Backend
67
+ % Backend
78
68
  > Node.js or any server runtime.
79
69
  ````
80
70
 
@@ -114,24 +104,8 @@ import "@mirrordown/remd-tabs/tabs.css";
114
104
  export default defineConfig({
115
105
  markdown: {
116
106
  remarkPlugins: [remarkTabs],
117
- remarkRehype: { handlers: tabsHastHandlers }
118
- }
119
- });
120
- ```
121
-
122
- ### VitePress
123
-
124
- ```ts
125
- // .vitepress/config.ts
126
- import { defineConfig } from "vitepress";
127
- import { remarkTabs, tabsHastHandlers } from "@mirrordown/remd-tabs";
128
- import "@mirrordown/remd-tabs/tabs.css";
129
-
130
- export default defineConfig({
131
- markdown: {
132
- remarkPlugins: [remarkTabs],
133
- remarkRehype: { handlers: tabsHastHandlers }
134
- }
107
+ remarkRehype: { handlers: tabsHastHandlers },
108
+ },
135
109
  });
136
110
  ```
137
111
 
package/dist/index.d.mts CHANGED
@@ -1,9 +1,23 @@
1
+ import { TabsItemNode, TabsLabelNode, TabsListNode } from "@mirrordown/core";
1
2
  import { Plugin } from "unified";
2
- import { BlockContent, Definition, DefinitionContent, FootnoteDefinition, Nodes, Parents, PhrasingContent, Root } from "mdast";
3
+ import { Definition, FootnoteDefinition, Nodes, Parents, Root } from "mdast";
3
4
  import { Data, Element, ElementContent, Literal, Nodes as Nodes$1, Properties, RootContent, Text } from "hast";
4
5
  import { Node, Point, Position } from "unist";
5
-
6
- //#region ../../node_modules/vfile-message/lib/index.d.ts
6
+ /** Options for the {@link remarkTabs} plugin. */
7
+ interface TabsOptions {
8
+ /** Class applied to the tabs container element (default `markdown-tabs`). */
9
+ containerClass?: string;
10
+ }
11
+ declare module "mdast" {
12
+ interface RootContentMap {
13
+ tabsList: TabsListNode;
14
+ tabsItem: TabsItemNode;
15
+ tabsLabel: TabsLabelNode;
16
+ }
17
+ interface BlockContentMap {
18
+ tabsList: TabsListNode;
19
+ }
20
+ }
7
21
  /**
8
22
  * Message.
9
23
  */
@@ -509,11 +523,7 @@ type Options$3 = {
509
523
  */
510
524
  source?: string | null | undefined;
511
525
  };
512
- //#endregion
513
- //#region ../../node_modules/vfile-message/index.d.ts
514
526
  type Options$2 = Options$3;
515
- //#endregion
516
- //#region ../../node_modules/vfile/lib/index.d.ts
517
527
  declare class VFile {
518
528
  /**
519
529
  * Create a new virtual file.
@@ -1969,10 +1979,8 @@ type NodeLike = object & {
1969
1979
  type: string;
1970
1980
  position?: Position | undefined;
1971
1981
  };
1972
- //#endregion
1973
- //#region ../../node_modules/vfile/index.d.ts
1974
1982
  // See: <https://github.com/sindresorhus/type-fest/blob/main/source/empty-object.d.ts>
1975
- declare const emptyObjectSymbol: unique symbol; // To do: next major: remove.
1983
+ declare const emptyObjectSymbol: unique symbol;
1976
1984
  /**
1977
1985
  * Things that can be passed to the constructor.
1978
1986
  */
@@ -2086,8 +2094,6 @@ interface Options$1 {
2086
2094
  * Can either be text or a `Uint8Array` structure.
2087
2095
  */
2088
2096
  type Value = Uint8Array | string;
2089
- //#endregion
2090
- //#region ../../node_modules/mdast-util-to-hast/lib/state.d.ts
2091
2097
  /**
2092
2098
  * Handle a node.
2093
2099
  */
@@ -2283,8 +2289,6 @@ type State = {
2283
2289
  */
2284
2290
  wrap: <Type extends RootContent>(nodes: Array<Type>, loose?: boolean | undefined) => Array<Text | Type>;
2285
2291
  };
2286
- //#endregion
2287
- //#region ../../node_modules/mdast-util-to-hast/lib/footer.d.ts
2288
2292
  /**
2289
2293
  * Generate content for the backreference dynamically.
2290
2294
  *
@@ -2329,8 +2333,6 @@ type FootnoteBackContentTemplate = (referenceIndex: number, rereferenceIndex: nu
2329
2333
  * `charlie`, as it is the second used definition
2330
2334
  */
2331
2335
  type FootnoteBackLabelTemplate = (referenceIndex: number, rereferenceIndex: number) => string;
2332
- //#endregion
2333
- //#region ../../node_modules/mdast-util-to-hast/index.d.ts
2334
2336
  /**
2335
2337
  * Raw string of HTML embedded into HTML AST.
2336
2338
  */
@@ -2370,7 +2372,8 @@ declare module 'hast' {
2370
2372
  */
2371
2373
  raw: Raw;
2372
2374
  }
2373
- } // Register data on mdast.
2375
+ }
2376
+ // Register data on mdast.
2374
2377
  declare module 'mdast' {
2375
2378
  interface Data {
2376
2379
  /**
@@ -2399,52 +2402,9 @@ declare module 'mdast' {
2399
2402
  hProperties?: Properties | undefined;
2400
2403
  }
2401
2404
  }
2402
- //#endregion
2403
- //#region src/types.d.ts
2404
- interface TabsOptions {
2405
- containerClass?: string;
2406
- }
2407
- interface TabsListNode {
2408
- type: "tabsList";
2409
- depth: number;
2410
- containerClass?: string;
2411
- groupId: string;
2412
- blockId: string;
2413
- children: TabsItemNode[];
2414
- data?: {
2415
- attrsRole?: string;
2416
- hProperties?: Properties;
2417
- };
2418
- }
2419
- interface TabsItemNode {
2420
- type: "tabsItem";
2421
- depth: number;
2422
- label: PhrasingContent[];
2423
- labelText: string;
2424
- open: boolean;
2425
- children: Array<BlockContent | DefinitionContent | TabsListNode>;
2426
- data?: {
2427
- attrsRole?: string;
2428
- attrsTitle?: PhrasingContent[];
2429
- attrsItemTitle?: boolean;
2430
- hProperties?: Properties;
2431
- };
2432
- }
2433
- declare module "mdast" {
2434
- interface RootContentMap {
2435
- tabsList: TabsListNode;
2436
- tabsItem: TabsItemNode;
2437
- }
2438
- interface BlockContentMap {
2439
- tabsList: TabsListNode;
2440
- }
2441
- } //# sourceMappingURL=types.d.ts.map
2442
- //#endregion
2443
- //#region src/index.d.ts
2444
- declare const remarkTabs: Plugin<[TabsOptions?], Root>;
2445
- declare const tabsHastHandlers: {
2446
- readonly tabsList: (state: State, node: TabsListNode) => ElementContent;
2447
- };
2448
- //#endregion
2449
- export { type TabsOptions, remarkTabs, tabsHastHandlers };
2405
+ /** remark plugin for tabbed content blocks, rendered via {@link tabsHastHandlers}. */
2406
+ export declare const remarkTabs: Plugin<[TabsOptions?], Root>;
2407
+ /** mdast-to-hast handler for tabs nodes, for use with `remark-rehype`. */
2408
+ export declare const tabsHastHandlers: Record<string, Handler>;
2409
+ export type { TabsOptions };
2450
2410
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":["VFileMessage","Options","Node","NodeLike","Point","Position","Error","Array","constructor","reason","options","parent","origin","place","cause","ancestors","column","fatal","file","line","ruleId","source","actual","expected","note","url","type","position","VFileMessage","Options","_$__lib_index_js0","VFile","Compatible","Data","Array","VFileMessage","Value","Map","URL","MessageOptions","Node","NodeLike","Point","Position","Error","constructor","value","cwd","data","history","messages","map","result","stored","basename","path","dirname","extname","stem","fail","reason","options","parent","origin","place","cause","info","message","toString","encoding","type","position","Options","VFile","emptyObjectSymbol","Options","MessageOptions","Compatible","VFileCompatible","DataMap","VFileDataMap","Data","VFileData","VFileOptions","ReporterSettings","VFileReporterSettings","Reporter","VFileReporter","Value","VFileValue","URL","Map","Array","file","mappings","names","sourcesContent","sourceRoot","sources","version","Record","Partial","key","basename","cwd","data","dirname","extname","history","path","stem","value","Settings","files","options","Uint8Array","createState","MdastNodes","Options","State","tree","options","wrap","Type","HastRootContent","Array","HastText","nodes","loose","Handler","MdastParents","HastElementContent","state","node","parent","Handlers","Record","Partial","VFile","FootnoteBackContentTemplate","FootnoteBackLabelTemplate","HastProperties","allowDangerousHtml","clobberPrefix","file","footnoteBackContent","footnoteBackLabel","footnoteLabel","footnoteLabelProperties","footnoteLabelTagName","handlers","passThrough","unknownHandler","HastNodes","HastElement","MdastDefinition","Map","MdastFootnoteDefinition","all","applyData","from","to","definitionById","footnoteById","footnoteCounts","footnoteOrder","one","patch","Nodes","RootContent","Text","Parents","ElementContent","Properties","Element","Definition","FootnoteDefinition","defaultFootnoteBackContent","ElementContent","Array","_","rereferenceIndex","defaultFootnoteBackLabel","referenceIndex","footer","State","Element","state","FootnoteBackContentTemplate","FootnoteBackLabelTemplate","Data","ElementContent","Literal","Properties","FootnoteBackContentTemplate","FootnoteBackLabelTemplate","Handler","Handlers","Options","State","handlers","defaultHandlers","defaultFootnoteBackContent","defaultFootnoteBackLabel","toHast","Raw","RawData","type","data","_0","ElementData","meta","ElementContentMap","raw","RootContentMap","sideEffect","_1","hChildren","hName","hProperties"],"sources":["../../../node_modules/vfile-message/lib/index.d.ts","../../../node_modules/vfile-message/index.d.ts","../../../node_modules/vfile/lib/index.d.ts","../../../node_modules/vfile/index.d.ts","../../../node_modules/mdast-util-to-hast/lib/state.d.ts","../../../node_modules/mdast-util-to-hast/lib/footer.d.ts","../../../node_modules/mdast-util-to-hast/index.d.ts","../src/types.ts","../src/index.ts"],"x_google_ignoreList":[0,1,2,3,4,5,6],"mappings":";;;;;;;;;cAGaA,YAAAA,SAAqBM,KAAAA;;;AAAlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDIE,WAAAA,CAAYC,MAAAA,UAAgBC,OAAAA,GAAUT,SAAAA;EA4N+CW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsMzF;;;;;;;;;AAOA;;;;;;;;;;;EAlXIJ,WAAAA,CAAYC,MAAAA,UAAgBE,MAAAA,EAAQT,IAAAA,GAAOC,UAAAA,qBAA6BS,MAAAA;EAsXtDV;;;;;;;;;;;;;ACtetB;;;;;;;;ACDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EFwKIM,WAAAA,CAAYC,MAAAA,UAAgBI,KAAAA,EAAOT,KAAAA,GAAQC,QAAAA,qBAA6BO,MAAAA;EEqqBduB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EF9mB1D3B,WAAAA,CAAYC,MAAAA,UAAgBG,MAAAA;EE9HxB0C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EFqLJ9C,WAAAA,CAAYM,KAAAA,EAAOR,KAAAA,GAAQN,YAAAA,EAAcW,MAAAA,EAAQT,IAAAA,GAAOC,UAAAA,qBAA6BS,MAAAA;EE2UnDmD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAA;EACf,IAAA;EACA,KAAA;EACA,KAAA,EAAO,eAAA;EACP,SAAA;EACA,IAAA;EACA,QAAA,EAAU,KAAA,CAAM,YAAA,GAAe,iBAAA,GAAoB,YAAA;EACnD,IAAA;IACE,SAAA;IACA,UAAA,GAAa,eAAA;IACb,cAAA;IACA,WAAA,GAAc,UAAA;EAAA;AAAA;AAAA;EAAA,UAMN,cAAA;IACR,QAAA,EAAU,YAAA;IACV,QAAA,EAAU,YAAA;EAAA;EAAA,UAEF,eAAA;IACR,QAAA,EAAU,YAAA;EAAA;AAAA;;;cC0iBD,UAAA,EAAY,MAAA,EAAQ,WAAA,IAAe,IAAA;AAAA,cAyJnC,gBAAA;EAAA,2BACK,KAAA,EAAK,IAAA,EAAQ,YAAA,KAAe,cAAA;AAAA"}
1
+ {"version":3,"file":"index.d.mts","names":["_0","Options","NodeLike","Options","_$__lib_index_js0.Options","Data","Map","MessageOptions","Options","Map","Data","MdastParents","HastElementContent","MdastNodes","HastProperties","HastNodes","HastElement","MdastDefinition","MdastFootnoteDefinition","HastRootContent","HastText"],"sources":["../src/types.ts","../src/augment.ts","../../../node_modules/vfile-message/lib/index.d.ts","../../../node_modules/vfile-message/index.d.ts","../../../node_modules/vfile/lib/index.d.ts","../../../node_modules/vfile/index.d.ts","../../../node_modules/mdast-util-to-hast/lib/state.d.ts","../../../node_modules/mdast-util-to-hast/lib/footer.d.ts","../../../node_modules/mdast-util-to-hast/index.d.ts","../src/plugin.ts"],"ignoreList":[2,3,4,5,6,7,8],"mappings":";;;;;;UAOiB;;EAEf;;;YCHU;IACR,UAAU;IACV,UAAU;IACV,WAAW;;YAEH;IACR,UAAU;;;;;;cCTD,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuD9B,YAAY,gBAAgB,UAAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDtC,YAAY,gBAAgB,QAA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,aAAaI,aAAiB,OAAO,MAAM,OAAO,gCAAgC,MAAMC,OAAW;;;;;;;;;;;;;;;;;;;;;;;KCnKlG,+BAA+B,wBAAwB,6BAA6B,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;KAsB5G,6BAA6B,wBAAwB;;;;UCxDhD,YAAY;;;;EAI3B;;;;EAKA,OAAO;;;;;UAMQ,gBAAgB;;;YAIrB;;;;;;IAMR;;YAGQ;;;;IAIR,KAAK;;YAGG;;;;IAIR,KAAK;;;;;YAMG;;;;;;;;IAQR,YAAY;;;;;;;;IASZ;;;;;;;;IASA,cAAc;;;;qBCzEL,YAAY,QAAQ,eAAe;;qBAuJnC,kBAAkB,eAAe"}
package/dist/index.mjs CHANGED
@@ -1,370 +1,10 @@
1
- import { visit } from "unist-util-visit";
2
- //#region src/utils.ts
3
- const TAB_HEADER_RE = /^(%{1,6})(\+)? (.*)/;
4
- const parseTabHeader = (line) => {
5
- const m = TAB_HEADER_RE.exec(line);
6
- if (!m) return null;
7
- return {
8
- depth: m[1].length,
9
- open: m[2] === "+",
10
- label: m[3]
11
- };
12
- };
13
- const djb2 = (str) => {
14
- let h = 5381;
15
- for (let i = 0; i < str.length; i++) h = (h << 5) + h + str.charCodeAt(i) >>> 0;
16
- return h;
17
- };
18
- const stripAttrs = (text) => text.replace(/\s*\{[^}]*\}\s*$/, "").trimEnd();
19
- const slugify = (text) => text.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_]+/g, "-").replace(/^-+|-+$/g, "");
20
- const groupId = (labels) => {
21
- return djb2([...labels].map(slugify).sort().join("-")).toString(16);
22
- };
23
- const blockId = (startLine, gId) => {
24
- return "tabs-" + djb2(`${startLine}:${gId}`).toString(16);
25
- };
26
- //#endregion
27
- //#region src/index.ts
28
- const paraToLines = (para) => {
29
- const segs = [];
30
- for (const child of para.children) if (child.type === "text") {
31
- const parts = child.value.split("\n");
32
- for (let p = 0; p < parts.length; p++) {
33
- if (p > 0) segs.push(null);
34
- if (parts[p] !== "") segs.push({
35
- type: "text",
36
- value: parts[p]
37
- });
38
- }
39
- } else if (child.type === "break") segs.push(null);
40
- else segs.push(child);
41
- const lines = [[]];
42
- for (const seg of segs) if (seg === null) lines.push([]);
43
- else lines[lines.length - 1].push(seg);
44
- return lines;
45
- };
46
- const toPlainText = (nodes) => nodes.map((n) => {
47
- if (n.type === "text" || n.type === "inlineCode") return "value" in n ? n.value : "";
48
- if ("children" in n) return toPlainText(n.children);
49
- return "";
50
- }).join("");
51
- const extractHeaderPara = (para, requireDepthOne = true, prevDepth = 0) => {
52
- const lines = paraToLines(para);
53
- const tabs = [];
54
- let currentDepth = prevDepth;
55
- for (const lineSegs of lines) {
56
- const first = lineSegs[0];
57
- if (first?.type !== "text") return null;
58
- const header = parseTabHeader(first.value);
59
- if (!header) return null;
60
- const { depth, open } = header;
61
- if (tabs.length === 0 && requireDepthOne && depth !== 1) return null;
62
- if (depth > currentDepth + 1) break;
63
- currentDepth = depth;
64
- const labelText = header.label;
65
- const labelNodes = labelText ? [{
66
- type: "text",
67
- value: labelText
68
- }, ...lineSegs.slice(1)] : lineSegs.slice(1);
69
- tabs.push({
70
- depth,
71
- open,
72
- labelNodes,
73
- labelText: toPlainText(labelNodes),
74
- body: []
75
- });
76
- }
77
- return tabs.length > 0 ? tabs : null;
78
- };
79
- const isExplicitBQ = (bq) => bq.children.some((child) => {
80
- if (child.type !== "paragraph") return false;
81
- const first = child.children[0];
82
- return first?.type === "text" && parseTabHeader(first.value.split("\n")[0]) !== null;
83
- });
84
- const extractTrailingTabHeader = (node) => {
85
- const path = [];
86
- let current = node;
87
- while ("children" in current && current.children.length > 0) {
88
- const last = current.children[current.children.length - 1];
89
- if (last.type === "paragraph") {
90
- path.push(current);
91
- const lines = paraToLines(last);
92
- const lastLine = lines[lines.length - 1];
93
- if (!lastLine) return null;
94
- const first = lastLine[0];
95
- if (first?.type !== "text") return null;
96
- const header = parseTabHeader(first.value);
97
- if (!header) return null;
98
- const labelText = header.label;
99
- const labelNodes = labelText ? [{
100
- type: "text",
101
- value: labelText
102
- }, ...lastLine.slice(1)] : lastLine.slice(1);
103
- return {
104
- header: {
105
- depth: header.depth,
106
- open: header.open,
107
- labelNodes,
108
- labelText: toPlainText(labelNodes),
109
- body: []
110
- },
111
- truncatedPara: buildParagraph(lines.slice(0, -1)),
112
- path
113
- };
114
- }
115
- if (!("children" in last)) break;
116
- path.push(current);
117
- current = last;
118
- }
119
- return null;
120
- };
121
- const splitBlockquote = (bq, explicit) => {
122
- const segments = [];
123
- let currentSegment = {
124
- header: null,
125
- body: [],
126
- explicit
127
- };
128
- for (const child of bq.children) {
129
- if (child.type !== "paragraph") {
130
- const extracted = extractTrailingTabHeader(child);
131
- if (extracted) {
132
- const cloned = JSON.parse(JSON.stringify(child));
133
- let target = cloned;
134
- for (let pi = 1; pi < extracted.path.length; pi++) target = target.children[target.children.length - 1];
135
- const deepestParent = target;
136
- if (extracted.truncatedPara) deepestParent.children[deepestParent.children.length - 1] = extracted.truncatedPara;
137
- else deepestParent.children.splice(deepestParent.children.length - 1, 1);
138
- currentSegment.body.push(cloned);
139
- segments.push(currentSegment);
140
- currentSegment = {
141
- header: extracted.header,
142
- body: [],
143
- explicit
144
- };
145
- } else currentSegment.body.push(child);
146
- continue;
147
- }
148
- const lines = paraToLines(child);
149
- let bodyLines = [];
150
- for (const lineSegs of lines) {
151
- const first = lineSegs[0];
152
- if (first?.type === "text") {
153
- const header = parseTabHeader(first.value);
154
- if (header) {
155
- if (bodyLines.length > 0) {
156
- const bodyPara = buildParagraph(bodyLines);
157
- if (bodyPara) currentSegment.body.push(bodyPara);
158
- bodyLines = [];
159
- }
160
- segments.push(currentSegment);
161
- const labelText = header.label;
162
- const labelNodes = labelText ? [{
163
- type: "text",
164
- value: labelText
165
- }, ...lineSegs.slice(1)] : lineSegs.slice(1);
166
- currentSegment = {
167
- header: {
168
- depth: header.depth,
169
- open: header.open,
170
- labelNodes,
171
- labelText: toPlainText(labelNodes),
172
- body: []
173
- },
174
- body: [],
175
- explicit
176
- };
177
- continue;
178
- }
179
- }
180
- bodyLines.push(lineSegs);
181
- }
182
- if (bodyLines.length > 0) {
183
- const bodyPara = buildParagraph(bodyLines);
184
- if (bodyPara) currentSegment.body.push(bodyPara);
185
- }
186
- }
187
- segments.push(currentSegment);
188
- return segments;
189
- };
190
- const buildParagraph = (lines) => {
191
- const children = [];
192
- for (let i = 0; i < lines.length; i++) {
193
- if (i > 0) children.push({
194
- type: "text",
195
- value: "\n"
196
- });
197
- children.push(...lines[i]);
198
- }
199
- if (children.length === 0) return null;
200
- return {
201
- type: "paragraph",
202
- children
203
- };
204
- };
205
- const buildTree = (rawTabs, targetDepth, start, end, containerClass, startLine) => {
206
- const gId = groupId(rawTabs.slice(start, end).filter((t) => t.depth === targetDepth).map((t) => t.labelText));
207
- const bId = blockId(startLine, gId);
208
- const explicitOpenIdx = rawTabs.slice(start, end).findIndex((t) => t.depth === targetDepth && t.open);
209
- const explicitOpenAbsIdx = explicitOpenIdx >= 0 ? start + explicitOpenIdx : -1;
210
- const items = [];
211
- let tabCounter = 0;
212
- let i = start;
213
- while (i < end) {
214
- const raw = rawTabs[i];
215
- if (raw.depth !== targetDepth) {
216
- i++;
217
- continue;
218
- }
219
- let childEnd = i + 1;
220
- while (childEnd < end && rawTabs[childEnd].depth > targetDepth) childEnd++;
221
- const isOpen = explicitOpenAbsIdx >= 0 ? i === explicitOpenAbsIdx : tabCounter === 0;
222
- const bodyChildren = [...raw.body];
223
- if (rawTabs.slice(i + 1, childEnd).some((t) => t.depth === targetDepth + 1)) {
224
- const nested = buildTree(rawTabs, targetDepth + 1, i + 1, childEnd, containerClass, startLine);
225
- nested.containerClass = containerClass;
226
- bodyChildren.push(nested);
227
- }
228
- items.push({
229
- type: "tabsItem",
230
- depth: targetDepth,
231
- label: raw.labelNodes,
232
- labelText: raw.labelText,
233
- open: isOpen,
234
- children: bodyChildren,
235
- data: {
236
- attrsRole: "containerItem",
237
- attrsTitle: raw.labelNodes,
238
- attrsItemTitle: true,
239
- hProperties: {}
240
- }
241
- });
242
- tabCounter++;
243
- i = childEnd;
244
- }
245
- return {
246
- type: "tabsList",
247
- depth: targetDepth,
248
- groupId: gId,
249
- blockId: bId,
250
- children: items,
251
- data: {
252
- attrsRole: "container",
253
- hProperties: {}
254
- }
255
- };
256
- };
257
- const processTabsInChildren = (children, containerClass, checkBlankLines = true) => {
258
- const newChildren = [];
259
- let i = 0;
260
- while (i < children.length) {
261
- const node = children[i];
262
- if (node.type === "paragraph") {
263
- const headerTabs = extractHeaderPara(node);
264
- if (headerTabs && headerTabs.length > 0) {
265
- const rawTabs = [...headerTabs];
266
- const startLine = (node.position?.start.line ?? 1) - 1;
267
- let j = i + 1;
268
- let currentTabIdx = rawTabs.length - 1;
269
- let prevEndLine = node.position?.end.line ?? 0;
270
- while (j < children.length) {
271
- const sibling = children[j];
272
- const siblingStartLine = sibling.position?.start.line ?? prevEndLine + 1;
273
- if (checkBlankLines && siblingStartLine > prevEndLine + 1) break;
274
- if (sibling.type === "blockquote") {
275
- const bq = sibling;
276
- const explicit = isExplicitBQ(bq);
277
- const segments = splitBlockquote(bq, explicit);
278
- const firstSeg = segments[0];
279
- if (firstSeg?.header === null) rawTabs[currentTabIdx].body.push(...firstSeg.body);
280
- const depthOffset = explicit ? rawTabs[rawTabs.length - 1].depth : 0;
281
- for (let s = 1; s < segments.length; s++) {
282
- const seg = segments[s];
283
- if (!seg.header) continue;
284
- const adjustedDepth = depthOffset + seg.header.depth;
285
- if (adjustedDepth > rawTabs[rawTabs.length - 1].depth + 1) continue;
286
- seg.header.depth = adjustedDepth;
287
- if (explicit) {
288
- const deferredInnerSegs = [];
289
- const escapedSegs = [];
290
- for (const b of seg.body) {
291
- if (b.type !== "blockquote") {
292
- if (escapedSegs.length > 0) escapedSegs[escapedSegs.length - 1].body.push(b);
293
- else seg.header.body.push(b);
294
- continue;
295
- }
296
- const innerBq = b;
297
- if (!isExplicitBQ(innerBq)) {
298
- const innerSegs = splitBlockquote(innerBq, false);
299
- const innerFirst = innerSegs[0];
300
- if (innerFirst?.header === null) seg.header.body.push(...innerFirst.body);
301
- for (let is = 1; is < innerSegs.length; is++) {
302
- const innerSeg = innerSegs[is];
303
- if (!innerSeg.header) continue;
304
- if (innerSeg.body.length === 0) {
305
- innerSeg.header.depth = depthOffset;
306
- escapedSegs.push(innerSeg.header);
307
- deferredInnerSegs.push(innerSeg);
308
- continue;
309
- }
310
- const tentativeDepth = depthOffset + innerSeg.header.depth;
311
- if (tentativeDepth > rawTabs[rawTabs.length - 1].depth + 1) continue;
312
- innerSeg.header.depth = tentativeDepth;
313
- innerSeg.header.body.push(...innerSeg.body);
314
- deferredInnerSegs.push(innerSeg);
315
- }
316
- } else seg.header.body.push(...innerBq.children);
317
- }
318
- rawTabs.push(seg.header);
319
- currentTabIdx = rawTabs.length - 1;
320
- for (const innerSeg of deferredInnerSegs) {
321
- if (!innerSeg.header) continue;
322
- rawTabs.push(innerSeg.header);
323
- currentTabIdx = rawTabs.length - 1;
324
- }
325
- } else {
326
- seg.header.body.push(...seg.body);
327
- rawTabs.push(seg.header);
328
- currentTabIdx = rawTabs.length - 1;
329
- }
330
- }
331
- prevEndLine = sibling.position?.end.line ?? prevEndLine;
332
- j++;
333
- } else if (sibling.type === "paragraph") {
334
- const prevDepth = rawTabs[rawTabs.length - 1].depth;
335
- const contHeaders = extractHeaderPara(sibling, false, prevDepth);
336
- if (contHeaders && contHeaders.length > 0) {
337
- rawTabs.push(...contHeaders);
338
- currentTabIdx = rawTabs.length - 1;
339
- prevEndLine = sibling.position?.end.line ?? prevEndLine;
340
- j++;
341
- continue;
342
- }
343
- break;
344
- } else break;
345
- }
346
- const list = buildTree(rawTabs, 1, 0, rawTabs.length, containerClass, startLine);
347
- list.containerClass = containerClass;
348
- newChildren.push(list);
349
- i = j;
350
- continue;
351
- }
352
- }
353
- newChildren.push(node);
354
- i++;
355
- }
356
- children.splice(0, children.length, ...newChildren);
357
- };
1
+ import { processTabs, stripAttrs, tabLabelText, tabsBlockId } from "@mirrordown/core";
2
+ // src/plugin.ts
3
+ /** remark plugin for tabbed content blocks, rendered via {@link tabsHastHandlers}. */
358
4
  const remarkTabs = function(options = {}) {
359
5
  const { containerClass = "markdown-tabs" } = options;
360
- return (tree) => {
361
- processTabsInChildren(tree.children, containerClass);
362
- visit(tree, (node) => {
363
- if ("children" in node && node.type !== "root") {
364
- const parent = node;
365
- if (parent.children.length > 0) processTabsInChildren(parent.children, containerClass, false);
366
- }
367
- });
6
+ return (tree, file) => {
7
+ processTabs(tree, containerClass, String(file));
368
8
  };
369
9
  };
370
10
  const mergeHProperties = (base, extra) => {
@@ -377,15 +17,20 @@ const mergeHProperties = (base, extra) => {
377
17
  if (extraClass) result.class = base.class ? `${String(base.class)} ${String(extraClass)}` : extraClass;
378
18
  return result;
379
19
  };
20
+ const groupsRendered = /* @__PURE__ */ new WeakMap();
380
21
  const buildTabsHast = (list, containerClass, state) => {
22
+ const index = groupsRendered.get(state) ?? 0;
23
+ groupsRendered.set(state, index + 1);
24
+ const blockId = tabsBlockId(index, list.groupId);
381
25
  const labelChildren = [];
382
26
  const panelChildren = [];
383
27
  list.children.forEach((item, idx) => {
384
- const labelPlain = stripAttrs(item.labelText);
385
- const inputId = `${list.blockId}-${idx}`;
28
+ const label = item.children.find((c) => c.type === "tabsLabel")?.children ?? [];
29
+ const labelPlain = stripAttrs(tabLabelText(label));
30
+ const inputId = `${blockId}-${idx}`;
386
31
  const inputProps = {
387
32
  type: "radio",
388
- name: list.blockId,
33
+ name: blockId,
389
34
  id: inputId,
390
35
  hidden: true,
391
36
  ...item.open ? { checked: true } : {}
@@ -406,17 +51,26 @@ const buildTabsHast = (list, containerClass, state) => {
406
51
  properties: labelProps,
407
52
  children: state.all({
408
53
  type: "paragraph",
409
- children: item.label
54
+ children: label
410
55
  })
411
56
  });
412
- const bodyBlocks = item.children.filter((c) => c.type !== "tabsList");
413
- const nestedLists = item.children.filter((c) => c.type === "tabsList");
414
57
  const sectionChildren = [];
415
- if (bodyBlocks.length > 0) sectionChildren.push(...state.all({
416
- type: "root",
417
- children: bodyBlocks
418
- }));
419
- for (const nested of nestedLists) sectionChildren.push(buildTabsHast(nested, nested.containerClass ?? containerClass, state));
58
+ let blocks = [];
59
+ const flush = () => {
60
+ if (blocks.length > 0) sectionChildren.push(...state.all({
61
+ type: "root",
62
+ children: blocks
63
+ }));
64
+ blocks = [];
65
+ };
66
+ for (const child of item.children) {
67
+ if (child.type === "tabsLabel") continue;
68
+ if (child.type === "tabsList") {
69
+ flush();
70
+ sectionChildren.push(buildTabsHast(child, child.containerClass ?? containerClass, state));
71
+ } else blocks.push(child);
72
+ }
73
+ flush();
420
74
  const sectionProps = mergeHProperties({
421
75
  class: `${containerClass}-panel`,
422
76
  "aria-label": labelPlain
@@ -452,10 +106,11 @@ const buildTabsHast = (list, containerClass, state) => {
452
106
  state.patch(list, result);
453
107
  return result;
454
108
  };
109
+ /** mdast-to-hast handler for tabs nodes, for use with `remark-rehype`. */
455
110
  const tabsHastHandlers = { tabsList(state, node) {
456
- return buildTabsHast(node, node.containerClass ?? "markdown-tabs", state);
111
+ const containerClass = node.containerClass ?? "markdown-tabs";
112
+ return buildTabsHast(node, containerClass, state);
457
113
  } };
458
- //#endregion
459
114
  export { remarkTabs, tabsHastHandlers };
460
115
 
461
116
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["para"],"sources":["../src/utils.ts","../src/index.ts"],"sourcesContent":["// Matches: %{1,6}+? label text (prefix-plus form: %+ Label)\n// Groups: 1=% string (depth), 2=+ (open marker, optional), 3=label text\nexport const TAB_HEADER_RE = /^(%{1,6})(\\+)? (.*)/;\n\n// Matches: > or ><space> continuation line\nexport const CONTINUATION_RE = /^> ?/;\n\nexport interface ParsedTabHeader {\n depth: number;\n open: boolean;\n label: string;\n}\n\nexport const parseTabHeader = (line: string): ParsedTabHeader | null => {\n const m = TAB_HEADER_RE.exec(line);\n if (!m) return null;\n return { depth: m[1].length, open: m[2] === \"+\", label: m[3] };\n};\n\nexport const stripContinuation = (line: string): string =>\n line.replace(/^> ?/, \"\");\n\n// djb2 hash — returns an unsigned 32-bit integer\nconst djb2 = (str: string): number => {\n let h = 5381;\n for (let i = 0; i < str.length; i++) {\n h = ((h << 5) + h + str.charCodeAt(i)) >>> 0;\n }\n return h;\n};\n\n// Strip a trailing attrs block like {.class #id} from plain label text.\nexport const stripAttrs = (text: string): string =>\n text.replace(/\\s*\\{[^}]*\\}\\s*$/, \"\").trimEnd();\n\nexport const slugify = (text: string): string =>\n text\n .toLowerCase()\n .trim()\n .replace(/[^\\w\\s-]/g, \"\")\n .replace(/[\\s_]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n\n// content-based: same label set → same id regardless of page position\nexport const groupId = (labels: string[]): string => {\n const key = [...labels].map(slugify).sort().join(\"-\");\n return djb2(key).toString(16);\n};\n\n// position-based: unique per block even when label sets match\nexport const blockId = (startLine: number, gId: string): string => {\n const key = `${startLine}:${gId}`;\n return \"tabs-\" + djb2(key).toString(16);\n};\n","// This plugin performs heavy tree-rewriting across mdast/hast/unist types\n// that don't unify cleanly; type assertions bridging those boundaries are\n// reviewed and intentional, so the rule is disabled file-wide rather than\n// per-cast. Defensive optional chains on array[i] accesses are also kept\n// because TS doesn't model index access as fallible (noUncheckedIndexedAccess\n// is off project-wide).\n/* oxlint-disable typescript/no-unsafe-type-assertion */\n/* oxlint-disable typescript/no-unnecessary-condition */\nimport { visit } from \"unist-util-visit\";\nimport type { Plugin } from \"unified\";\nimport type {\n Root,\n Paragraph,\n Blockquote,\n PhrasingContent,\n BlockContent,\n DefinitionContent,\n RootContent\n} from \"mdast\";\nimport type { Element, ElementContent, Properties } from \"hast\";\nimport type { Parent } from \"unist\";\nimport type { State } from \"mdast-util-to-hast\";\nimport type { TabsOptions, TabsListNode, TabsItemNode } from \"./types.js\";\nimport { parseTabHeader, stripAttrs, groupId, blockId } from \"./utils.js\";\n\nexport type { TabsOptions };\n\n// ── Raw extraction types ──────────────────────────────────────────────────────\n\ninterface RawTab {\n depth: number;\n open: boolean;\n labelNodes: PhrasingContent[]; // inline nodes for the label\n labelText: string; // plain text for aria-label / data-tab\n body: Array<BlockContent | DefinitionContent>; // blockquote contents\n}\n\n// ── Paragraph line splitting ──────────────────────────────────────────────────\n\n// Split a paragraph's inline children into lines by text \"\\n\" boundaries.\nconst paraToLines = (para: Paragraph): PhrasingContent[][] => {\n type Seg = PhrasingContent | null;\n const segs: Seg[] = [];\n\n for (const child of para.children) {\n if (child.type === \"text\") {\n const parts = child.value.split(\"\\n\");\n for (let p = 0; p < parts.length; p++) {\n if (p > 0) segs.push(null);\n if (parts[p] !== \"\") segs.push({ type: \"text\", value: parts[p] });\n }\n } else if (child.type === \"break\") {\n segs.push(null);\n } else {\n segs.push(child);\n }\n }\n\n const lines: PhrasingContent[][] = [[]];\n for (const seg of segs) {\n if (seg === null) lines.push([]);\n else lines[lines.length - 1].push(seg);\n }\n return lines;\n};\n\n// Extract plain text from PhrasingContent nodes (strips all markup)\nconst toPlainText = (nodes: PhrasingContent[]): string =>\n nodes\n .map((n) => {\n if (n.type === \"text\" || n.type === \"inlineCode\")\n return \"value\" in n ? n.value : \"\";\n if (\"children\" in n) return toPlainText(n.children);\n return \"\";\n })\n .join(\"\");\n\n// ── Tab group extraction ──────────────────────────────────────────────────────\n\n// Parse a paragraph node that consists entirely of % tab headers (no body\n// content). Returns null if the paragraph isn't all headers.\n// requireDepthOne: if true, the first header must be depth 1 (top-level group start).\n// If false, allows any starting depth (for continuation paragraphs).\nconst extractHeaderPara = (\n para: Paragraph,\n requireDepthOne = true,\n prevDepth = 0\n): RawTab[] | null => {\n const lines = paraToLines(para);\n const tabs: RawTab[] = [];\n let currentDepth = prevDepth;\n\n for (const lineSegs of lines) {\n const first = lineSegs[0];\n if (first?.type !== \"text\") return null;\n\n const header = parseTabHeader(first.value);\n if (!header) return null;\n\n const { depth, open } = header;\n if (tabs.length === 0 && requireDepthOne && depth !== 1) return null;\n if (depth > currentDepth + 1) break;\n currentDepth = depth;\n\n const labelText = header.label;\n const labelNodes: PhrasingContent[] = labelText\n ? [{ type: \"text\", value: labelText }, ...lineSegs.slice(1)]\n : lineSegs.slice(1);\n\n tabs.push({\n depth,\n open,\n labelNodes,\n labelText: toPlainText(labelNodes),\n body: []\n });\n }\n\n return tabs.length > 0 ? tabs : null;\n};\n\n// Split a blockquote node into segments separated by % tab header lines.\n// Each segment is { header: RawTab | null, body: blockquote-like children }.\n//\n// Remark absorbs adjacent non-blank lines into a blockquote, so:\n// % Tab One\n// > Content for tab one.\n// % Tab Two\n// > Content for tab two.\n//\n// Produces: paragraph(\"% Tab One\") + blockquote containing:\n// paragraph(\"Content for tab one.\\n% Tab Two\\nContent for tab two.\")\n//\n// We need to split that paragraph on lines matching tab headers, then\n// reconstruct the body content for each segment.\ninterface BQSegment {\n header: RawTab | null; // null means pre-header content (goes to prev tab)\n body: Array<BlockContent | DefinitionContent>;\n // true when this blockquote was written with explicit `> %` nesting (multiple\n // block children) rather than being the standard absorbed-tabs pattern where\n // remark collapses consecutive `% Tab\\n> body` lines into one blockquote.\n // Used to apply a depth offset and to unwrap nested blockquote bodies.\n explicit: boolean;\n}\n\n// A blockquote is \"explicit\" (`> % Label` nesting) when at least one of its\n// direct paragraph children starts with a tab header. The absorbed pattern\n// (remark collapsing consecutive `% Tab\\n> body` lines into one blockquote)\n// never produces standalone header paragraphs — headers are only embedded\n// inside multi-line text nodes.\nconst isExplicitBQ = (bq: Blockquote): boolean =>\n bq.children.some((child) => {\n if (child.type !== \"paragraph\") return false;\n const first = child.children[0];\n return (\n first?.type === \"text\" &&\n parseTabHeader(first.value.split(\"\\n\")[0]) !== null\n );\n });\n\n// Walk to the deepest last child of a node and return its paragraph if it\n// has a trailing tab header line, along with the truncated paragraph and the\n// extracted RawTab header. Returns null if no trailing tab header is found.\n// This handles cases where remark plugins (e.g. remarkDefinitionList) transform\n// absorbed paragraphs into custom nodes — the trailing \"% Code\" line ends up\n// inside a nested paragraph rather than at the blockquote's top level.\nconst extractTrailingTabHeader = (\n node: BlockContent | DefinitionContent\n): {\n header: RawTab;\n truncatedPara: Paragraph | null;\n path: Array<BlockContent | DefinitionContent>;\n} | null => {\n // Walk to the deepest last child that is a paragraph\n const path: Array<BlockContent | DefinitionContent> = [];\n let current: BlockContent | DefinitionContent = node;\n while (\"children\" in current && current.children.length > 0) {\n const last = current.children[current.children.length - 1] as\n | BlockContent\n | DefinitionContent;\n if (last.type === \"paragraph\") {\n path.push(current);\n // Check if this paragraph's last line is a tab header\n const para = last;\n const lines = paraToLines(para);\n const lastLine = lines[lines.length - 1];\n if (!lastLine) return null;\n const first = lastLine[0];\n if (first?.type !== \"text\") return null;\n const header = parseTabHeader(first.value);\n if (!header) return null;\n const labelText = header.label;\n const labelNodes: PhrasingContent[] = labelText\n ? [{ type: \"text\", value: labelText }, ...lastLine.slice(1)]\n : lastLine.slice(1);\n const rawTab: RawTab = {\n depth: header.depth,\n open: header.open,\n labelNodes,\n labelText: toPlainText(labelNodes),\n body: []\n };\n // Build truncated paragraph without the last line\n const truncatedLines = lines.slice(0, -1);\n const truncatedPara = buildParagraph(truncatedLines);\n return { header: rawTab, truncatedPara, path };\n }\n if (!(\"children\" in last)) break;\n path.push(current);\n current = last;\n }\n return null;\n};\n\nconst splitBlockquote = (bq: Blockquote, explicit: boolean): BQSegment[] => {\n const segments: BQSegment[] = [];\n let currentSegment: BQSegment = { header: null, body: [], explicit };\n\n for (const child of bq.children) {\n if (child.type !== \"paragraph\") {\n // For non-paragraph children (e.g. defList from remarkDefinitionList),\n // check if the deepest last-child paragraph has a trailing tab header.\n // Remark may have absorbed a \"% NextTab\" line into that nested paragraph.\n const extracted = extractTrailingTabHeader(\n child as BlockContent | DefinitionContent\n );\n if (extracted) {\n // Clone the child with the trailing header line removed from its nested paragraph\n const cloned = JSON.parse(JSON.stringify(child)) as\n | BlockContent\n | DefinitionContent;\n // Navigate to the deepest last child and replace the paragraph.\n // Tree walking through heterogeneous mdast Parent shapes — no narrow\n // type fits all the intermediate nodes we descend through.\n interface ParentLike {\n children: ParentLike[];\n }\n let target: ParentLike = cloned as unknown as ParentLike;\n for (let pi = 1; pi < extracted.path.length; pi++) {\n target = target.children[target.children.length - 1];\n }\n const deepestParent = target as unknown as Parent;\n if (extracted.truncatedPara) {\n deepestParent.children[deepestParent.children.length - 1] =\n extracted.truncatedPara;\n } else {\n deepestParent.children.splice(deepestParent.children.length - 1, 1);\n }\n currentSegment.body.push(cloned);\n // Start a new segment for the extracted tab header\n segments.push(currentSegment);\n currentSegment = { header: extracted.header, body: [], explicit };\n } else {\n currentSegment.body.push(child as BlockContent);\n }\n continue;\n }\n\n // Check if this paragraph contains tab headers mixed with body text\n const lines = paraToLines(child);\n let bodyLines: PhrasingContent[][] = [];\n\n for (const lineSegs of lines) {\n const first = lineSegs[0];\n if (first?.type === \"text\") {\n const header = parseTabHeader(first.value);\n if (header) {\n // Flush accumulated body lines into current segment\n if (bodyLines.length > 0) {\n const bodyPara = buildParagraph(bodyLines);\n if (bodyPara) currentSegment.body.push(bodyPara);\n bodyLines = [];\n }\n\n // Save current segment, start a new one\n segments.push(currentSegment);\n\n const labelText = header.label;\n const labelNodes: PhrasingContent[] = labelText\n ? [{ type: \"text\", value: labelText }, ...lineSegs.slice(1)]\n : lineSegs.slice(1);\n\n currentSegment = {\n header: {\n depth: header.depth,\n open: header.open,\n labelNodes,\n labelText: toPlainText(labelNodes),\n body: []\n },\n body: [],\n explicit\n };\n continue;\n }\n }\n bodyLines.push(lineSegs);\n }\n\n // Flush remaining body lines\n if (bodyLines.length > 0) {\n const bodyPara = buildParagraph(bodyLines);\n if (bodyPara) currentSegment.body.push(bodyPara);\n }\n }\n\n segments.push(currentSegment);\n return segments;\n};\n\n// Reconstruct a paragraph node from line arrays\nconst buildParagraph = (lines: PhrasingContent[][]): Paragraph | null => {\n const children: PhrasingContent[] = [];\n for (let i = 0; i < lines.length; i++) {\n if (i > 0) children.push({ type: \"text\", value: \"\\n\" });\n children.push(...lines[i]);\n }\n if (children.length === 0) return null;\n return { type: \"paragraph\", children };\n};\n\n// ── Tree builder ──────────────────────────────────────────────────────────────\n\nconst buildTree = (\n rawTabs: RawTab[],\n targetDepth: number,\n start: number,\n end: number,\n containerClass: string,\n startLine: number\n): TabsListNode => {\n const depthLabels = rawTabs\n .slice(start, end)\n .filter((t) => t.depth === targetDepth)\n .map((t) => t.labelText);\n\n const gId = groupId(depthLabels);\n const bId = blockId(startLine, gId);\n\n // Absolute index of the first %+ tab at this depth (-1 if none)\n const explicitOpenIdx = rawTabs\n .slice(start, end)\n .findIndex((t) => t.depth === targetDepth && t.open);\n const explicitOpenAbsIdx =\n explicitOpenIdx >= 0 ? start + explicitOpenIdx : -1;\n\n const items: TabsItemNode[] = [];\n let tabCounter = 0;\n let i = start;\n\n while (i < end) {\n const raw = rawTabs[i];\n if (raw.depth !== targetDepth) {\n i++;\n continue;\n }\n\n let childEnd = i + 1;\n while (childEnd < end && rawTabs[childEnd].depth > targetDepth) childEnd++;\n\n // First %+ wins; if none, first tab is open\n const isOpen =\n explicitOpenAbsIdx >= 0 ? i === explicitOpenAbsIdx : tabCounter === 0;\n const bodyChildren: TabsItemNode[\"children\"] = [...raw.body];\n\n const hasDeeper = rawTabs\n .slice(i + 1, childEnd)\n .some((t) => t.depth === targetDepth + 1);\n\n if (hasDeeper) {\n const nested = buildTree(\n rawTabs,\n targetDepth + 1,\n i + 1,\n childEnd,\n containerClass,\n startLine\n );\n nested.containerClass = containerClass;\n bodyChildren.push(nested as unknown as BlockContent);\n }\n\n items.push({\n type: \"tabsItem\",\n depth: targetDepth,\n label: raw.labelNodes,\n labelText: raw.labelText,\n open: isOpen,\n children: bodyChildren,\n data: {\n attrsRole: \"containerItem\",\n attrsTitle: raw.labelNodes,\n attrsItemTitle: true,\n hProperties: {}\n }\n });\n\n tabCounter++;\n i = childEnd;\n }\n\n return {\n type: \"tabsList\",\n depth: targetDepth,\n groupId: gId,\n blockId: bId,\n children: items,\n data: { attrsRole: \"container\", hProperties: {} }\n };\n};\n\n// ── Remark plugin ─────────────────────────────────────────────────────────────\n\n// Process all tab groups found in a children array in-place.\n// Used at root level and recursively inside any parent node's children.\n// checkBlankLines: when false, skip the line-gap termination check (for nested contexts\n// where blank lines inside blockquotes produce position gaps but are still part of the group).\nconst processTabsInChildren = (\n children: Array<BlockContent | DefinitionContent | RootContent>,\n containerClass: string,\n checkBlankLines = true\n): void => {\n const newChildren: typeof children = [];\n let i = 0;\n\n while (i < children.length) {\n const node = children[i];\n\n if (node.type === \"paragraph\") {\n const headerTabs = extractHeaderPara(node);\n\n if (headerTabs && headerTabs.length > 0) {\n const rawTabs: RawTab[] = [...headerTabs];\n const startLine = (node.position?.start.line ?? 1) - 1;\n let j = i + 1;\n let currentTabIdx = rawTabs.length - 1;\n let prevEndLine = node.position?.end.line ?? 0;\n\n while (j < children.length) {\n const sibling = children[j];\n const siblingStartLine =\n (sibling as { position?: { start: { line: number } } }).position\n ?.start.line ?? prevEndLine + 1;\n\n if (checkBlankLines && siblingStartLine > prevEndLine + 1) break;\n\n if (sibling.type === \"blockquote\") {\n const bq = sibling;\n const explicit = isExplicitBQ(bq);\n const segments = splitBlockquote(bq, explicit);\n\n const firstSeg = segments[0];\n if (firstSeg?.header === null) {\n rawTabs[currentTabIdx].body.push(...firstSeg.body);\n }\n\n // Explicit blockquotes (`> % Label` nesting) have their headers\n // implicitly one level deeper than the owning tab. Apply a depth\n // offset so they nest correctly.\n // Absorbed blockquotes (standard `% Tab\\n> body` pattern) keep\n // literal depths — remark collapses them into a single paragraph child.\n const depthOffset = explicit\n ? rawTabs[rawTabs.length - 1].depth\n : 0;\n\n for (let s = 1; s < segments.length; s++) {\n const seg = segments[s];\n if (!seg.header) continue;\n\n const adjustedDepth = depthOffset + seg.header.depth;\n const prevDepth = rawTabs[rawTabs.length - 1].depth;\n if (adjustedDepth > prevDepth + 1) continue;\n\n seg.header.depth = adjustedDepth;\n\n if (explicit) {\n // For explicit `> %` blockquotes, body items are wrapped in a\n // nested `> >` blockquote. Unwrap each nested blockquote:\n // - Non-explicit (absorbed) inner BQs are re-split to extract\n // tab headers that remark collapsed into a single paragraph.\n // - Explicit inner BQs use their children directly.\n //\n // \"Escaped\" segments: when remark absorbs an outer-level tab header\n // (e.g. `% Code` at root depth) into an inner BQ paragraph, the tab's\n // body node (code fence etc.) is hoisted to the outer BQ as a direct\n // child after that inner BQ. Re-split segments with an empty body had\n // their body hoisted — they are outer-level siblings, not inner children.\n // Subsequent non-blockquote nodes in seg.body belong to those escaped tabs.\n const deferredInnerSegs: BQSegment[] = [];\n // Tracks which re-split segments have empty bodies (body hoisted to outer BQ)\n const escapedSegs: RawTab[] = [];\n\n for (const b of seg.body) {\n if (b.type !== \"blockquote\") {\n // Non-BQ outer sibling — belongs to the first escaped seg's body\n if (escapedSegs.length > 0) {\n escapedSegs[escapedSegs.length - 1].body.push(\n b as BlockContent | DefinitionContent\n );\n } else {\n seg.header.body.push(\n b as BlockContent | DefinitionContent\n );\n }\n continue;\n }\n const innerBq = b;\n if (!isExplicitBQ(innerBq)) {\n // Re-split absorbed inner blockquote to extract sibling headers\n const innerSegs = splitBlockquote(innerBq, false);\n const innerFirst = innerSegs[0];\n if (innerFirst?.header === null) {\n seg.header.body.push(...innerFirst.body);\n }\n for (let is = 1; is < innerSegs.length; is++) {\n const innerSeg = innerSegs[is];\n if (!innerSeg.header) continue;\n // If the re-split segment has no body, its body was hoisted to\n // the outer BQ as a direct child — it is an outer-level escaped\n // tab (originally root-level, absorbed by remark into this inner BQ).\n // Push it at depthOffset (the owning explicit BQ's parent depth).\n if (innerSeg.body.length === 0) {\n innerSeg.header.depth = depthOffset;\n escapedSegs.push(innerSeg.header);\n deferredInnerSegs.push(innerSeg);\n continue;\n }\n const tentativeDepth =\n depthOffset + innerSeg.header.depth;\n const innerPrevDepth = rawTabs[rawTabs.length - 1].depth;\n if (tentativeDepth > innerPrevDepth + 1) continue;\n innerSeg.header.depth = tentativeDepth;\n innerSeg.header.body.push(...innerSeg.body);\n deferredInnerSegs.push(innerSeg);\n }\n } else {\n // Explicit inner blockquote — use children directly\n seg.header.body.push(...innerBq.children);\n }\n }\n // Push the current seg first, then any deferred inner siblings\n rawTabs.push(seg.header);\n currentTabIdx = rawTabs.length - 1;\n for (const innerSeg of deferredInnerSegs) {\n if (!innerSeg.header) continue;\n rawTabs.push(innerSeg.header);\n currentTabIdx = rawTabs.length - 1;\n }\n } else {\n seg.header.body.push(...seg.body);\n rawTabs.push(seg.header);\n currentTabIdx = rawTabs.length - 1;\n }\n }\n\n prevEndLine = sibling.position?.end.line ?? prevEndLine;\n j++;\n } else if (sibling.type === \"paragraph\") {\n const prevDepth = rawTabs[rawTabs.length - 1].depth;\n const contHeaders = extractHeaderPara(sibling, false, prevDepth);\n if (contHeaders && contHeaders.length > 0) {\n rawTabs.push(...contHeaders);\n currentTabIdx = rawTabs.length - 1;\n prevEndLine = sibling.position?.end.line ?? prevEndLine;\n j++;\n continue;\n }\n break;\n } else {\n break;\n }\n }\n\n const list = buildTree(\n rawTabs,\n 1,\n 0,\n rawTabs.length,\n containerClass,\n startLine\n );\n list.containerClass = containerClass;\n newChildren.push(list as unknown as RootContent);\n i = j;\n continue;\n }\n }\n\n newChildren.push(node);\n i++;\n }\n\n children.splice(0, children.length, ...newChildren);\n};\n\nexport const remarkTabs: Plugin<[TabsOptions?], Root> = function (\n options = {}\n) {\n const { containerClass = \"markdown-tabs\" } = options;\n\n return (tree) => {\n // Process tabs at root level first\n processTabsInChildren(tree.children, containerClass);\n\n // Then visit every parent node whose children may contain tab syntax —\n // this handles tabs nested inside step bodies or other block containers.\n // Blank-line position checks are disabled for nested content: blank lines\n // inside a blockquote produce position gaps that would incorrectly terminate\n // a tab group when the content has been lifted out of its blockquote context.\n visit(tree, (node) => {\n if (\"children\" in node && node.type !== \"root\") {\n const parent = node as {\n children: Array<BlockContent | DefinitionContent>;\n };\n if (parent.children.length > 0) {\n processTabsInChildren(parent.children, containerClass, false);\n }\n }\n });\n };\n};\n\n// ── HAST handlers ─────────────────────────────────────────────────────────────\n\nconst mergeHProperties = (base: Properties, extra?: Properties): Properties => {\n if (!extra) return base;\n const { class: extraClass, ...rest } = extra;\n const result: Properties = { ...base, ...rest };\n if (extraClass)\n result.class = base.class\n ? `${String(base.class)} ${String(extraClass)}`\n : extraClass;\n return result;\n};\n\nconst buildTabsHast = (\n list: TabsListNode,\n containerClass: string,\n state: State\n): Element => {\n const labelChildren: ElementContent[] = [];\n const panelChildren: ElementContent[] = [];\n\n list.children.forEach((item, idx) => {\n const labelPlain = stripAttrs(item.labelText);\n const inputId = `${list.blockId}-${idx}`;\n\n // <input type=\"radio\">\n const inputProps: Properties = {\n type: \"radio\",\n name: list.blockId,\n id: inputId,\n hidden: true,\n ...(item.open ? { checked: true } : {})\n };\n labelChildren.push({\n type: \"element\",\n tagName: \"input\",\n properties: inputProps,\n children: []\n });\n\n // <label>\n const labelProps = mergeHProperties(\n { class: `${containerClass}-label`, for: inputId },\n item.data?.hProperties\n );\n labelChildren.push({\n type: \"element\",\n tagName: \"label\",\n properties: labelProps,\n children: state.all({\n type: \"paragraph\",\n children: item.label\n } as Parameters<typeof state.all>[0])\n });\n\n // Panel body and nested lists\n const bodyBlocks = item.children.filter(\n (c) => (c as { type: string }).type !== \"tabsList\"\n );\n const nestedLists = item.children.filter(\n (c) => (c as { type: string }).type === \"tabsList\"\n ) as unknown as TabsListNode[];\n\n const sectionChildren: ElementContent[] = [];\n\n if (bodyBlocks.length > 0) {\n sectionChildren.push(\n ...state.all({\n type: \"root\",\n children: bodyBlocks\n } as Parameters<typeof state.all>[0])\n );\n }\n\n for (const nested of nestedLists) {\n sectionChildren.push(\n buildTabsHast(nested, nested.containerClass ?? containerClass, state)\n );\n }\n\n // <section>\n const sectionProps = mergeHProperties(\n { class: `${containerClass}-panel`, \"aria-label\": labelPlain },\n undefined\n );\n panelChildren.push({\n type: \"element\",\n tagName: \"section\",\n properties: sectionProps,\n children: sectionChildren\n });\n });\n\n // <div class=\"...-labels\">\n const labelsDiv: Element = {\n type: \"element\",\n tagName: \"div\",\n properties: { class: `${containerClass}-labels` },\n children: labelChildren\n };\n\n // <div class=\"...-panels\">\n const panelsDiv: Element = {\n type: \"element\",\n tagName: \"div\",\n properties: { class: `${containerClass}-panels` },\n children: panelChildren\n };\n\n // <div> container\n const divProps = mergeHProperties(\n { class: containerClass, \"data-tabs-group\": list.groupId },\n list.data?.hProperties\n );\n\n const result: Element = {\n type: \"element\",\n tagName: \"div\",\n properties: divProps,\n children: [labelsDiv, panelsDiv]\n };\n\n state.patch(list as unknown as Parameters<typeof state.patch>[0], result);\n return result;\n};\n\nexport const tabsHastHandlers = {\n tabsList(state: State, node: TabsListNode): ElementContent {\n const containerClass = node.containerClass ?? \"markdown-tabs\";\n return buildTabsHast(node, containerClass, state);\n }\n} as const;\n"],"mappings":";;AAEA,MAAa,gBAAgB;AAW7B,MAAa,kBAAkB,SAAyC;CACtE,MAAM,IAAI,cAAc,KAAK,KAAK;AAClC,KAAI,CAAC,EAAG,QAAO;AACf,QAAO;EAAE,OAAO,EAAE,GAAG;EAAQ,MAAM,EAAE,OAAO;EAAK,OAAO,EAAE;EAAI;;AAOhE,MAAM,QAAQ,QAAwB;CACpC,IAAI,IAAI;AACR,MAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,IAC9B,MAAM,KAAK,KAAK,IAAI,IAAI,WAAW,EAAE,KAAM;AAE7C,QAAO;;AAIT,MAAa,cAAc,SACzB,KAAK,QAAQ,oBAAoB,GAAG,CAAC,SAAS;AAEhD,MAAa,WAAW,SACtB,KACG,aAAa,CACb,MAAM,CACN,QAAQ,aAAa,GAAG,CACxB,QAAQ,WAAW,IAAI,CACvB,QAAQ,YAAY,GAAG;AAG5B,MAAa,WAAW,WAA6B;AAEnD,QAAO,KADK,CAAC,GAAG,OAAO,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,KAAK,IAClC,CAAC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WACzC;EACD,MAAM,cAAc,KAAK,SAAS,QAC/B,MAAO,EAAuB,SAAS,WACzC;EAED,MAAM,kBAAoC,EAAE;AAE5C,MAAI,WAAW,SAAS,EACtB,iBAAgB,KACd,GAAG,MAAM,IAAI;GACX,MAAM;GACN,UAAU;GACX,CAAoC,CACtC;AAGH,OAAK,MAAM,UAAU,YACnB,iBAAgB,KACd,cAAc,QAAQ,OAAO,kBAAkB,gBAAgB,MAAM,CACtE;EAIH,MAAM,eAAe,iBACnB;GAAE,OAAO,GAAG,eAAe;GAAS,cAAc;GAAY,EAC9D,KAAA,EACD;AACD,gBAAc,KAAK;GACjB,MAAM;GACN,SAAS;GACT,YAAY;GACZ,UAAU;GACX,CAAC;GACF;CAGF,MAAM,YAAqB;EACzB,MAAM;EACN,SAAS;EACT,YAAY,EAAE,OAAO,GAAG,eAAe,UAAU;EACjD,UAAU;EACX;CAGD,MAAM,YAAqB;EACzB,MAAM;EACN,SAAS;EACT,YAAY,EAAE,OAAO,GAAG,eAAe,UAAU;EACjD,UAAU;EACX;CAQD,MAAM,SAAkB;EACtB,MAAM;EACN,SAAS;EACT,YARe,iBACf;GAAE,OAAO;GAAgB,mBAAmB,KAAK;GAAS,EAC1D,KAAK,MAAM,YAMS;EACpB,UAAU,CAAC,WAAW,UAAU;EACjC;AAED,OAAM,MAAM,MAAsD,OAAO;AACzE,QAAO;;AAGT,MAAa,mBAAmB,EAC9B,SAAS,OAAc,MAAoC;AAEzD,QAAO,cAAc,MADE,KAAK,kBAAkB,iBACH,MAAM;GAEpD"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/plugin.ts"],"sourcesContent":["// The hast handlers bridge mdast/hast types that don't unify cleanly; the assertions are reviewed and intentional.\n/* oxlint-disable typescript/no-unsafe-type-assertion */\nimport type { Plugin } from \"unified\";\nimport type { Root } from \"mdast\";\nimport type { Element, ElementContent, Properties } from \"hast\";\nimport type { State, Handler } from \"mdast-util-to-hast\";\nimport {\n processTabs,\n stripAttrs,\n tabLabelText,\n tabsBlockId,\n type TabsLabelNode\n} from \"@mirrordown/core\";\nimport type { TabsOptions, TabsListNode } from \"./types.js\";\n\nexport type { TabsOptions };\n\n/** remark plugin for tabbed content blocks, rendered via {@link tabsHastHandlers}. */\nexport const remarkTabs: Plugin<[TabsOptions?], Root> = function (\n options = {}\n) {\n const { containerClass = \"markdown-tabs\" } = options;\n\n // Recognition is shared with the Sätteri plugin through `@mirrordown/core`; it also finds tabs nested inside step bodies and other block containers.\n return (tree, file) => {\n processTabs(tree, containerClass, String(file));\n };\n};\n\n// ── HAST handlers ─────────────────────────────────────────────────────────────\n\nconst mergeHProperties = (base: Properties, extra?: Properties): Properties => {\n if (!extra) return base;\n const { class: extraClass, ...rest } = extra;\n const result: Properties = { ...base, ...rest };\n if (extraClass)\n result.class = base.class\n ? `${String(base.class)} ${String(extraClass)}`\n : extraClass;\n return result;\n};\n\n// Each document's tab groups, counted as they render (in the order they open), for their block ids.\nconst groupsRendered = new WeakMap<State, number>();\n\nconst buildTabsHast = (\n list: TabsListNode,\n containerClass: string,\n state: State\n): Element => {\n const index = groupsRendered.get(state) ?? 0;\n groupsRendered.set(state, index + 1);\n const blockId = tabsBlockId(index, list.groupId);\n const labelChildren: ElementContent[] = [];\n const panelChildren: ElementContent[] = [];\n\n list.children.forEach((item, idx) => {\n const label =\n item.children.find((c): c is TabsLabelNode => c.type === \"tabsLabel\")\n ?.children ?? [];\n // From the label as it is now, so plugins that ran after tabs count too.\n const labelPlain = stripAttrs(tabLabelText(label));\n const inputId = `${blockId}-${idx}`;\n\n // <input type=\"radio\">\n const inputProps: Properties = {\n type: \"radio\",\n name: blockId,\n id: inputId,\n hidden: true,\n ...(item.open ? { checked: true } : {})\n };\n labelChildren.push({\n type: \"element\",\n tagName: \"input\",\n properties: inputProps,\n children: []\n });\n\n // <label>\n const labelProps = mergeHProperties(\n { class: `${containerClass}-label`, for: inputId },\n item.data?.hProperties\n );\n labelChildren.push({\n type: \"element\",\n tagName: \"label\",\n properties: labelProps,\n children: state.all({\n type: \"paragraph\",\n children: label\n })\n });\n\n // Panel body and nested lists\n // The panel's body and nested groups, in order: content can follow a nested group.\n const sectionChildren: ElementContent[] = [];\n let blocks: typeof item.children = [];\n const flush = (): void => {\n if (blocks.length > 0) {\n sectionChildren.push(\n ...state.all({\n type: \"root\",\n children: blocks\n })\n );\n }\n blocks = [];\n };\n for (const child of item.children) {\n if (child.type === \"tabsLabel\") continue;\n if (child.type === \"tabsList\") {\n flush();\n sectionChildren.push(\n buildTabsHast(child, child.containerClass ?? containerClass, state)\n );\n } else {\n blocks.push(child);\n }\n }\n flush();\n\n // <section>\n const sectionProps = mergeHProperties(\n { class: `${containerClass}-panel`, \"aria-label\": labelPlain },\n undefined\n );\n panelChildren.push({\n type: \"element\",\n tagName: \"section\",\n properties: sectionProps,\n children: sectionChildren\n });\n });\n\n // <div class=\"...-labels\">\n const labelsDiv: Element = {\n type: \"element\",\n tagName: \"div\",\n properties: { class: `${containerClass}-labels` },\n children: labelChildren\n };\n\n // <div class=\"...-panels\">\n const panelsDiv: Element = {\n type: \"element\",\n tagName: \"div\",\n properties: { class: `${containerClass}-panels` },\n children: panelChildren\n };\n\n // <div> container\n const divProps = mergeHProperties(\n { class: containerClass, \"data-tabs-group\": list.groupId },\n list.data?.hProperties\n );\n\n const result: Element = {\n type: \"element\",\n tagName: \"div\",\n properties: divProps,\n children: [labelsDiv, panelsDiv]\n };\n\n state.patch(list, result);\n return result;\n};\n\n/** mdast-to-hast handler for tabs nodes, for use with `remark-rehype`. */\nexport const tabsHastHandlers: Record<string, Handler> = {\n tabsList(state: State, node: TabsListNode): ElementContent {\n const containerClass = node.containerClass ?? \"markdown-tabs\";\n return buildTabsHast(node, containerClass, state);\n }\n};\n"],"mappings":";;;AAkBA,MAAa,aAA2C,SACtD,UAAU,CAAC,GACX;CACA,MAAM,EAAE,iBAAiB,oBAAoB;CAG7C,QAAQ,MAAM,SAAS;EACrB,YAAY,MAAM,gBAAgB,OAAO,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oB;GACxB,IAAI,OAAO,SAAS,GAClB,gBAAgB,KACd,GAAG,MAAM,IAAI;IACX,MAAM;IACN,UAAU;GACZ,CAAC,CACH;GAEF,SAAS,CAAC;EACZ;EACA,KAAK,MAAM,SAAS,KAAK,UAAU;GACjC,IAAI,MAAM,SAAS,aAAa;GAChC,IAAI,MAAM,SAAS,YAAY;IAC7B,MAAM;IACN,gBAAgB,KACd,cAAc,OAAO,MAAM,kBAAkB,gBAAgB,KAAK,CACpE;GACF,OACE,OAAO,KAAK,KAAK;EAErB;EACA,MAAM;EAGN,MAAM,eAAe,iBACnB;GAAE,OAAO,GAAG,eAAe;GAAS,cAAc;EAAW,GAC7D,KAAA,CACF;EACA,cAAc,KAAK;GACjB,MAAM;GACN,SAAS;GACT,YAAY;GACZ,UAAU;EACZ,CAAC;CACH,CAAC;CAGD,MAAM,YAAqB;EACzB,MAAM;EACN,SAAS;EACT,YAAY,EAAE,OAAO,GAAG,eAAe,SAAS;EAChD,UAAU;CACZ;CAGA,MAAM,YAAqB;EACzB,MAAM;EACN,SAAS;EACT,YAAY,EAAE,OAAO,GAAG,eAAe,SAAS;EAChD,UAAU;CACZ;CAQA,MAAM,SAAkB;EACtB,MAAM;EACN,SAAS;EACT,YARe,iBACf;GAAE,OAAO;GAAgB,mBAAmB,KAAK;EAAQ,GACzD,KAAK,MAAM,WAMQ;EACnB,UAAU,CAAC,WAAW,SAAS;CACjC;CAEA,MAAM,MAAM,MAAM,MAAM;CACxB,OAAO;AACT;;AAGA,MAAa,mBAA4C,EACvD,SAAS,OAAc,MAAoC;CACzD,MAAM,iBAAiB,KAAK,kBAAkB;CAC9C,OAAO,cAAc,MAAM,gBAAgB,KAAK;AAClD,EACF"}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@mirrordown/remd-tabs",
3
- "version": "0.1.2",
3
+ "description": "A remark plugin for tabbed content blocks.",
4
+ "version": "0.2.0",
4
5
  "license": "MIT",
5
6
  "author": "Drake Costa <drake@saeris.io> (https://saeris.gg)",
6
7
  "repository": {
@@ -21,7 +22,7 @@
21
22
  "./*.css": "./dist/*.css"
22
23
  },
23
24
  "dependencies": {
24
- "unist-util-visit": "^5.1.0"
25
+ "@mirrordown/core": "^0.1.0"
25
26
  },
26
27
  "devDependencies": {
27
28
  "@types/hast": "^3.0.4",
@@ -35,12 +36,11 @@
35
36
  "node": ">=24.0.0"
36
37
  },
37
38
  "bumpy": {
38
- "buildCommand": "vp pack",
39
39
  "publishCommand": [
40
40
  "node ../../scripts/sync-jsr-version.mjs",
41
- "yarn pack -o package.tgz",
42
- "npm publish package.tgz --access public",
43
- "npx jsr publish --allow-dirty --allow-slow-types"
41
+ "node ../../scripts/npm-publish.mjs",
42
+ "node ../../scripts/jsr-resolve-deps.mjs",
43
+ "node ../../scripts/jsr-publish.mjs"
44
44
  ]
45
45
  }
46
46
  }