@refrakt-md/runes 0.37.0 → 0.39.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/dist/collection-helpers.d.ts +21 -2
- package/dist/collection-helpers.d.ts.map +1 -1
- package/dist/collection-helpers.js +72 -15
- package/dist/collection-helpers.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +79 -46
- package/dist/config.js.map +1 -1
- package/dist/data-pipeline.d.ts +24 -10
- package/dist/data-pipeline.d.ts.map +1 -1
- package/dist/data-pipeline.js +34 -56
- package/dist/data-pipeline.js.map +1 -1
- package/dist/file-ref-resolve.js +9 -13
- package/dist/file-ref-resolve.js.map +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/component.d.ts +8 -11
- package/dist/lib/component.d.ts.map +1 -1
- package/dist/lib/component.js +17 -52
- package/dist/lib/component.js.map +1 -1
- package/dist/lib/field-metas.d.ts +34 -0
- package/dist/lib/field-metas.d.ts.map +1 -0
- package/dist/lib/field-metas.js +45 -0
- package/dist/lib/field-metas.js.map +1 -0
- package/dist/lib/index.d.ts +64 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +134 -5
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/node.d.ts +22 -0
- package/dist/lib/node.d.ts.map +1 -1
- package/dist/lib/node.js +32 -0
- package/dist/lib/node.js.map +1 -1
- package/dist/lib/preprocess.d.ts +63 -0
- package/dist/lib/preprocess.d.ts.map +1 -0
- package/dist/lib/preprocess.js +71 -0
- package/dist/lib/preprocess.js.map +1 -0
- package/dist/lib/registers.d.ts +132 -0
- package/dist/lib/registers.d.ts.map +1 -0
- package/dist/lib/registers.js +328 -0
- package/dist/lib/registers.js.map +1 -0
- package/dist/lib/resolver.d.ts +9 -1
- package/dist/lib/resolver.d.ts.map +1 -1
- package/dist/lib/resolver.js +24 -1
- package/dist/lib/resolver.js.map +1 -1
- package/dist/lib/schema-table.d.ts +46 -9
- package/dist/lib/schema-table.d.ts.map +1 -1
- package/dist/lib/schema-table.js +111 -22
- package/dist/lib/schema-table.js.map +1 -1
- package/dist/lib/slots.d.ts +99 -0
- package/dist/lib/slots.d.ts.map +1 -0
- package/dist/lib/slots.js +448 -0
- package/dist/lib/slots.js.map +1 -0
- package/dist/props.d.ts +0 -2
- package/dist/props.d.ts.map +1 -1
- package/dist/reference.d.ts +37 -0
- package/dist/reference.d.ts.map +1 -1
- package/dist/reference.js +116 -2
- package/dist/reference.js.map +1 -1
- package/dist/registers-pipeline.d.ts +50 -0
- package/dist/registers-pipeline.d.ts.map +1 -0
- package/dist/registers-pipeline.js +218 -0
- package/dist/registers-pipeline.js.map +1 -0
- package/dist/schema-row.d.ts +5 -0
- package/dist/schema-row.d.ts.map +1 -1
- package/dist/schema-row.js +1 -0
- package/dist/schema-row.js.map +1 -1
- package/dist/tags/accordion.d.ts.map +1 -1
- package/dist/tags/accordion.js +4 -7
- package/dist/tags/accordion.js.map +1 -1
- package/dist/tags/annotate.d.ts.map +1 -1
- package/dist/tags/annotate.js +6 -13
- package/dist/tags/annotate.js.map +1 -1
- package/dist/tags/bar.d.ts.map +1 -1
- package/dist/tags/bar.js +2 -5
- package/dist/tags/bar.js.map +1 -1
- package/dist/tags/blog.d.ts.map +1 -1
- package/dist/tags/blog.js +1 -9
- package/dist/tags/blog.js.map +1 -1
- package/dist/tags/breadcrumb.d.ts.map +1 -1
- package/dist/tags/breadcrumb.js +4 -5
- package/dist/tags/breadcrumb.js.map +1 -1
- package/dist/tags/budget.d.ts.map +1 -1
- package/dist/tags/budget.js +2 -10
- package/dist/tags/budget.js.map +1 -1
- package/dist/tags/card.d.ts.map +1 -1
- package/dist/tags/card.js +7 -14
- package/dist/tags/card.js.map +1 -1
- package/dist/tags/chart.d.ts.map +1 -1
- package/dist/tags/chart.js +5 -8
- package/dist/tags/chart.js.map +1 -1
- package/dist/tags/codegroup.d.ts.map +1 -1
- package/dist/tags/codegroup.js +0 -2
- package/dist/tags/codegroup.js.map +1 -1
- package/dist/tags/common.d.ts.map +1 -1
- package/dist/tags/common.js +2 -5
- package/dist/tags/common.js.map +1 -1
- package/dist/tags/compare.d.ts.map +1 -1
- package/dist/tags/compare.js +4 -8
- package/dist/tags/compare.js.map +1 -1
- package/dist/tags/conversation.d.ts.map +1 -1
- package/dist/tags/conversation.js +4 -7
- package/dist/tags/conversation.js.map +1 -1
- package/dist/tags/data.d.ts +2 -2
- package/dist/tags/data.d.ts.map +1 -1
- package/dist/tags/data.js +6 -4
- package/dist/tags/data.js.map +1 -1
- package/dist/tags/datatable.d.ts.map +1 -1
- package/dist/tags/datatable.js +4 -8
- package/dist/tags/datatable.js.map +1 -1
- package/dist/tags/details.d.ts.map +1 -1
- package/dist/tags/details.js +3 -7
- package/dist/tags/details.js.map +1 -1
- package/dist/tags/diagram.js +2 -2
- package/dist/tags/diagram.js.map +1 -1
- package/dist/tags/diff.js +1 -1
- package/dist/tags/diff.js.map +1 -1
- package/dist/tags/drawer.d.ts.map +1 -1
- package/dist/tags/drawer.js +4 -12
- package/dist/tags/drawer.js.map +1 -1
- package/dist/tags/embed.d.ts.map +1 -1
- package/dist/tags/embed.js +4 -5
- package/dist/tags/embed.js.map +1 -1
- package/dist/tags/figure.d.ts +10 -4
- package/dist/tags/figure.d.ts.map +1 -1
- package/dist/tags/figure.js +70 -33
- package/dist/tags/figure.js.map +1 -1
- package/dist/tags/form.d.ts.map +1 -1
- package/dist/tags/form.js +3 -18
- package/dist/tags/form.js.map +1 -1
- package/dist/tags/gallery.d.ts.map +1 -1
- package/dist/tags/gallery.js +6 -11
- package/dist/tags/gallery.js.map +1 -1
- package/dist/tags/grid.d.ts.map +1 -1
- package/dist/tags/grid.js +7 -17
- package/dist/tags/grid.js.map +1 -1
- package/dist/tags/hint.d.ts.map +1 -1
- package/dist/tags/hint.js +4 -8
- package/dist/tags/hint.js.map +1 -1
- package/dist/tags/include.d.ts +51 -7
- package/dist/tags/include.d.ts.map +1 -1
- package/dist/tags/include.js +216 -7
- package/dist/tags/include.js.map +1 -1
- package/dist/tags/juxtapose.js +2 -2
- package/dist/tags/juxtapose.js.map +1 -1
- package/dist/tags/layout.d.ts.map +1 -1
- package/dist/tags/layout.js +2 -5
- package/dist/tags/layout.js.map +1 -1
- package/dist/tags/mediatext.d.ts.map +1 -1
- package/dist/tags/mediatext.js +5 -13
- package/dist/tags/mediatext.js.map +1 -1
- package/dist/tags/nav.d.ts.map +1 -1
- package/dist/tags/nav.js +2 -5
- package/dist/tags/nav.js.map +1 -1
- package/dist/tags/progress.d.ts.map +1 -1
- package/dist/tags/progress.js +4 -8
- package/dist/tags/progress.js.map +1 -1
- package/dist/tags/pullquote.d.ts.map +1 -1
- package/dist/tags/pullquote.js +8 -15
- package/dist/tags/pullquote.js.map +1 -1
- package/dist/tags/region.d.ts.map +1 -1
- package/dist/tags/region.js +2 -5
- package/dist/tags/region.js.map +1 -1
- package/dist/tags/reveal.d.ts.map +1 -1
- package/dist/tags/reveal.js +4 -7
- package/dist/tags/reveal.js.map +1 -1
- package/dist/tags/section.d.ts.map +1 -1
- package/dist/tags/section.js +3 -3
- package/dist/tags/section.js.map +1 -1
- package/dist/tags/showcase.d.ts.map +1 -1
- package/dist/tags/showcase.js +4 -11
- package/dist/tags/showcase.js.map +1 -1
- package/dist/tags/sidenote.d.ts.map +1 -1
- package/dist/tags/sidenote.js +7 -12
- package/dist/tags/sidenote.js.map +1 -1
- package/dist/tags/snippet.d.ts +9 -10
- package/dist/tags/snippet.d.ts.map +1 -1
- package/dist/tags/snippet.js +213 -10
- package/dist/tags/snippet.js.map +1 -1
- package/dist/tags/tabs.d.ts.map +1 -1
- package/dist/tags/tabs.js +3 -6
- package/dist/tags/tabs.js.map +1 -1
- package/dist/tags/textblock.d.ts.map +1 -1
- package/dist/tags/textblock.js +7 -19
- package/dist/tags/textblock.js.map +1 -1
- package/dist/tags/tint.d.ts.map +1 -1
- package/dist/tags/tint.js +17 -29
- package/dist/tags/tint.js.map +1 -1
- package/dist/tags/toc.js +1 -1
- package/dist/tags/toc.js.map +1 -1
- package/dist/universal-attributes.d.ts +1 -1
- package/package.json +3 -3
- package/dist/include-pipeline.d.ts +0 -52
- package/dist/include-pipeline.d.ts.map +0 -1
- package/dist/include-pipeline.js +0 -206
- package/dist/include-pipeline.js.map +0 -1
- package/dist/snippet-pipeline.d.ts +0 -44
- package/dist/snippet-pipeline.d.ts.map +0 -1
- package/dist/snippet-pipeline.js +0 -307
- package/dist/snippet-pipeline.js.map +0 -1
package/dist/tags/pullquote.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Markdoc from '@markdoc/markdoc';
|
|
2
2
|
const { Tag } = Markdoc;
|
|
3
|
-
import { createContentModelSchema, createComponentRenderable,
|
|
4
|
-
import { RenderableNodeCursor } from '../lib/renderable.js';
|
|
3
|
+
import { createContentModelSchema, bodyOnly, createComponentRenderable, renderNodes, fieldMetas, } from '../lib/index.js';
|
|
5
4
|
const alignValues = ['left', 'center', 'right'];
|
|
6
5
|
const variantValues = ['default', 'accent', 'editorial'];
|
|
7
6
|
// SPEC-125 Phase 2 — join tables the rune declares about itself. Referenced
|
|
@@ -25,26 +24,20 @@ export const pullquote = createContentModelSchema({
|
|
|
25
24
|
description: 'Visual style of the quote block',
|
|
26
25
|
},
|
|
27
26
|
},
|
|
28
|
-
contentModel:
|
|
29
|
-
type: 'sequence',
|
|
30
|
-
fields: [{ name: 'body', match: 'any', optional: true, greedy: true }],
|
|
31
|
-
},
|
|
27
|
+
contentModel: bodyOnly(),
|
|
32
28
|
transform(resolved, attrs, config) {
|
|
33
|
-
const children =
|
|
34
|
-
const alignMeta = new Tag('meta', { content: attrs.align ?? 'center' });
|
|
35
|
-
const variantMeta = new Tag('meta', { content: attrs.variant ?? 'default' });
|
|
29
|
+
const children = renderNodes(resolved.body, config);
|
|
36
30
|
// Extract blockquote or use all children as the quote text
|
|
37
31
|
const blockquote = children.tag('blockquote');
|
|
38
32
|
const quoteChildren = blockquote.count() > 0 ? blockquote.limit(1).toArray() : children.tag('p').toArray();
|
|
39
|
-
const childNodes = [...quoteChildren, alignMeta, variantMeta];
|
|
40
33
|
return createComponentRenderable({
|
|
41
34
|
rune: 'pull-quote',
|
|
42
35
|
tag: 'blockquote',
|
|
43
|
-
properties: {
|
|
44
|
-
align:
|
|
45
|
-
variant:
|
|
46
|
-
},
|
|
47
|
-
children:
|
|
36
|
+
properties: fieldMetas(attrs, config, {
|
|
37
|
+
align: 'center',
|
|
38
|
+
variant: 'default',
|
|
39
|
+
}),
|
|
40
|
+
children: quoteChildren,
|
|
48
41
|
});
|
|
49
42
|
},
|
|
50
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pullquote.js","sourceRoot":"","sources":["../../src/tags/pullquote.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"pullquote.js","sourceRoot":"","sources":["../../src/tags/pullquote.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AACxB,OAAO,EACN,wBAAwB,EACxB,QAAQ,EACR,yBAAyB,EACzB,WAAW,EACX,UAAU,GACV,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AACzD,MAAM,aAAa,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAU,CAAC;AAElE,4EAA4E;AAC5E,0EAA0E;AAC1E,iCAAiC;AACjC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAW,CAAC;AAE3D,MAAM,CAAC,MAAM,SAAS,GAAG,wBAAwB,CAAC;IACjD,QAAQ,EAAE,iBAAiB;IAC3B,QAA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"version":3,"file":"region.d.ts","sourceRoot":"","sources":["../../src/tags/region.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAOvC,eAAO,MAAM,MAAM,gBAyBjB,CAAC"}
|
package/dist/tags/region.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Markdoc from '@markdoc/markdoc';
|
|
2
2
|
const { Tag } = Markdoc;
|
|
3
|
-
import { createContentModelSchema, asNodes } from '../lib/index.js';
|
|
3
|
+
import { createContentModelSchema, bodyOnly, asNodes } from '../lib/index.js';
|
|
4
4
|
const regionMode = ['replace', 'prepend', 'append'];
|
|
5
5
|
export const region = createContentModelSchema({
|
|
6
6
|
attributes: {
|
|
@@ -14,10 +14,7 @@ export const region = createContentModelSchema({
|
|
|
14
14
|
description: 'How content is placed: replace, prepend, or append',
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
|
-
contentModel:
|
|
18
|
-
type: 'sequence',
|
|
19
|
-
fields: [{ name: 'body', match: 'any', greedy: true, optional: true }],
|
|
20
|
-
},
|
|
17
|
+
contentModel: bodyOnly(),
|
|
21
18
|
transform(resolved, attrs, config) {
|
|
22
19
|
const children = Markdoc.transform(asNodes(resolved.body), config);
|
|
23
20
|
return new Tag('div', {
|
package/dist/tags/region.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"region.js","sourceRoot":"","sources":["../../src/tags/region.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"region.js","sourceRoot":"","sources":["../../src/tags/region.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE9E,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAC;AAE7D,MAAM,CAAC,MAAM,MAAM,GAAG,wBAAwB,CAAC;IAC9C,UAAU,EAAE;QACX,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mCAAmC,EAAE;QACxF,IAAI,EAAE;YACL,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,UAAU,CAAC,KAAK,EAAE;YAC3B,UAAU,EAAE,UAAU;YACtB,OAAO,EAAE,SAAS;YAClB,WAAW,EAAE,oDAAoD;SACjE;KACD;IACD,YAAY,EAAE,QAAQ,EAAE;IACxB,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM;QAChC,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAyB,CAAC;QAE3F,OAAO,IAAI,GAAG,CACb,KAAK,EACL;YACC,aAAa,EAAE,KAAK,CAAC,IAAI;YACzB,WAAW,EAAE,KAAK,CAAC,IAAI;SACvB,EACD,QAAQ,CACR,CAAC;IACH,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reveal.d.ts","sourceRoot":"","sources":["../../src/tags/reveal.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"reveal.d.ts","sourceRoot":"","sources":["../../src/tags/reveal.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAevC,eAAO,MAAM,UAAU,gBAqBrB,CAAC;AAKH,eAAO,MAAM,cAAc;;;;CAIjB,CAAC;AAEX,eAAO,MAAM,MAAM,gBAoDjB,CAAC"}
|
package/dist/tags/reveal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Markdoc from '@markdoc/markdoc';
|
|
2
2
|
const { Tag } = Markdoc;
|
|
3
|
-
import { createComponentRenderable, createContentModelSchema, asNodes } from '../lib/index.js';
|
|
3
|
+
import { createComponentRenderable, createContentModelSchema, bodyOnly, asNodes, renderNodes, } from '../lib/index.js';
|
|
4
4
|
import { RenderableNodeCursor } from '../lib/renderable.js';
|
|
5
5
|
import { pageSectionProperties } from './common.js';
|
|
6
6
|
const modeType = ['click', 'scroll', 'auto'];
|
|
@@ -8,13 +8,10 @@ export const revealStep = createContentModelSchema({
|
|
|
8
8
|
attributes: {
|
|
9
9
|
name: { type: String, required: true },
|
|
10
10
|
},
|
|
11
|
-
contentModel:
|
|
12
|
-
type: 'sequence',
|
|
13
|
-
fields: [{ name: 'body', match: 'any', optional: true, greedy: true }],
|
|
14
|
-
},
|
|
11
|
+
contentModel: bodyOnly(),
|
|
15
12
|
transform(resolved, attrs, config) {
|
|
16
13
|
const nameTag = new Tag('span', {}, [attrs.name ?? '']);
|
|
17
|
-
const body =
|
|
14
|
+
const body = renderNodes(resolved.body, config).wrap('div');
|
|
18
15
|
return createComponentRenderable({
|
|
19
16
|
rune: 'reveal-step',
|
|
20
17
|
tag: 'div',
|
|
@@ -61,7 +58,7 @@ export const reveal = createContentModelSchema({
|
|
|
61
58
|
},
|
|
62
59
|
}),
|
|
63
60
|
transform(resolved, attrs, config) {
|
|
64
|
-
const headerNodes =
|
|
61
|
+
const headerNodes = renderNodes(resolved.header, config);
|
|
65
62
|
// Combine explicit child tags (preamble items) with emitted section tags
|
|
66
63
|
const allItems = [...asNodes(resolved.items), ...asNodes(resolved.sections)];
|
|
67
64
|
const sectionNodes = new RenderableNodeCursor(Markdoc.transform(allItems, config));
|
package/dist/tags/reveal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reveal.js","sourceRoot":"","sources":["../../src/tags/reveal.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"reveal.js","sourceRoot":"","sources":["../../src/tags/reveal.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AACxB,OAAO,EACN,yBAAyB,EACzB,wBAAwB,EACxB,QAAQ,EACR,OAAO,EACP,WAAW,GACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;AAEtD,MAAM,CAAC,MAAM,UAAU,GAAG,wBAAwB,CAAC;IAClD,UAAU,EAAE;QACX,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;KACtC;IACD,YAAY,EAAE,QAAQ,EAAE;IACxB,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM;QAChC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;QACxD,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAE5D,OAAO,yBAAyB,CAAC;YAChC,IAAI,EAAE,aAAa;YACnB,GAAG,EAAE,KAAK;YACV,UAAU,EAAE;gBACX,IAAI,EAAE,OAAO;aACb;YACD,IAAI,EAAE;gBACL,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CA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"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AASvC;;;;;GAKG;AAIH,eAAO,MAAM,eAAe;;;;CAIlB,CAAC;AAEX,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../../src/tags/section.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AASvC;;;;;GAKG;AAIH,eAAO,MAAM,eAAe;;;;CAIlB,CAAC;AAEX,eAAO,MAAM,OAAO,gBAgDlB,CAAC"}
|
package/dist/tags/section.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Markdoc from '@markdoc/markdoc';
|
|
2
2
|
const { Tag } = Markdoc;
|
|
3
|
-
import { createComponentRenderable, createContentModelSchema,
|
|
3
|
+
import { createComponentRenderable, createContentModelSchema, renderNodes } from '../lib/index.js';
|
|
4
4
|
import { RenderableNodeCursor } from '../lib/renderable.js';
|
|
5
5
|
import { pageSectionProperties } from './common.js';
|
|
6
6
|
const alignType = ['start', 'center', 'end'];
|
|
@@ -40,11 +40,11 @@ export const section = createContentModelSchema({
|
|
|
40
40
|
transform(resolved, attrs, config) {
|
|
41
41
|
const headerAstNodes = [resolved.eyebrow, resolved.headline, resolved.blurb].filter(Boolean);
|
|
42
42
|
const header = new RenderableNodeCursor(Markdoc.transform(headerAstNodes, config));
|
|
43
|
-
const body =
|
|
43
|
+
const body = renderNodes(resolved.body, config).wrap('div');
|
|
44
44
|
const align = attrs.align || 'start';
|
|
45
45
|
const alignMeta = new Tag('meta', { content: align });
|
|
46
46
|
const headerContent = header.count() > 0 ? [header.wrap('header').next()] : [];
|
|
47
|
-
const children = [
|
|
47
|
+
const children = [...headerContent, body.next()];
|
|
48
48
|
return createComponentRenderable({
|
|
49
49
|
rune: 'section',
|
|
50
50
|
tag: 'section',
|
package/dist/tags/section.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section.js","sourceRoot":"","sources":["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MAAM,CAAC;gBAChC,IAAI;aACJ;YACD,QAAQ;SACR,CAAC,CAAC;IACJ,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"showcase.d.ts","sourceRoot":"","sources":["../../src/tags/showcase.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"showcase.d.ts","sourceRoot":"","sources":["../../src/tags/showcase.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AA8BvC,eAAO,MAAM,gBAAgB;;CAAgC,CAAC;AAC9D,eAAO,MAAM,mBAAmB,EAAG,MAAe,CAAC;AAEnD,eAAO,MAAM,QAAQ,gBAyFnB,CAAC"}
|
package/dist/tags/showcase.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Markdoc from '@markdoc/markdoc';
|
|
2
2
|
const { Tag } = Markdoc;
|
|
3
|
-
import { createContentModelSchema, createComponentRenderable,
|
|
4
|
-
import { RenderableNodeCursor } from '../lib/renderable.js';
|
|
3
|
+
import { createContentModelSchema, bodyOnly, createComponentRenderable, renderNodes, } from '../lib/index.js';
|
|
5
4
|
const shadowValues = ['none', 'soft', 'hard', 'elevated'];
|
|
6
5
|
const bleedValues = ['none', 'top', 'bottom', 'both', 'end', 'bottom-end', 'top-end'];
|
|
7
6
|
/** SPEC-086 — showcase collapses into the frame model (`frameTarget: 'self'`).
|
|
@@ -59,26 +58,21 @@ export const showcase = createContentModelSchema({
|
|
|
59
58
|
description: 'Position of content within the showcase area',
|
|
60
59
|
},
|
|
61
60
|
},
|
|
62
|
-
contentModel:
|
|
63
|
-
type: 'sequence',
|
|
64
|
-
fields: [{ name: 'body', match: 'any', optional: true, greedy: true }],
|
|
65
|
-
},
|
|
61
|
+
contentModel: bodyOnly(),
|
|
66
62
|
transform(resolved, attrs, config) {
|
|
67
|
-
const children =
|
|
63
|
+
const children = renderNodes(resolved.body, config);
|
|
68
64
|
const shadow = attrs.shadow ?? 'none';
|
|
69
65
|
const bleed = attrs.bleed ?? 'none';
|
|
70
66
|
const offset = attrs.offset ?? '';
|
|
71
67
|
const aspect = attrs.aspect ?? '';
|
|
72
68
|
const place = attrs.place ?? '';
|
|
73
69
|
const properties = {};
|
|
74
|
-
const childNodes = [];
|
|
75
70
|
// Emit a frame facet meta the engine routes to the showcase root
|
|
76
71
|
// (frameTarget: 'self'). Routed through `properties` so it rides both the
|
|
77
72
|
// SPEC-082 field bag and the meta channel the engine reads.
|
|
78
73
|
const frameMeta = (field, value) => {
|
|
79
74
|
const meta = new Tag('meta', { content: value });
|
|
80
75
|
properties[field] = meta;
|
|
81
|
-
childNodes.push(meta);
|
|
82
76
|
};
|
|
83
77
|
if (shadow && shadow !== 'none') {
|
|
84
78
|
warnShowcaseDeprecated('shadow', 'frame-shadow');
|
|
@@ -101,7 +95,6 @@ export const showcase = createContentModelSchema({
|
|
|
101
95
|
frameMeta('frame-place', place);
|
|
102
96
|
}
|
|
103
97
|
const viewport = new Tag('div', {}, children.toArray());
|
|
104
|
-
childNodes.push(viewport);
|
|
105
98
|
return createComponentRenderable({
|
|
106
99
|
rune: 'showcase',
|
|
107
100
|
tag: 'div',
|
|
@@ -109,7 +102,7 @@ export const showcase = createContentModelSchema({
|
|
|
109
102
|
refs: {
|
|
110
103
|
viewport,
|
|
111
104
|
},
|
|
112
|
-
children:
|
|
105
|
+
children: [viewport],
|
|
113
106
|
});
|
|
114
107
|
},
|
|
115
108
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"showcase.js","sourceRoot":"","sources":["../../src/tags/showcase.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"showcase.js","sourceRoot":"","sources":["../../src/tags/showcase.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,MAAM,EAAE,GAAG,E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
|
1
|
-
{"version":3,"file":"sidenote.d.ts","sourceRoot":"","sources":["../../src/tags/sidenote.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"sidenote.d.ts","sourceRoot":"","sources":["../../src/tags/sidenote.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAevC,eAAO,MAAM,gBAAgB;;CAA4B,CAAC;AAE1D,eAAO,MAAM,QAAQ,gBA4BnB,CAAC"}
|
package/dist/tags/sidenote.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Markdoc from '@markdoc/markdoc';
|
|
2
2
|
const { Tag } = Markdoc;
|
|
3
|
-
import { createContentModelSchema, createComponentRenderable,
|
|
4
|
-
import { RenderableNodeCursor } from '../lib/renderable.js';
|
|
3
|
+
import { createContentModelSchema, bodyOnly, createComponentRenderable, renderNodes, fieldMetas, } from '../lib/index.js';
|
|
5
4
|
const variantType = ['sidenote', 'footnote', 'tooltip'];
|
|
6
5
|
// SPEC-125 Phase 2 — join tables the rune declares about itself. Referenced
|
|
7
6
|
// from the theme config rather than owned by it: a theme may not redefine
|
|
@@ -18,24 +17,20 @@ export const sidenote = createContentModelSchema({
|
|
|
18
17
|
description: 'Display style: sidenote, footnote, or tooltip',
|
|
19
18
|
},
|
|
20
19
|
},
|
|
21
|
-
contentModel:
|
|
22
|
-
type: 'sequence',
|
|
23
|
-
fields: [{ name: 'body', match: 'any', optional: true, greedy: true }],
|
|
24
|
-
},
|
|
20
|
+
contentModel: bodyOnly(),
|
|
25
21
|
transform(resolved, attrs, config) {
|
|
26
|
-
const
|
|
27
|
-
const body = new RenderableNodeCursor(Markdoc.transform(asNodes(resolved.body), config));
|
|
22
|
+
const body = renderNodes(resolved.body, config);
|
|
28
23
|
const bodyDiv = body.wrap('div');
|
|
29
24
|
return createComponentRenderable({
|
|
30
25
|
rune: 'sidenote',
|
|
31
26
|
tag: 'aside',
|
|
32
|
-
properties: {
|
|
33
|
-
variant:
|
|
34
|
-
},
|
|
27
|
+
properties: fieldMetas(attrs, config, {
|
|
28
|
+
variant: 'sidenote',
|
|
29
|
+
}),
|
|
35
30
|
refs: {
|
|
36
31
|
body: bodyDiv,
|
|
37
32
|
},
|
|
38
|
-
children: [
|
|
33
|
+
children: [bodyDiv.next()],
|
|
39
34
|
});
|
|
40
35
|
},
|
|
41
36
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidenote.js","sourceRoot":"","sources":["../../src/tags/sidenote.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"sidenote.js","sourceRoot":"","sources":["../../src/tags/sidenote.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AACxB,OAAO,EACN,wBAAwB,EACxB,QAAQ,EACR,yBAAyB,EACzB,WAAW,EACX,UAAU,GACV,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,CAAU,CAAC;AAEjE,4EAA4E;AAC5E,0EAA0E;AAC1E,iCAAiC;AACjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAW,CAAC;AAE1D,MAAM,CAAC,MAAM,QAAQ,GAAG,wBAAwB,CAAC;IAChD,QAAQ,EAAE,gBAAgB;IAC1B,QAAQ,EAAE,CAAC,OAAO,CAAC;IACnB,UAAU,EAAE;QACX,OAAO,EAAE;YACR,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE;YAC5B,WAAW,EAAE,+CAA+C;SAC5D;KACD;IACD,YAAY,EAAE,QAAQ,EAAE;IACxB,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM;QAChC,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAChD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAEjC,OAAO,yBAAyB,CAAC;YAChC,IAAI,EAAE,UAAU;YAChB,GAAG,EAAE,OAAO;YACZ,UAAU,EAAE,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE;gBACrC,OAAO,EAAE,UAAU;aACnB,CAAC;YACF,IAAI,EAAE;gBACL,IAAI,EAAE,OAAO;aACb;YACD,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;SAC1B,CAAC,CAAC;IACJ,CAAC;CACD,CAAC,CAAC"}
|
package/dist/tags/snippet.d.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
+
import Markdoc from '@markdoc/markdoc';
|
|
1
2
|
/**
|
|
2
3
|
* The `snippet` rune — embed a file's contents as a syntax-highlighted code
|
|
3
4
|
* block (SPEC-062).
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* `transform` function is **unreachable in normal operation**.
|
|
6
|
+
* Snippet is an **AST preprocessor** rather than a transform-time rune: its
|
|
7
|
+
* `preprocess` hook (above) replaces every `{% snippet %}` tag with a Markdoc
|
|
8
|
+
* `fence` node before the schema-driven transform runs (SPEC-141). By the time
|
|
9
|
+
* the transform reaches the AST, no snippet tags exist — only fences. So this
|
|
10
|
+
* schema's `transform` function is **unreachable in normal operation**.
|
|
11
11
|
*
|
|
12
12
|
* The schema still exists for tooling: `refrakt inspect snippet`, the
|
|
13
13
|
* contracts generator, attribute validation, and the rune-catalog docs all
|
|
14
|
-
* read from it. If the transform ever does execute
|
|
15
|
-
*
|
|
16
|
-
* the user at the registration site.
|
|
14
|
+
* read from it. If the transform ever does execute, it throws a clear error
|
|
15
|
+
* naming the likely cause (SPEC-141 D7).
|
|
17
16
|
*/
|
|
18
|
-
export declare const snippet:
|
|
17
|
+
export declare const snippet: Markdoc.Schema;
|
|
19
18
|
//# sourceMappingURL=snippet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snippet.d.ts","sourceRoot":"","sources":["../../src/tags/snippet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"snippet.d.ts","sourceRoot":"","sources":["../../src/tags/snippet.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAiPvC;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,OAAO,gBAmHlB,CAAC"}
|
package/dist/tags/snippet.js
CHANGED
|
@@ -1,20 +1,222 @@
|
|
|
1
|
+
import Markdoc from '@markdoc/markdoc';
|
|
1
2
|
import { createContentModelSchema } from '../lib/index.js';
|
|
3
|
+
import { formatHighlight, highlightMatchLines, parseHighlightMatch, reindent, shouldReindent, } from '../lib/present.js';
|
|
4
|
+
import { readSnippetFile, SnippetSandboxError } from '../lib/read-file.js';
|
|
5
|
+
import { compareMarker, parseMarker } from '../lib/review-marker.js';
|
|
6
|
+
import { inferLanguage } from '../lang-map.js';
|
|
7
|
+
const { Ast } = Markdoc;
|
|
8
|
+
/** Resolve a Markdoc attribute value to a string. Handles literal strings
|
|
9
|
+
* and Markdoc `Variable` AST nodes (e.g. `path=$file.path` parses as a
|
|
10
|
+
* Variable, not a string). Unresolvable references (variable missing from
|
|
11
|
+
* the context, or attribute is some other AST shape) return an empty
|
|
12
|
+
* string — matching transform-time variable-evaluation behaviour. */
|
|
13
|
+
function resolveAttributeValue(value, variables) {
|
|
14
|
+
if (value === undefined || value === null)
|
|
15
|
+
return '';
|
|
16
|
+
if (typeof value === 'string')
|
|
17
|
+
return value;
|
|
18
|
+
if (typeof value === 'number' || typeof value === 'boolean')
|
|
19
|
+
return String(value);
|
|
20
|
+
if (typeof value === 'object' && '$$mdtype' in value) {
|
|
21
|
+
const node = value;
|
|
22
|
+
if (node.$$mdtype === 'Variable' && Array.isArray(node.path)) {
|
|
23
|
+
let current = variables;
|
|
24
|
+
for (const segment of node.path) {
|
|
25
|
+
if (current === null || current === undefined)
|
|
26
|
+
return '';
|
|
27
|
+
current = current[segment];
|
|
28
|
+
}
|
|
29
|
+
return current === null || current === undefined ? '' : String(current);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return '';
|
|
33
|
+
}
|
|
34
|
+
/** Build a `fence` AST node that renders a clear error message in place of
|
|
35
|
+
* the snippet. Used when resolution fails (sandbox, missing file, malformed
|
|
36
|
+
* lines, unresolvable variable reference). The fence carries the original
|
|
37
|
+
* attempted path in `source` so tooling can still detect snippet
|
|
38
|
+
* provenance, plus a `data-snippet-error` raw data-attr that's
|
|
39
|
+
* forwarded through the fence transform for the error styling hook. */
|
|
40
|
+
function makeErrorFence(pathAttr, message) {
|
|
41
|
+
return new Ast.Node('fence', {
|
|
42
|
+
content: `snippet error: ${message}\n`,
|
|
43
|
+
language: 'text',
|
|
44
|
+
source: pathAttr || '(unresolved)',
|
|
45
|
+
'data-snippet-error': message,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function resolveSnippetToFence(tag, page, ctx, files) {
|
|
49
|
+
const pathAttr = resolveAttributeValue(tag.attributes.path, ctx.variables);
|
|
50
|
+
const lines = tag.attributes.lines !== undefined
|
|
51
|
+
? resolveAttributeValue(tag.attributes.lines, ctx.variables)
|
|
52
|
+
: undefined;
|
|
53
|
+
const langAttr = tag.attributes.lang !== undefined
|
|
54
|
+
? resolveAttributeValue(tag.attributes.lang, ctx.variables)
|
|
55
|
+
: undefined;
|
|
56
|
+
// WORK-304 — propagate author-set fence-level annotations from the
|
|
57
|
+
// snippet rune through to the fence node. The fence schema renders
|
|
58
|
+
// them as `data-linenumbers` / `data-highlight-lines`. `linenumbers`
|
|
59
|
+
// arrives as a Boolean from the rune schema; `highlight` as a String.
|
|
60
|
+
const linenumbers = tag.attributes.linenumbers === true;
|
|
61
|
+
const highlight = tag.attributes.highlight !== undefined
|
|
62
|
+
? resolveAttributeValue(tag.attributes.highlight, ctx.variables)
|
|
63
|
+
: undefined;
|
|
64
|
+
// SPEC-131 — anchor attributes. Resolution lands in the shared reader, so
|
|
65
|
+
// `file-ref` gains the same capability from the same change.
|
|
66
|
+
const str = (name) => tag.attributes[name] !== undefined
|
|
67
|
+
? resolveAttributeValue(tag.attributes[name], ctx.variables)
|
|
68
|
+
: undefined;
|
|
69
|
+
const anchor = {
|
|
70
|
+
symbol: str('symbol'),
|
|
71
|
+
match: str('match'),
|
|
72
|
+
occurrence: tag.attributes.occurrence !== undefined ? Number(tag.attributes.occurrence) : undefined,
|
|
73
|
+
extent: str('extent'),
|
|
74
|
+
until: str('until'),
|
|
75
|
+
through: str('through'),
|
|
76
|
+
doc: tag.attributes.doc === undefined ? undefined : tag.attributes.doc === true,
|
|
77
|
+
};
|
|
78
|
+
const reindentAttr = tag.attributes.reindent === undefined ? undefined : tag.attributes.reindent === true;
|
|
79
|
+
const highlightMatch = str('highlight-match');
|
|
80
|
+
const reviewedAttr = str('reviewed');
|
|
81
|
+
if (!pathAttr) {
|
|
82
|
+
const msg = 'snippet `path` attribute is required (and an unresolvable variable reference resolves to empty)';
|
|
83
|
+
ctx.error(msg, page.url);
|
|
84
|
+
return makeErrorFence('', msg);
|
|
85
|
+
}
|
|
86
|
+
let result;
|
|
87
|
+
try {
|
|
88
|
+
result = readSnippetFile({
|
|
89
|
+
files,
|
|
90
|
+
pathAttr,
|
|
91
|
+
lines: lines || undefined,
|
|
92
|
+
anchor,
|
|
93
|
+
lang: langAttr || undefined,
|
|
94
|
+
referencingPage: page.relativePath,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
if (err instanceof SnippetSandboxError) {
|
|
99
|
+
ctx.error(err.message, page.url);
|
|
100
|
+
return makeErrorFence(pathAttr, err.message);
|
|
101
|
+
}
|
|
102
|
+
// Unexpected error type — still produce an error fence so the build
|
|
103
|
+
// doesn't crash on a single page.
|
|
104
|
+
const msg = err.message ?? String(err);
|
|
105
|
+
ctx.error(`snippet "${pathAttr}" failed unexpectedly: ${msg}`, page.url);
|
|
106
|
+
return makeErrorFence(pathAttr, msg);
|
|
107
|
+
}
|
|
108
|
+
for (const warning of result.warnings) {
|
|
109
|
+
ctx.warn(warning, page.url);
|
|
110
|
+
}
|
|
111
|
+
// SPEC-134 — the review marker. Evaluated only after the anchor resolved,
|
|
112
|
+
// because D9 layers the two features: SPEC-131 answers *can I find the
|
|
113
|
+
// region* and refuses if not, so a refusal never reaches here at all.
|
|
114
|
+
//
|
|
115
|
+
// A finding is a `PipelineWarning` beside the page and **nothing is
|
|
116
|
+
// rendered into it** (D6). This is deliberately different from SPEC-131's
|
|
117
|
+
// error fence, and the difference is principled: there, the content could
|
|
118
|
+
// not be produced, so the fence takes its place. Here the content was
|
|
119
|
+
// produced perfectly — real, current, correctly located. What is uncertain
|
|
120
|
+
// is the prose beside it, which the resolver cannot see. Replacing a
|
|
121
|
+
// correct code block with an error because a paragraph *might* be stale is
|
|
122
|
+
// a straightforward regression for every reader.
|
|
123
|
+
if (reviewedAttr && reviewedAttr.length > 0) {
|
|
124
|
+
const stored = parseMarker(reviewedAttr);
|
|
125
|
+
const comparison = compareMarker(stored.strict, result.content, stored.loose);
|
|
126
|
+
if (comparison.verdict === 'stale') {
|
|
127
|
+
// Deliberately no diff here: at transform time the only record of
|
|
128
|
+
// the reviewed version is its hash, and a hash cannot be turned
|
|
129
|
+
// back into content. `refrakt snippet review --update` recovers the
|
|
130
|
+
// old slice from git and shows the diff — which is why D5's "show
|
|
131
|
+
// content, never hashes" is the CLI's job rather than this one's.
|
|
132
|
+
ctx.warn(`snippet \`${pathAttr}\` has changed since it was last reviewed. Re-read the prose ` +
|
|
133
|
+
'around it, then run `refrakt snippet review --update` to see the diff and re-stamp.', page.url);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const language = langAttr && langAttr.length > 0 ? langAttr : inferLanguage(result.relativePath);
|
|
137
|
+
// WORK-589 — presentation runs strictly **after** the resolved range is
|
|
138
|
+
// fixed, so `reindent` can never shift the coordinates `linenumbers` and a
|
|
139
|
+
// numeric `highlight` read (D13). `highlight-match` is computed against the
|
|
140
|
+
// pre-reindent text because reindent changes columns, not lines.
|
|
141
|
+
const highlightMatchLinesFound = highlightMatch
|
|
142
|
+
? highlightMatchLines(result.content, parseHighlightMatch(highlightMatch))
|
|
143
|
+
: [];
|
|
144
|
+
const content = shouldReindent(result.anchored, reindentAttr)
|
|
145
|
+
? reindent(result.content)
|
|
146
|
+
: result.content;
|
|
147
|
+
// WORK-304 — write unprefixed `source` / `lines` directly. The fence
|
|
148
|
+
// schema renders them as `data-source` / `data-lines`. `linenumbers` /
|
|
149
|
+
// `highlight` are propagated from the rune attributes (file-coordinate
|
|
150
|
+
// semantics — see WORK-304 acceptance criteria).
|
|
151
|
+
const fenceAttrs = {
|
|
152
|
+
content,
|
|
153
|
+
language,
|
|
154
|
+
source: result.relativePath,
|
|
155
|
+
};
|
|
156
|
+
// The coordinate frame survives anchoring (D13): an anchored slice reports
|
|
157
|
+
// the range it actually resolved to, so `linenumbers` still starts at the
|
|
158
|
+
// real file line and the displayed numbers stay a pointer back into it.
|
|
159
|
+
if (lines)
|
|
160
|
+
fenceAttrs.lines = lines;
|
|
161
|
+
else if (result.anchored && result.start !== undefined && result.end !== undefined) {
|
|
162
|
+
fenceAttrs.lines = `${result.start}-${result.end}`;
|
|
163
|
+
}
|
|
164
|
+
if (linenumbers)
|
|
165
|
+
fenceAttrs.linenumbers = true;
|
|
166
|
+
if (highlightMatchLinesFound.length > 0) {
|
|
167
|
+
// Slice offsets converted into the file frame the fence expects.
|
|
168
|
+
const base = result.start ?? 1;
|
|
169
|
+
fenceAttrs.highlight = formatHighlight(highlightMatchLinesFound.map((n) => n + base - 1));
|
|
170
|
+
}
|
|
171
|
+
else if (highlight && highlight.length > 0) {
|
|
172
|
+
fenceAttrs.highlight = highlight;
|
|
173
|
+
}
|
|
174
|
+
// Construct a fence Ast.Node. Markdoc parses ``` blocks as
|
|
175
|
+
// new Ast.Node('fence', { content, language }) — same shape here.
|
|
176
|
+
return new Ast.Node('fence', fenceAttrs);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Preprocess (SPEC-062, WORK-304): resolve + slice the source file and replace
|
|
180
|
+
* the tag with a Markdoc `fence` node. The fence carries `content` + `language`
|
|
181
|
+
* (so the code-block transform syntax-highlights it identically to a
|
|
182
|
+
* triple-backtick fence) plus `source` / `lines` and the author-set
|
|
183
|
+
* `linenumbers` / `highlight` annotations, which the fence schema renders as
|
|
184
|
+
* `data-source` / `data-lines` / `data-linenumbers` / `data-highlight-lines` on
|
|
185
|
+
* the output `<pre>` + `<code>`.
|
|
186
|
+
*
|
|
187
|
+
* That is the whole rune: there is no postProcess step (SPEC-141 D5). A
|
|
188
|
+
* standalone snippet renders as the `<pre data-source>` the fence produces —
|
|
189
|
+
* `pre[data-source]` is the selector for snippet-derived code — and container
|
|
190
|
+
* runes (`codegroup`, `diff`) see it as a regular fence and consume it
|
|
191
|
+
* transparently. Captions / titles are intentionally not provided — wrap a
|
|
192
|
+
* snippet in `{% codegroup title="..." %}` if you want a labelled chrome.
|
|
193
|
+
*
|
|
194
|
+
* Always produces a fence: sandbox / missing-file / variable-resolution errors
|
|
195
|
+
* produce an error fence, so the tag never reaches the throwing `transform`.
|
|
196
|
+
* The build keeps going and the failure is visible on the rendered page.
|
|
197
|
+
*
|
|
198
|
+
* No-op without a file provider (e.g. a tree-mode build that hasn't wired one
|
|
199
|
+
* yet) — the tag then falls through to the transform, which names the wiring.
|
|
200
|
+
*/
|
|
201
|
+
function preprocessSnippet(tag, page, ctx) {
|
|
202
|
+
if (!ctx.sandbox)
|
|
203
|
+
return;
|
|
204
|
+
return resolveSnippetToFence(tag, page, ctx, ctx.sandbox);
|
|
205
|
+
}
|
|
2
206
|
/**
|
|
3
207
|
* The `snippet` rune — embed a file's contents as a syntax-highlighted code
|
|
4
208
|
* block (SPEC-062).
|
|
5
209
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `transform` function is **unreachable in normal operation**.
|
|
210
|
+
* Snippet is an **AST preprocessor** rather than a transform-time rune: its
|
|
211
|
+
* `preprocess` hook (above) replaces every `{% snippet %}` tag with a Markdoc
|
|
212
|
+
* `fence` node before the schema-driven transform runs (SPEC-141). By the time
|
|
213
|
+
* the transform reaches the AST, no snippet tags exist — only fences. So this
|
|
214
|
+
* schema's `transform` function is **unreachable in normal operation**.
|
|
12
215
|
*
|
|
13
216
|
* The schema still exists for tooling: `refrakt inspect snippet`, the
|
|
14
217
|
* contracts generator, attribute validation, and the rune-catalog docs all
|
|
15
|
-
* read from it. If the transform ever does execute
|
|
16
|
-
*
|
|
17
|
-
* the user at the registration site.
|
|
218
|
+
* read from it. If the transform ever does execute, it throws a clear error
|
|
219
|
+
* naming the likely cause (SPEC-141 D7).
|
|
18
220
|
*/
|
|
19
221
|
export const snippet = createContentModelSchema({
|
|
20
222
|
attributes: {
|
|
@@ -96,8 +298,9 @@ export const snippet = createContentModelSchema({
|
|
|
96
298
|
},
|
|
97
299
|
},
|
|
98
300
|
contentModel: { type: 'sequence', fields: [] },
|
|
301
|
+
preprocess: preprocessSnippet,
|
|
99
302
|
transform(_resolved, _attrs) {
|
|
100
|
-
// Unreachable in normal operation —
|
|
303
|
+
// Unreachable in normal operation — the `preprocess` hook above
|
|
101
304
|
// replaces snippet tags with fence nodes before the transform runs.
|
|
102
305
|
//
|
|
103
306
|
// The reachable case is a content author's, not a framework author's:
|