@airalogy/aimd-renderer 2.7.0 → 2.8.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.
@@ -1,4 +1,4 @@
1
- import { s as T, t as D } from "./processor-BOCQYqXE.js";
1
+ import { s as T, t as D } from "./processor-C_zN3-hL.js";
2
2
  import { defineComponent as B, shallowRef as G, ref as $, watch as K, h as d } from "vue";
3
3
  const F = ["var", "var_table", "step", "check", "quiz"], Y = {
4
4
  file: "FILE",
@@ -7,5 +7,6 @@ export { renderToVue, createRenderer, defaultRenderer, } from '../common/process
7
7
  export { createAimdRendererMessages, DEFAULT_AIMD_RENDERER_LOCALE, resolveAimdRendererLocale, } from '../locales';
8
8
  export type { RenderContext, RenderMode, ProcessorOptions, } from '@airalogy/aimd-core/types';
9
9
  export type { AimdAssignerVisibility, AimdRendererOptions, RenderResult } from '../common/processor';
10
+ export type { AimdAssetUrlResolver, AimdAssetUrlResolveContext, } from '../common/assetUrls';
10
11
  export type { AimdRendererI18nOptions, AimdRendererLocale, AimdRendererMessages, AimdRendererMessagesInput, } from '../locales';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vue/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,SAAS,EACT,cAAc,EACd,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,GACxB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EACL,yBAAyB,EACzB,iCAAiC,EACjC,oCAAoC,EACpC,iCAAiC,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AAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,iCAAiC,EACtC,KAAK,2BAA2B,EAChC,KAAK,mCAAmC,EACxC,KAAK,gCAAgC,EACrC,KAAK,gCAAgC,GACtC,MAAM,4BAA4B,CAAA;AAEnC,OAAO,EACL,WAAW,EACX,cAAc,EACd,eAAe,GAChB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,aAAa,EACb,UAAU,EACV,gBAAgB,GACjB,MAAM,2BAA2B,CAAA;AAElC,YAAY,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACpG,YAAY,EACV,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EACV,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,YAAY,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import type { Element, Root as HastRoot, RootContent } from "hast";
2
2
  import type { Component, VNode, VNodeChild } from "vue";
3
3
  import type { AimdNode, RenderContext } from "@airalogy/aimd-core/types";
4
+ import type { AimdAssetUrlResolver } from "../common/assetUrls";
4
5
  import type { AimdRendererI18nOptions, AimdRendererLocale, AimdRendererMessages } from "../locales";
5
6
  /**
6
7
  * Extended Element data type
@@ -20,6 +21,7 @@ export type ElementRenderer = (node: Element, children: VNodeChild[], ctx: AimdR
20
21
  export interface AimdRendererContext extends RenderContext {
21
22
  locale: AimdRendererLocale;
22
23
  messages: AimdRendererMessages;
24
+ resolveAssetUrl?: AimdAssetUrlResolver;
23
25
  }
24
26
  export interface AimdStepCardRendererOptions {
25
27
  showScopeLabel?: boolean;
@@ -50,7 +52,11 @@ export interface VueRendererOptions {
50
52
  /**
51
53
  * Render context
52
54
  */
53
- context?: RenderContext & Partial<Pick<AimdRendererContext, "locale" | "messages">>;
55
+ context?: RenderContext & Partial<Pick<AimdRendererContext, "locale" | "messages" | "resolveAssetUrl">>;
56
+ /**
57
+ * Resolve protocol-local figure assets to displayable URLs.
58
+ */
59
+ resolveAssetUrl?: AimdAssetUrlResolver;
54
60
  /**
55
61
  * Custom AIMD component renderers
56
62
  * Override default renderers or add new ones
@@ -1 +1 @@
1
- {"version":3,"file":"vue-renderer.d.ts","sourceRoot":"","sources":["../../src/vue/vue-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAoB,WAAW,EAAE,MAAM,MAAM,CAAA;AACpF,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AACvD,OAAO,KAAK,EAAE,QAAQ,EAA8B,aAAa,EAAE,MAAM,2BAA2B,CAAA;AASpG,OAAO,KAAK,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAUnG;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,QAAQ,CAAA;CAChB;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAClC,IAAI,EAAE,QAAQ,EACd,GAAG,EAAE,mBAAmB,EACxB,QAAQ,CAAC,EAAE,UAAU,EAAE,KACpB,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;AAElC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAC5B,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,UAAU,EAAE,EACtB,GAAG,EAAE,mBAAmB,KACrB,KAAK,GAAG,IAAI,CAAA;AAEjB,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,MAAM,EAAE,kBAAkB,CAAA;IAC1B,QAAQ,EAAE,oBAAoB,CAAA;CAC/B;AAED,MAAM,WAAW,2BAA2B;IAC1C,cAAc,CAAC,EAAE,OAAO,CAAA;I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,gBAAgB,CAAC,CAgB3B;AAmGD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,gBAAgB,GAAG,IAAI,GAAG,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,EACtE,cAAc,GAAE,MAAM,GAAG,wBAAmD,GAC3E,eAAe,CAwFjB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,gBAAgB,EAAE,SAAS,GAC1B,eAAe,CAgCjB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAAA;AAE3E;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,CAAC,EAAE,aAAa,EACxB,cAAc,CAAC,EAAE,SAAS,GACzB,eAAe,CAuBjB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,iBAAiB,EAAE,SAAS,GAC3B,eAAe,CASjB"}
package/dist/vue.js CHANGED
@@ -1,5 +1,5 @@
1
- import { D as a, c as d, f as s, g as R, h as n, i as o, j as t, k as c, l, m, n as E, o as i, q as A, s as C, e as D } from "./processor-BOCQYqXE.js";
2
- import { A as h, c as u, a as T, b as V, n as f, r as g } from "./readonly-record-renderer-CkzY7UvT.js";
1
+ import { D as a, c as d, f as s, g as R, h as n, i as o, j as t, k as c, l, m, n as E, o as i, q as A, s as C, e as D } from "./processor-C_zN3-hL.js";
2
+ import { A as h, c as u, a as T, b as V, n as f, r as g } from "./readonly-record-renderer-G9xOkOFe.js";
3
3
  export {
4
4
  h as AIMD_RECORD_RENDER_SCOPES,
5
5
  a as DEFAULT_AIMD_RENDERER_LOCALE,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@airalogy/aimd-renderer",
3
3
  "type": "module",
4
- "version": "2.7.0",
4
+ "version": "2.8.0",
5
5
  "description": "AIMD (Airalogy Markdown) rendering engines for HTML and Vue",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -64,7 +64,7 @@
64
64
  "shiki": "^2.5.0",
65
65
  "unified": "^11.0.5",
66
66
  "vfile": "^6.0.3",
67
- "@airalogy/aimd-core": "^2.9.0"
67
+ "@airalogy/aimd-core": "^2.10.0"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@types/node": "^24.3.0",
@@ -1,3 +1,4 @@
1
+ import { existsSync, readFileSync } from 'node:fs'
1
2
  import { mount } from '@vue/test-utils'
2
3
  import { h } from 'vue'
3
4
  import { describe, expect, it, vi } from 'vitest'
@@ -18,6 +19,11 @@ import {
18
19
  } from '../vue/readonly-record-renderer'
19
20
  import { createCodeBlockRenderer, createStepCardRenderer } from '../vue/vue-renderer'
20
21
 
22
+ const rendererStylesPath = existsSync('src/styles/katex.css')
23
+ ? 'src/styles/katex.css'
24
+ : 'packages/npm/aimd-renderer/src/styles/katex.css'
25
+ const rendererStyles = readFileSync(rendererStylesPath, 'utf8')
26
+
21
27
  function findVNodeByType(node: any, expectedType: string): any | null {
22
28
  if (!node || typeof node !== 'object') {
23
29
  return null
@@ -43,6 +49,37 @@ function findVNodeByType(node: any, expectedType: string): any | null {
43
49
  return null
44
50
  }
45
51
 
52
+ function findVNodeByClass(node: any, expectedClass: string): any | null {
53
+ if (!node || typeof node !== 'object') {
54
+ return null
55
+ }
56
+
57
+ const className = node.props?.class
58
+ const classes = Array.isArray(className)
59
+ ? className
60
+ : typeof className === 'string'
61
+ ? className.split(/\s+/)
62
+ : []
63
+ if (classes.includes(expectedClass)) {
64
+ return node
65
+ }
66
+
67
+ const children = Array.isArray(node.children)
68
+ ? node.children
69
+ : Array.isArray(node.component?.subTree?.children)
70
+ ? node.component.subTree.children
71
+ : []
72
+
73
+ for (const child of children) {
74
+ const match = findVNodeByClass(child, expectedClass)
75
+ if (match) {
76
+ return match
77
+ }
78
+ }
79
+
80
+ return null
81
+ }
82
+
46
83
  function collectVNodeText(node: any): string {
47
84
  if (node == null) {
48
85
  return ''
@@ -237,6 +274,147 @@ describe('renderToHtmlSync', () => {
237
274
  expect(html).toContain('temperature')
238
275
  })
239
276
 
277
+ it('resolves figure asset URLs during HTML rendering', () => {
278
+ const seenContexts: Array<{ src: string, kind: string, id?: string, title?: string }> = []
279
+ const { html } = renderToHtmlSync([
280
+ '```fig',
281
+ 'id: workflow_diagram',
282
+ 'src: files/workflow-diagram.svg',
283
+ 'title: Workflow Diagram',
284
+ '```',
285
+ ].join('\n'), {
286
+ resolveAssetUrl: (src, context) => {
287
+ seenContexts.push({ src, ...context })
288
+ return `/assets/${src.split('/').pop()}`
289
+ },
290
+ })
291
+
292
+ expect(seenContexts).toEqual([{
293
+ src: 'files/workflow-diagram.svg',
294
+ kind: 'fig',
295
+ id: 'workflow_diagram',
296
+ title: 'Workflow Diagram',
297
+ }])
298
+ expect(html).toContain('src="/assets/workflow-diagram.svg"')
299
+ })
300
+
301
+ it('renders internal references without route-breaking bare hash hrefs', () => {
302
+ const { html } = renderToHtmlSync([
303
+ 'As shown in {{ref_fig|workflow_diagram}}, follow {{ref_step|prepare_sample}}.',
304
+ '',
305
+ '```fig',
306
+ 'id: workflow_diagram',
307
+ 'src: files/workflow-diagram.svg',
308
+ 'title: Workflow Diagram',
309
+ '```',
310
+ '',
311
+ '{{step|prepare_sample}}',
312
+ ].join('\n'))
313
+
314
+ expect(html).not.toContain('href="#fig-workflow_diagram"')
315
+ expect(html).not.toContain('href="#step-prepare_sample"')
316
+ expect(html).toContain('<span class="aimd-ref aimd-ref--fig"')
317
+ expect(html).toContain('data-aimd-ref-target="workflow_diagram"')
318
+ expect(html).toContain('data-aimd-ref-kind="fig"')
319
+ expect(html).toContain('<span class="aimd-ref aimd-ref--step"')
320
+ expect(html).toContain('data-aimd-ref-target="prepare_sample"')
321
+ expect(html).toContain('data-aimd-ref-kind="step"')
322
+ })
323
+
324
+ it('styles rendered figures as attached image-caption blocks', () => {
325
+ expect(rendererStyles).toMatch(/\.aimd-figure \{[\s\S]*?width: fit-content;/)
326
+ expect(rendererStyles).toMatch(/\.aimd-figure \{[\s\S]*?overflow: hidden;/)
327
+ expect(rendererStyles).not.toContain('box-shadow: 0 10px 28px')
328
+ expect(rendererStyles).toMatch(/\.aimd-figure__caption \{[\s\S]*?border-top: 1px solid #d8e2ef;/)
329
+ expect(rendererStyles).toMatch(/\.aimd-figure__legend \{[\s\S]*?margin: 4px 0 0;/)
330
+ })
331
+
332
+ it('styles citation popovers as selectable hoverable content', () => {
333
+ expect(rendererStyles).toContain('.aimd-cite__popover')
334
+ expect(rendererStyles).not.toContain('.aimd-cite__ref::after')
335
+ expect(rendererStyles).toMatch(/\.aimd-cite__popover \{[\s\S]*?pointer-events: none;/)
336
+ expect(rendererStyles).toMatch(/\.aimd-cite__popover \{[\s\S]*?user-select: text;/)
337
+ expect(rendererStyles).toMatch(/\.aimd-cite__popover::before \{[\s\S]*?height: 10px;/)
338
+ expect(rendererStyles).toMatch(/\.aimd-cite__ref:hover \.aimd-cite__popover,[\s\S]*?pointer-events: auto;/)
339
+ })
340
+
341
+ it('styles internal references as focusable route-safe targets', () => {
342
+ expect(rendererStyles).toMatch(/\.aimd-ref\[data-aimd-ref-target\] \{[\s\S]*?cursor: pointer;/)
343
+ expect(rendererStyles).toMatch(/\.aimd-ref\[data-aimd-ref-target\]:focus-visible \{[\s\S]*?outline: 2px solid rgba\(25, 118, 210, 0\.36\);/)
344
+ })
345
+
346
+ it('renders citation markers with reference tooltips and refs blocks', () => {
347
+ const content = [
348
+ 'Cite the method {{cite|yang2025airalogyaiempowereduniversaldata, doe2024protocol}}.',
349
+ '',
350
+ '```refs',
351
+ '@misc{yang2025airalogyaiempowereduniversaldata,',
352
+ ' title={Airalogy: AI-empowered universal data digitization for research automation},',
353
+ ' author={Zijie Yang and Qiji Zhou and Fang Guo and Sijie Zhang and Yexun Xi and Jinglei Nie and Yudian Zhu and Liping Huang and Chou Wu and Yonghe Xia and Xiaoyu Ma and Yingming Pu and Panzhong Lu and Junshu Pan and Mingtao Chen and Tiannan Guo and Yanmei Dou and Hongyu Chen and Anping Zeng and Jiaxing Huang and Tian Xu and Yue Zhang},',
354
+ ' year={2025},',
355
+ ' eprint={2506.18586},',
356
+ ' archivePrefix={arXiv},',
357
+ ' primaryClass={cs.AI},',
358
+ ' url={https://arxiv.org/abs/2506.18586},',
359
+ '}',
360
+ '',
361
+ '@misc{doe2024protocol,',
362
+ ' title = "Protocol Notes",',
363
+ ' author = "Doe, Jane",',
364
+ ' year = "2024",',
365
+ ' url = "https://example.com/protocol"',
366
+ '}',
367
+ '```',
368
+ ].join('\n')
369
+
370
+ const { html, fields } = renderToHtmlSync(content)
371
+
372
+ expect(fields.cite).toEqual(['yang2025airalogyaiempowereduniversaldata', 'doe2024protocol'])
373
+ expect(fields.refs?.[0]).toMatchObject({
374
+ id: 'yang2025airalogyaiempowereduniversaldata',
375
+ entry_type: 'misc',
376
+ title: 'Airalogy: AI-empowered universal data digitization for research automation',
377
+ url: 'https://arxiv.org/abs/2506.18586',
378
+ })
379
+ expect(fields.refs?.[1]).toMatchObject({
380
+ id: 'doe2024protocol',
381
+ url: 'https://example.com/protocol',
382
+ })
383
+ expect(html).not.toContain('href="#ref-yang2025airalogyaiempowereduniversaldata"')
384
+ expect(html).not.toContain('href="#ref-doe2024protocol"')
385
+ expect(html).toContain('role="doc-noteref"')
386
+ expect(html).toContain('data-aimd-ref-id="yang2025airalogyaiempowereduniversaldata"')
387
+ expect(html).toContain('data-aimd-ref-summary="Zijie Yang')
388
+ expect(html).toContain('data-aimd-citation-labels="1,2"')
389
+ expect(html).toContain('<span class="aimd-cite__label">1</span>')
390
+ expect(html).toContain('<span class="aimd-cite__label">2</span>')
391
+ expect(html).toContain('<span class="aimd-cite__popover" role="tooltip">Zijie Yang')
392
+ expect(html).not.toContain('<span class="aimd-cite__label">yang2025airalogyaiempowereduniversaldata</span>')
393
+ expect(html).toContain('<section class="aimd-refs"')
394
+ expect(html).toContain('id="ref-yang2025airalogyaiempowereduniversaldata"')
395
+ expect(html).toContain('Airalogy: AI-empowered universal data digitization for research automation')
396
+ expect(html).toContain('href="https://arxiv.org/abs/2506.18586"')
397
+ expect(html).toContain('href="https://example.com/protocol"')
398
+ })
399
+
400
+ it('moves refs blocks to the end of the rendered document', () => {
401
+ const content = [
402
+ '```refs',
403
+ '@misc{doe2024protocol,',
404
+ ' title = "Protocol Notes",',
405
+ ' author = "Doe, Jane",',
406
+ ' year = "2024"',
407
+ '}',
408
+ '```',
409
+ '',
410
+ 'The body continues after the refs declaration.',
411
+ ].join('\n')
412
+
413
+ const { html } = renderToHtmlSync(content)
414
+
415
+ expect(html.indexOf('<p>The body continues after the refs declaration.</p>')).toBeLessThan(html.indexOf('<section class="aimd-refs"'))
416
+ })
417
+
240
418
  it('renders AIMD var field display metadata', () => {
241
419
  const { html, fields } = renderToHtmlSync('{{var|record_date: str, title="Record date", description="ISO date", examples=["2026-05-26", "2026-05-27"]}}')
242
420
  expect(fields.var_definitions?.[0]?.title).toBe('Record date')
@@ -442,6 +620,120 @@ describe('renderToHtmlSync', () => {
442
620
  })
443
621
 
444
622
  describe('renderToVue', () => {
623
+ it('renders references as Vue nodes', async () => {
624
+ const { nodes } = await renderToVue(
625
+ [
626
+ 'Cite {{cite|yang2025airalogyaiempowereduniversaldata}}.',
627
+ '',
628
+ '```refs',
629
+ '@misc{yang2025airalogyaiempowereduniversaldata,',
630
+ ' title={Airalogy: AI-empowered universal data digitization for research automation},',
631
+ ' author={Zijie Yang and Qiji Zhou and Fang Guo and Sijie Zhang and Yexun Xi and Jinglei Nie and Yudian Zhu and Liping Huang and Chou Wu and Yonghe Xia and Xiaoyu Ma and Yingming Pu and Panzhong Lu and Junshu Pan and Mingtao Chen and Tiannan Guo and Yanmei Dou and Hongyu Chen and Anping Zeng and Jiaxing Huang and Tian Xu and Yue Zhang},',
632
+ ' year={2025},',
633
+ ' eprint={2506.18586},',
634
+ ' archivePrefix={arXiv},',
635
+ ' primaryClass={cs.AI},',
636
+ ' url={https://arxiv.org/abs/2506.18586},',
637
+ '}',
638
+ '```',
639
+ ].join('\n'),
640
+ )
641
+
642
+ const refsNode = nodes
643
+ .map(node => findVNodeByType(node, 'section'))
644
+ .find(Boolean) as any
645
+ const citeNode = nodes
646
+ .map(node => findVNodeByClass(node, 'aimd-cite'))
647
+ .find(Boolean) as any
648
+
649
+ expect(refsNode).toBeTruthy()
650
+ expect(refsNode.props.class).toBe('aimd-refs')
651
+ expect(refsNode.props.id).toBe('refs')
652
+ expect(citeNode).toBeTruthy()
653
+ const citeRefNode = findVNodeByClass(citeNode, 'aimd-cite__ref') as any
654
+ const citeLabelNode = findVNodeByClass(citeNode, 'aimd-cite__label') as any
655
+ const citePopoverNode = findVNodeByClass(citeNode, 'aimd-cite__popover') as any
656
+ expect(citeRefNode.type).toBe('span')
657
+ expect(citeRefNode.props.href).toBeUndefined()
658
+ expect(citeRefNode.props['data-aimd-ref-summary']).toContain('Airalogy: AI-empowered universal data digitization for research automation')
659
+ expect(collectVNodeText(citeLabelNode).trim()).toBe('1')
660
+ expect(citePopoverNode.type).toBe('span')
661
+ expect(citePopoverNode.props.role).toBe('tooltip')
662
+ expect(collectVNodeText(citePopoverNode)).toContain('Airalogy: AI-empowered universal data digitization for research automation')
663
+ expect(collectVNodeText(nodes)).toContain('References')
664
+ expect(collectVNodeText(nodes)).toContain('Airalogy: AI-empowered universal data digitization for research automation')
665
+ expect(collectVNodeText(citeNode)).not.toContain('yang2025airalogyaiempowereduniversaldata')
666
+ })
667
+
668
+ it('resolves figure asset URLs during Vue rendering', async () => {
669
+ const { nodes } = await renderToVue([
670
+ '```fig',
671
+ 'id: workflow_diagram',
672
+ 'src: files/workflow-diagram.svg',
673
+ 'title: Workflow Diagram',
674
+ '```',
675
+ ].join('\n'), {
676
+ resolveAssetUrl: (src, context) => {
677
+ expect(context).toMatchObject({
678
+ kind: 'fig',
679
+ id: 'workflow_diagram',
680
+ title: 'Workflow Diagram',
681
+ })
682
+ return `/assets/${src.split('/').pop()}`
683
+ },
684
+ })
685
+
686
+ const img = findVNodeByType({ children: nodes }, 'img') as any
687
+ expect(img).toBeTruthy()
688
+ expect(img.props.src).toBe('/assets/workflow-diagram.svg')
689
+ })
690
+
691
+ it('renders Vue figure references as route-safe internal markers', async () => {
692
+ const { nodes } = await renderToVue([
693
+ 'As shown in {{ref_fig|workflow_diagram}}.',
694
+ '',
695
+ '```fig',
696
+ 'id: workflow_diagram',
697
+ 'src: files/workflow-diagram.svg',
698
+ 'title: Workflow Diagram',
699
+ '```',
700
+ ].join('\n'))
701
+
702
+ const figRefNode = findVNodeByClass({ children: nodes }, 'aimd-ref--fig') as any
703
+ expect(figRefNode).toBeTruthy()
704
+ expect(figRefNode.type).toBe('span')
705
+ expect(figRefNode.props.href).toBeUndefined()
706
+ expect(figRefNode.props['data-aimd-ref-target']).toBe('workflow_diagram')
707
+ expect(figRefNode.props['data-aimd-ref-kind']).toBe('fig')
708
+ expect(figRefNode.props.tabindex).toBe(0)
709
+ })
710
+
711
+ it('moves refs Vue nodes to the end of the rendered document', async () => {
712
+ const { nodes } = await renderToVue(
713
+ [
714
+ '```refs',
715
+ '@misc{doe2024protocol,',
716
+ ' title = "Protocol Notes",',
717
+ ' author = "Doe, Jane",',
718
+ ' year = "2024"',
719
+ '}',
720
+ '```',
721
+ '',
722
+ 'The body continues after the refs declaration.',
723
+ ].join('\n'),
724
+ )
725
+
726
+ const rootChildren = Array.isArray((nodes[0] as any)?.children)
727
+ ? (nodes[0] as any).children
728
+ : nodes
729
+ const refsIndex = rootChildren.findIndex((node: any) => Boolean(findVNodeByClass(node, 'aimd-refs')))
730
+ const bodyIndex = rootChildren.findIndex((node: any) => collectVNodeText(node).includes('The body continues after the refs declaration.'))
731
+
732
+ expect(bodyIndex).toBeGreaterThanOrEqual(0)
733
+ expect(refsIndex).toBeGreaterThanOrEqual(0)
734
+ expect(bodyIndex).toBeLessThan(refsIndex)
735
+ })
736
+
445
737
  it('renders code blocks with line numbers and wrapping classes', async () => {
446
738
  const { nodes } = await renderToVue(
447
739
  '```json\n{\n "model":"qwen3.6-flash","enable_search":true\n}\n```',
@@ -0,0 +1,22 @@
1
+ export interface AimdAssetUrlResolveContext {
2
+ kind: "fig"
3
+ id?: string
4
+ title?: string
5
+ }
6
+
7
+ export type AimdAssetUrlResolver = (
8
+ src: string,
9
+ context: AimdAssetUrlResolveContext,
10
+ ) => string | null | undefined
11
+
12
+ export function resolveAimdAssetUrl(
13
+ src: string | undefined,
14
+ resolver: AimdAssetUrlResolver | undefined,
15
+ context: AimdAssetUrlResolveContext,
16
+ ): string | undefined {
17
+ if (!src || !resolver) {
18
+ return src
19
+ }
20
+
21
+ return resolver(src, context) || src
22
+ }