@liquid-js/lyr-extras 22.0.0-alpha.4 → 22.0.0-alpha.6

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.
@@ -0,0 +1,398 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, Directive, ElementRef, ViewEncapsulation, booleanAttribute, computed, contentChildren, inject, input, viewChild, viewChildren } from "@angular/core";
3
+ import { RemarkNodeComponent, RemarkTemplateDirective, RemarkTemplatesService } from "ngx-remark";
4
+ import { HighlightDirective, NXT_HIGHLIGHT_OPTIONS } from "nxt-highlightjs";
5
+ import { injectNbTexts } from "@liquid-js/lyr-core";
6
+ const voidElements = /* @__PURE__ */ new Set([
7
+ "br",
8
+ "wbr",
9
+ "img",
10
+ "hr"
11
+ ]);
12
+ const openingTag = /^<([a-z][a-z0-9-]*)(?:\s[^>]*)?>$/i;
13
+ const selfClosingTag = /^<([a-z][a-z0-9-]*)(?:\s[^>]*)?\/>$/i;
14
+ const closingTag = /^<\/([a-z][a-z0-9-]*)\s*>$/i;
15
+ const blockParents$1 = /* @__PURE__ */ new Set([
16
+ "root",
17
+ "blockquote",
18
+ "listItem",
19
+ "footnoteDefinition",
20
+ "nbFootnotes"
21
+ ]);
22
+ function tagName(node, pattern) {
23
+ return node.type === "html" ? pattern.exec(node.value)?.[1].toLowerCase() : void 0;
24
+ }
25
+ function pairTags(children) {
26
+ const paired = new Array();
27
+ for (let index = 0; index < children.length; index++) {
28
+ const child = children[index];
29
+ const name = tagName(child, openingTag);
30
+ const selfClosing = tagName(child, selfClosingTag);
31
+ if (selfClosing || name && voidElements.has(name)) {
32
+ paired.push({
33
+ type: "nbHtmlElement",
34
+ tagName: selfClosing ?? name ?? "",
35
+ children: []
36
+ });
37
+ continue;
38
+ }
39
+ if (!name) {
40
+ paired.push(child);
41
+ continue;
42
+ }
43
+ let depth = 0;
44
+ let end = index + 1;
45
+ for (; end < children.length; end++) if (tagName(children[end], openingTag) === name) depth++;
46
+ else if (tagName(children[end], closingTag) === name && depth-- === 0) break;
47
+ if (end === children.length) {
48
+ paired.push(child);
49
+ continue;
50
+ }
51
+ const content = pairTags(children.slice(index + 1, end));
52
+ paired.push({
53
+ type: "nbHtmlElement",
54
+ tagName: name,
55
+ children: content
56
+ });
57
+ index = end;
58
+ }
59
+ return paired;
60
+ }
61
+ function isTight(node) {
62
+ if (node.type !== "list" || node.spread) return false;
63
+ return node.children.every((item) => !(item.spread ?? item.children.length > 1));
64
+ }
65
+ function prepareTree(tree) {
66
+ const definitions = /* @__PURE__ */ new Map();
67
+ const footnotes = new Array();
68
+ const collect = (node) => {
69
+ if (node.type === "definition") definitions.set(node.identifier, node);
70
+ if ("children" in node) node.children.forEach(collect);
71
+ };
72
+ collect(tree);
73
+ const transform = (node) => {
74
+ if (!("children" in node)) return;
75
+ const children = new Array();
76
+ for (const child of node.children) {
77
+ if (child.type === "definition") continue;
78
+ if (child.type === "footnoteDefinition") {
79
+ footnotes.push(child);
80
+ transform(child);
81
+ continue;
82
+ }
83
+ if (child.type === "linkReference") {
84
+ const { url = "", title } = definitions.get(child.identifier) ?? {};
85
+ const link = {
86
+ type: "link",
87
+ url,
88
+ title,
89
+ children: child.children
90
+ };
91
+ transform(link);
92
+ children.push(link);
93
+ continue;
94
+ }
95
+ if (child.type === "imageReference") {
96
+ const { url = "", title } = definitions.get(child.identifier) ?? {};
97
+ children.push({
98
+ type: "image",
99
+ url,
100
+ title,
101
+ alt: child.alt
102
+ });
103
+ continue;
104
+ }
105
+ transform(child);
106
+ if (child.type === "listItem" && isTight(node)) child.children = child.children.flatMap((content) => content.type === "paragraph" ? content.children : [content]);
107
+ children.push(child);
108
+ }
109
+ node.children = children.some((child) => child.type === "html") && !blockParents$1.has(node.type) ? pairTags(children) : children;
110
+ };
111
+ transform(tree);
112
+ if (footnotes.length) {
113
+ for (const footnote of footnotes) {
114
+ const back = {
115
+ type: "nbFootnoteBack",
116
+ identifier: footnote.identifier
117
+ };
118
+ const last = footnote.children.at(-1);
119
+ if (last?.type === "paragraph") last.children.push(back);
120
+ else footnote.children.push({
121
+ type: "paragraph",
122
+ children: [back]
123
+ });
124
+ }
125
+ tree.children.push({
126
+ type: "nbFootnotes",
127
+ children: footnotes
128
+ });
129
+ }
130
+ return tree;
131
+ }
132
+ function injectNbMarkdownViewerTexts() {
133
+ return injectNbTexts("markdownViewer", () => ({
134
+ footnotes: $localize`:@@nb.markdownViewer.footnotes:Footnotes`,
135
+ backToText: $localize`:@@nb.markdownViewer.backToText:Back to the text`
136
+ }));
137
+ }
138
+ const htmlElements = /* @__PURE__ */ new Set([
139
+ "abbr",
140
+ "b",
141
+ "br",
142
+ "cite",
143
+ "code",
144
+ "del",
145
+ "em",
146
+ "i",
147
+ "ins",
148
+ "kbd",
149
+ "mark",
150
+ "s",
151
+ "samp",
152
+ "small",
153
+ "span",
154
+ "strong",
155
+ "sub",
156
+ "sup",
157
+ "u",
158
+ "var",
159
+ "wbr"
160
+ ]);
161
+ const blockParents = /* @__PURE__ */ new Set([
162
+ "root",
163
+ "blockquote",
164
+ "listItem",
165
+ "footnoteDefinition"
166
+ ]);
167
+ let nextId = 0;
168
+ var NbMarkdownRendering = class NbMarkdownRendering {
169
+ constructor() {
170
+ this.markdown = input("", ...ngDevMode ? [{ debugName: "markdown" }] : /* istanbul ignore next */ []);
171
+ this.autoDirection = input(false, {
172
+ ...ngDevMode ? { debugName: "autoDirection" } : /* istanbul ignore next */ {},
173
+ transform: booleanAttribute
174
+ });
175
+ this.tree = computed(() => {
176
+ const processor = this.parser();
177
+ return prepareTree(processor.runSync(processor.parse(this.markdown())));
178
+ }, ...ngDevMode ? [{ debugName: "tree" }] : /* istanbul ignore next */ []);
179
+ this.id = `nb-markdown-${nextId++}`;
180
+ this.texts = injectNbMarkdownViewerTexts();
181
+ this.htmlElements = htmlElements;
182
+ this.blockParents = blockParents;
183
+ this.element = inject(ElementRef);
184
+ this.highlighting = !!inject(NXT_HIGHLIGHT_OPTIONS, { optional: true });
185
+ this.defaultTemplates = viewChildren(RemarkTemplateDirective, ...ngDevMode ? [{ debugName: "defaultTemplates" }] : /* istanbul ignore next */ []);
186
+ this.customTemplates = contentChildren(RemarkTemplateDirective, ...ngDevMode ? [{ debugName: "customTemplates" }] : /* istanbul ignore next */ []);
187
+ this.fallback = viewChild.required("fallback", ...ngDevMode ? [{ debugName: "fallback" }] : /* istanbul ignore next */ []);
188
+ inject(RemarkTemplatesService).templates = computed(() => {
189
+ const templates = {};
190
+ for (const template of [...this.defaultTemplates(), ...this.customTemplates()]) templates[template.nodeType()] = template.template;
191
+ const fallback = this.fallback();
192
+ return new Proxy(templates, { get: (target, type) => target[type] ?? fallback });
193
+ }, ...ngDevMode ? [{ debugName: "templates" }] : /* istanbul ignore next */ []);
194
+ }
195
+ direction(parent) {
196
+ return this.autoDirection() && parent.type === "root" ? "auto" : null;
197
+ }
198
+ footnoteId(identifier, reference = false) {
199
+ return `${this.id}-${reference ? "fnref" : "fn"}-${identifier}`;
200
+ }
201
+ showFootnote(event, id) {
202
+ const target = this.element.nativeElement.querySelector(`#${CSS.escape(id)}`);
203
+ if (target) {
204
+ event.preventDefault();
205
+ target.scrollIntoView();
206
+ }
207
+ }
208
+ static {
209
+ this.ɵfac = i0.ɵɵngDeclareFactory({
210
+ minVersion: "12.0.0",
211
+ version: "22.3.0",
212
+ ngImport: i0,
213
+ type: NbMarkdownRendering,
214
+ deps: [],
215
+ target: i0.ɵɵFactoryTarget.Directive
216
+ });
217
+ }
218
+ static {
219
+ this.ɵdir = i0.ɵɵngDeclareDirective({
220
+ minVersion: "17.2.0",
221
+ version: "22.3.0",
222
+ type: NbMarkdownRendering,
223
+ isStandalone: true,
224
+ inputs: {
225
+ markdown: {
226
+ classPropertyName: "markdown",
227
+ publicName: "markdown",
228
+ isSignal: true,
229
+ isRequired: false,
230
+ transformFunction: null
231
+ },
232
+ autoDirection: {
233
+ classPropertyName: "autoDirection",
234
+ publicName: "autoDirection",
235
+ isSignal: true,
236
+ isRequired: false,
237
+ transformFunction: null
238
+ }
239
+ },
240
+ queries: [{
241
+ propertyName: "customTemplates",
242
+ predicate: RemarkTemplateDirective,
243
+ isSignal: true
244
+ }],
245
+ viewQueries: [{
246
+ propertyName: "defaultTemplates",
247
+ predicate: RemarkTemplateDirective,
248
+ descendants: true,
249
+ isSignal: true
250
+ }, {
251
+ propertyName: "fallback",
252
+ first: true,
253
+ predicate: ["fallback"],
254
+ descendants: true,
255
+ isSignal: true
256
+ }],
257
+ ngImport: i0
258
+ });
259
+ }
260
+ };
261
+ i0.ɵɵngDeclareClassMetadata({
262
+ minVersion: "12.0.0",
263
+ version: "22.3.0",
264
+ ngImport: i0,
265
+ type: NbMarkdownRendering,
266
+ decorators: [{ type: Directive }],
267
+ ctorParameters: () => [],
268
+ propDecorators: {
269
+ markdown: [{
270
+ type: i0.Input,
271
+ args: [{
272
+ isSignal: true,
273
+ alias: "markdown",
274
+ required: false
275
+ }]
276
+ }],
277
+ autoDirection: [{
278
+ type: i0.Input,
279
+ args: [{
280
+ isSignal: true,
281
+ alias: "autoDirection",
282
+ required: false
283
+ }]
284
+ }],
285
+ defaultTemplates: [{
286
+ type: i0.ViewChildren,
287
+ args: [i0.forwardRef(() => RemarkTemplateDirective), { isSignal: true }]
288
+ }],
289
+ customTemplates: [{
290
+ type: i0.ContentChildren,
291
+ args: [i0.forwardRef(() => RemarkTemplateDirective), { isSignal: true }]
292
+ }],
293
+ fallback: [{
294
+ type: i0.ViewChild,
295
+ args: ["fallback", { isSignal: true }]
296
+ }]
297
+ }
298
+ });
299
+ var NbMarkdownRendererComponent = class NbMarkdownRendererComponent extends NbMarkdownRendering {
300
+ constructor() {
301
+ super(...arguments);
302
+ this.processor = input.required(...ngDevMode ? [{ debugName: "processor" }] : /* istanbul ignore next */ []);
303
+ }
304
+ parser() {
305
+ return this.processor();
306
+ }
307
+ static {
308
+ this.ɵfac = i0.ɵɵngDeclareFactory({
309
+ minVersion: "12.0.0",
310
+ version: "22.3.0",
311
+ ngImport: i0,
312
+ type: NbMarkdownRendererComponent,
313
+ deps: null,
314
+ target: i0.ɵɵFactoryTarget.Component
315
+ });
316
+ }
317
+ static {
318
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
319
+ minVersion: "17.0.0",
320
+ version: "22.3.0",
321
+ type: NbMarkdownRendererComponent,
322
+ isStandalone: true,
323
+ selector: "nb-markdown-renderer",
324
+ inputs: { processor: {
325
+ classPropertyName: "processor",
326
+ publicName: "processor",
327
+ isSignal: true,
328
+ isRequired: true,
329
+ transformFunction: null
330
+ } },
331
+ providers: [RemarkTemplatesService],
332
+ usesInheritance: true,
333
+ ngImport: i0,
334
+ template: "<div class=\"uf-contents\"\n [remarkNode]=\"tree()\"></div>\n\n<ng-template #fallback\n let-node>\n @if (node.children) {\n <remark-node [remarkNode]=\"node\" />\n }\n</ng-template>\n\n<!-- Blocks -->\n\n<p *remarkTemplate=\"'paragraph'; let node; let parent = parent\"\n [attr.dir]=\"direction(parent)\"\n [remarkNode]=\"node\"></p>\n\n<ng-template remarkTemplate=\"heading\"\n let-node\n let-parent=\"parent\">\n @let dir = direction(parent);\n @switch (node.depth) {\n @case (1) {\n <h1 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h1>\n }\n @case (2) {\n <h2 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h2>\n }\n @case (3) {\n <h3 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h3>\n }\n @case (4) {\n <h4 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h4>\n }\n @case (5) {\n <h5 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h5>\n }\n @default {\n <h6 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h6>\n }\n }\n</ng-template>\n\n<blockquote *remarkTemplate=\"'blockquote'; let node; let parent = parent\"\n [attr.dir]=\"direction(parent)\"\n [remarkNode]=\"node\"></blockquote>\n\n<ng-template remarkTemplate=\"list\"\n let-node\n let-parent=\"parent\">\n @if (node.ordered) {\n <ol [remarkNode]=\"node\"\n [attr.dir]=\"direction(parent)\"\n [attr.start]=\"node.start === 1 ? null : node.start\"></ol>\n } @else {\n <ul [attr.dir]=\"direction(parent)\"\n [remarkNode]=\"node\"></ul>\n }\n</ng-template>\n\n<ng-template remarkTemplate=\"listItem\"\n let-node>\n @if (node.checked === true || node.checked === false) {\n <li class=\"task-list-item\"\n [class.checked]=\"node.checked\">\n <!-- The state for assistive technology; the box is drawn in the item's styles. -->\n <input type=\"checkbox\"\n class=\"visually-hidden\"\n disabled\n [checked]=\"node.checked\" />\n <remark-node [remarkNode]=\"node\" />\n </li>\n } @else {\n <li [remarkNode]=\"node\"></li>\n }\n</ng-template>\n\n<ng-template remarkTemplate=\"code\"\n let-node>\n @if (highlighting) {\n <pre><code [nxtHighlight]=\"node.value\" [language]=\"node.lang ?? undefined\" [attr.data-language]=\"node.lang\"></code></pre>\n } @else {\n <pre><code [attr.data-language]=\"node.lang\">{{ node.value }}</code></pre>\n }\n</ng-template>\n\n<hr *remarkTemplate=\"'thematicBreak'\" />\n\n<ng-template remarkTemplate=\"html\"\n let-node\n let-parent=\"parent\">\n <!-- Tags in a line of text that aren't paired into an element are left out. -->\n @if (blockParents.has(parent.type)) {\n <div [attr.dir]=\"direction(parent)\"\n [innerHTML]=\"node.value\"></div>\n }\n</ng-template>\n\n<table *remarkTemplate=\"'table'; let node; let parent = parent\"\n [attr.dir]=\"direction(parent)\">\n <thead>\n @if (node.children[0]; as row) {\n <tr>\n @for (cell of row.children; track $index) {\n <th [remarkNode]=\"cell\"\n [style.text-align]=\"node.align?.[$index]\"></th>\n }\n </tr>\n }\n </thead>\n <tbody>\n @for (row of node.children.slice(1); track $index) {\n <tr>\n @for (cell of row.children; track $index) {\n <td [remarkNode]=\"cell\"\n [style.text-align]=\"node.align?.[$index]\"></td>\n }\n </tr>\n }\n </tbody>\n</table>\n\n<section *remarkTemplate=\"'nbFootnotes'; let node; let parent = parent\"\n class=\"nb-markdown-footnotes\"\n [attr.aria-label]=\"texts().footnotes\"\n [attr.dir]=\"direction(parent)\">\n <hr />\n <ol [remarkNode]=\"node\"></ol>\n</section>\n\n<!-- The way back from a footnote to its reference, after its text. -->\n<ng-template remarkTemplate=\"nbFootnoteBack\"\n let-node><a class=\"nb-markdown-footnote-back\"\n [href]=\"'#' + footnoteId(node.identifier, true)\"\n [attr.aria-label]=\"texts().backToText\"\n (click)=\"showFootnote($event, footnoteId(node.identifier, true))\">↩&#xFE0E;</a></ng-template>\n\n<li *remarkTemplate=\"'footnoteDefinition'; let node\"\n [id]=\"footnoteId(node.identifier)\"\n [remarkNode]=\"node\"></li>\n\n<!-- Text -->\n\n<ng-container *remarkTemplate=\"'text'; let node\">{{ node.value }}</ng-container>\n\n<em *remarkTemplate=\"'emphasis'; let node\"\n [remarkNode]=\"node\"></em>\n\n<strong *remarkTemplate=\"'strong'; let node\"\n [remarkNode]=\"node\"></strong>\n\n<del *remarkTemplate=\"'delete'; let node\"\n [remarkNode]=\"node\"></del>\n\n<code *remarkTemplate=\"'inlineCode'; let node\">{{ node.value }}</code>\n\n<br *remarkTemplate=\"'break'\" />\n\n<a *remarkTemplate=\"'link'; let node\"\n [href]=\"node.url\"\n [attr.title]=\"node.title\"\n [remarkNode]=\"node\"></a>\n\n<img *remarkTemplate=\"'image'; let node\"\n [src]=\"node.url\"\n [alt]=\"node.alt ?? ''\"\n [attr.title]=\"node.title\" />\n\n<sup *remarkTemplate=\"'footnoteReference'; let node\">\n <a [id]=\"footnoteId(node.identifier, true)\"\n [href]=\"'#' + footnoteId(node.identifier)\"\n (click)=\"showFootnote($event, footnoteId(node.identifier))\">{{ node.label }}</a>\n</sup>\n\n<ng-template remarkTemplate=\"nbHtmlElement\"\n let-node>\n @switch (htmlElements.has(node.tagName) ? node.tagName : '') {\n @case ('abbr') {\n <abbr [remarkNode]=\"node\"></abbr>\n }\n @case ('b') {\n <b [remarkNode]=\"node\"></b>\n }\n @case ('br') {\n <br />\n }\n @case ('cite') {\n <cite [remarkNode]=\"node\"></cite>\n }\n @case ('code') {\n <code [remarkNode]=\"node\"></code>\n }\n @case ('del') {\n <del [remarkNode]=\"node\"></del>\n }\n @case ('em') {\n <em [remarkNode]=\"node\"></em>\n }\n @case ('i') {\n <i [remarkNode]=\"node\"></i>\n }\n @case ('ins') {\n <ins [remarkNode]=\"node\"></ins>\n }\n @case ('kbd') {\n <kbd [remarkNode]=\"node\"></kbd>\n }\n @case ('mark') {\n <mark [remarkNode]=\"node\"></mark>\n }\n @case ('s') {\n <s [remarkNode]=\"node\"></s>\n }\n @case ('samp') {\n <samp [remarkNode]=\"node\"></samp>\n }\n @case ('small') {\n <small [remarkNode]=\"node\"></small>\n }\n @case ('span') {\n <span [remarkNode]=\"node\"></span>\n }\n @case ('strong') {\n <strong [remarkNode]=\"node\"></strong>\n }\n @case ('sub') {\n <sub [remarkNode]=\"node\"></sub>\n }\n @case ('sup') {\n <sup [remarkNode]=\"node\"></sup>\n }\n @case ('u') {\n <u [remarkNode]=\"node\"></u>\n }\n @case ('var') {\n <var [remarkNode]=\"node\"></var>\n }\n @case ('wbr') {\n <wbr />\n }\n @default {\n <remark-node [remarkNode]=\"node\" />\n }\n }\n</ng-template>\n",
335
+ styles: ["nb-markdown-renderer{display:block}nb-markdown-renderer remark-node{display:contents}\n"],
336
+ dependencies: [
337
+ {
338
+ kind: "component",
339
+ type: RemarkNodeComponent,
340
+ selector: "remark-node, [remarkNode]",
341
+ inputs: ["remarkNode"]
342
+ },
343
+ {
344
+ kind: "directive",
345
+ type: RemarkTemplateDirective,
346
+ selector: "[remarkTemplate]",
347
+ inputs: ["remarkTemplate"]
348
+ },
349
+ {
350
+ kind: "directive",
351
+ type: HighlightDirective,
352
+ selector: "[nxtHighlight]",
353
+ inputs: [
354
+ "nxtHighlight",
355
+ "language",
356
+ "ignoreIllegals"
357
+ ],
358
+ outputs: ["highlighted"]
359
+ }
360
+ ],
361
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
362
+ encapsulation: i0.ViewEncapsulation.None
363
+ });
364
+ }
365
+ };
366
+ i0.ɵɵngDeclareClassMetadata({
367
+ minVersion: "12.0.0",
368
+ version: "22.3.0",
369
+ ngImport: i0,
370
+ type: NbMarkdownRendererComponent,
371
+ decorators: [{
372
+ type: Component,
373
+ args: [{
374
+ selector: "nb-markdown-renderer",
375
+ encapsulation: ViewEncapsulation.None,
376
+ changeDetection: ChangeDetectionStrategy.OnPush,
377
+ providers: [RemarkTemplatesService],
378
+ imports: [
379
+ RemarkNodeComponent,
380
+ RemarkTemplateDirective,
381
+ HighlightDirective
382
+ ],
383
+ template: "<div class=\"uf-contents\"\n [remarkNode]=\"tree()\"></div>\n\n<ng-template #fallback\n let-node>\n @if (node.children) {\n <remark-node [remarkNode]=\"node\" />\n }\n</ng-template>\n\n<!-- Blocks -->\n\n<p *remarkTemplate=\"'paragraph'; let node; let parent = parent\"\n [attr.dir]=\"direction(parent)\"\n [remarkNode]=\"node\"></p>\n\n<ng-template remarkTemplate=\"heading\"\n let-node\n let-parent=\"parent\">\n @let dir = direction(parent);\n @switch (node.depth) {\n @case (1) {\n <h1 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h1>\n }\n @case (2) {\n <h2 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h2>\n }\n @case (3) {\n <h3 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h3>\n }\n @case (4) {\n <h4 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h4>\n }\n @case (5) {\n <h5 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h5>\n }\n @default {\n <h6 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h6>\n }\n }\n</ng-template>\n\n<blockquote *remarkTemplate=\"'blockquote'; let node; let parent = parent\"\n [attr.dir]=\"direction(parent)\"\n [remarkNode]=\"node\"></blockquote>\n\n<ng-template remarkTemplate=\"list\"\n let-node\n let-parent=\"parent\">\n @if (node.ordered) {\n <ol [remarkNode]=\"node\"\n [attr.dir]=\"direction(parent)\"\n [attr.start]=\"node.start === 1 ? null : node.start\"></ol>\n } @else {\n <ul [attr.dir]=\"direction(parent)\"\n [remarkNode]=\"node\"></ul>\n }\n</ng-template>\n\n<ng-template remarkTemplate=\"listItem\"\n let-node>\n @if (node.checked === true || node.checked === false) {\n <li class=\"task-list-item\"\n [class.checked]=\"node.checked\">\n <!-- The state for assistive technology; the box is drawn in the item's styles. -->\n <input type=\"checkbox\"\n class=\"visually-hidden\"\n disabled\n [checked]=\"node.checked\" />\n <remark-node [remarkNode]=\"node\" />\n </li>\n } @else {\n <li [remarkNode]=\"node\"></li>\n }\n</ng-template>\n\n<ng-template remarkTemplate=\"code\"\n let-node>\n @if (highlighting) {\n <pre><code [nxtHighlight]=\"node.value\" [language]=\"node.lang ?? undefined\" [attr.data-language]=\"node.lang\"></code></pre>\n } @else {\n <pre><code [attr.data-language]=\"node.lang\">{{ node.value }}</code></pre>\n }\n</ng-template>\n\n<hr *remarkTemplate=\"'thematicBreak'\" />\n\n<ng-template remarkTemplate=\"html\"\n let-node\n let-parent=\"parent\">\n <!-- Tags in a line of text that aren't paired into an element are left out. -->\n @if (blockParents.has(parent.type)) {\n <div [attr.dir]=\"direction(parent)\"\n [innerHTML]=\"node.value\"></div>\n }\n</ng-template>\n\n<table *remarkTemplate=\"'table'; let node; let parent = parent\"\n [attr.dir]=\"direction(parent)\">\n <thead>\n @if (node.children[0]; as row) {\n <tr>\n @for (cell of row.children; track $index) {\n <th [remarkNode]=\"cell\"\n [style.text-align]=\"node.align?.[$index]\"></th>\n }\n </tr>\n }\n </thead>\n <tbody>\n @for (row of node.children.slice(1); track $index) {\n <tr>\n @for (cell of row.children; track $index) {\n <td [remarkNode]=\"cell\"\n [style.text-align]=\"node.align?.[$index]\"></td>\n }\n </tr>\n }\n </tbody>\n</table>\n\n<section *remarkTemplate=\"'nbFootnotes'; let node; let parent = parent\"\n class=\"nb-markdown-footnotes\"\n [attr.aria-label]=\"texts().footnotes\"\n [attr.dir]=\"direction(parent)\">\n <hr />\n <ol [remarkNode]=\"node\"></ol>\n</section>\n\n<!-- The way back from a footnote to its reference, after its text. -->\n<ng-template remarkTemplate=\"nbFootnoteBack\"\n let-node><a class=\"nb-markdown-footnote-back\"\n [href]=\"'#' + footnoteId(node.identifier, true)\"\n [attr.aria-label]=\"texts().backToText\"\n (click)=\"showFootnote($event, footnoteId(node.identifier, true))\">↩&#xFE0E;</a></ng-template>\n\n<li *remarkTemplate=\"'footnoteDefinition'; let node\"\n [id]=\"footnoteId(node.identifier)\"\n [remarkNode]=\"node\"></li>\n\n<!-- Text -->\n\n<ng-container *remarkTemplate=\"'text'; let node\">{{ node.value }}</ng-container>\n\n<em *remarkTemplate=\"'emphasis'; let node\"\n [remarkNode]=\"node\"></em>\n\n<strong *remarkTemplate=\"'strong'; let node\"\n [remarkNode]=\"node\"></strong>\n\n<del *remarkTemplate=\"'delete'; let node\"\n [remarkNode]=\"node\"></del>\n\n<code *remarkTemplate=\"'inlineCode'; let node\">{{ node.value }}</code>\n\n<br *remarkTemplate=\"'break'\" />\n\n<a *remarkTemplate=\"'link'; let node\"\n [href]=\"node.url\"\n [attr.title]=\"node.title\"\n [remarkNode]=\"node\"></a>\n\n<img *remarkTemplate=\"'image'; let node\"\n [src]=\"node.url\"\n [alt]=\"node.alt ?? ''\"\n [attr.title]=\"node.title\" />\n\n<sup *remarkTemplate=\"'footnoteReference'; let node\">\n <a [id]=\"footnoteId(node.identifier, true)\"\n [href]=\"'#' + footnoteId(node.identifier)\"\n (click)=\"showFootnote($event, footnoteId(node.identifier))\">{{ node.label }}</a>\n</sup>\n\n<ng-template remarkTemplate=\"nbHtmlElement\"\n let-node>\n @switch (htmlElements.has(node.tagName) ? node.tagName : '') {\n @case ('abbr') {\n <abbr [remarkNode]=\"node\"></abbr>\n }\n @case ('b') {\n <b [remarkNode]=\"node\"></b>\n }\n @case ('br') {\n <br />\n }\n @case ('cite') {\n <cite [remarkNode]=\"node\"></cite>\n }\n @case ('code') {\n <code [remarkNode]=\"node\"></code>\n }\n @case ('del') {\n <del [remarkNode]=\"node\"></del>\n }\n @case ('em') {\n <em [remarkNode]=\"node\"></em>\n }\n @case ('i') {\n <i [remarkNode]=\"node\"></i>\n }\n @case ('ins') {\n <ins [remarkNode]=\"node\"></ins>\n }\n @case ('kbd') {\n <kbd [remarkNode]=\"node\"></kbd>\n }\n @case ('mark') {\n <mark [remarkNode]=\"node\"></mark>\n }\n @case ('s') {\n <s [remarkNode]=\"node\"></s>\n }\n @case ('samp') {\n <samp [remarkNode]=\"node\"></samp>\n }\n @case ('small') {\n <small [remarkNode]=\"node\"></small>\n }\n @case ('span') {\n <span [remarkNode]=\"node\"></span>\n }\n @case ('strong') {\n <strong [remarkNode]=\"node\"></strong>\n }\n @case ('sub') {\n <sub [remarkNode]=\"node\"></sub>\n }\n @case ('sup') {\n <sup [remarkNode]=\"node\"></sup>\n }\n @case ('u') {\n <u [remarkNode]=\"node\"></u>\n }\n @case ('var') {\n <var [remarkNode]=\"node\"></var>\n }\n @case ('wbr') {\n <wbr />\n }\n @default {\n <remark-node [remarkNode]=\"node\" />\n }\n }\n</ng-template>\n",
384
+ styles: ["nb-markdown-renderer{display:block}nb-markdown-renderer remark-node{display:contents}\n"]
385
+ }]
386
+ }],
387
+ propDecorators: { processor: [{
388
+ type: i0.Input,
389
+ args: [{
390
+ isSignal: true,
391
+ alias: "processor",
392
+ required: true
393
+ }]
394
+ }] }
395
+ });
396
+ export { NbMarkdownRendererComponent, NbMarkdownRendering };
397
+
398
+ //# sourceMappingURL=liquid-js-lyr-extras-markdown-renderer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"liquid-js-lyr-extras-markdown-renderer.mjs","names":["blockParents"],"sources":["../../../packages/extras/markdown-renderer/src/markdown-tree.ts","../../../packages/extras/markdown-renderer/src/texts.ts","../../../packages/extras/markdown-renderer/src/markdown-rendering.ts","../../../packages/extras/markdown-renderer/src/markdown-renderer.component.ts","../../../packages/extras/markdown-renderer/src/markdown-renderer.component.html"],"sourcesContent":["import type { Definition, FootnoteDefinition, Html, Node, Nodes, Parent, Root, RootContent } from 'mdast'\n\n/** An inline HTML element of the markdown, e.g. `<kbd>Ctrl</kbd>`, with the markdown between its tags. */\nexport interface NbMarkdownHtmlElement extends Parent {\n type: 'nbHtmlElement'\n tagName: string\n}\n\n/** A link from a footnote back to where the text refers to it, at the end of the footnote. */\nexport interface NbMarkdownFootnoteBack extends Node {\n type: 'nbFootnoteBack'\n identifier: string\n}\n\n/** The footnotes, at the end of the document. */\nexport interface NbMarkdownFootnotes extends Parent {\n type: 'nbFootnotes'\n children: FootnoteDefinition[]\n}\n\ndeclare module 'mdast' {\n interface PhrasingContentMap {\n nbHtmlElement: NbMarkdownHtmlElement\n nbFootnoteBack: NbMarkdownFootnoteBack\n }\n interface RootContentMap {\n nbHtmlElement: NbMarkdownHtmlElement\n nbFootnoteBack: NbMarkdownFootnoteBack\n nbFootnotes: NbMarkdownFootnotes\n }\n}\n\nconst voidElements = new Set(['br', 'wbr', 'img', 'hr'])\nconst openingTag = /^<([a-z][a-z0-9-]*)(?:\\s[^>]*)?>$/i\nconst selfClosingTag = /^<([a-z][a-z0-9-]*)(?:\\s[^>]*)?\\/>$/i\nconst closingTag = /^<\\/([a-z][a-z0-9-]*)\\s*>$/i\n/** Parents of block content, whose HTML is a block of its own rather than tags in a line of text. */\nconst blockParents = new Set(['root', 'blockquote', 'listItem', 'footnoteDefinition', 'nbFootnotes'])\n\nfunction tagName(node: RootContent, pattern: RegExp) {\n return node.type === 'html' ? pattern.exec(node.value)?.[1].toLowerCase() : undefined\n}\n\n/** Pairs the opening and closing tags of HTML in a line of text into elements, with the content between them. */\nfunction pairTags(children: RootContent[]): RootContent[] {\n const paired = new Array<RootContent>()\n for (let index = 0; index < children.length; index++) {\n const child = children[index]\n const name = tagName(child, openingTag)\n const selfClosing = tagName(child, selfClosingTag)\n if (selfClosing || (name && voidElements.has(name))) {\n paired.push({ type: 'nbHtmlElement', tagName: selfClosing ?? name ?? '', children: [] })\n continue\n }\n if (!name) {\n paired.push(child)\n continue\n }\n let depth = 0\n let end = index + 1\n for (; end < children.length; end++) {\n if (tagName(children[end], openingTag) === name) {\n depth++\n } else if (tagName(children[end], closingTag) === name && depth-- === 0) {\n break\n }\n }\n if (end === children.length) {\n paired.push(child)\n continue\n }\n const content = pairTags(children.slice(index + 1, end)) as NbMarkdownHtmlElement['children']\n paired.push({ type: 'nbHtmlElement', tagName: name, children: content })\n index = end\n }\n return paired\n}\n\n/** Whether a list's items hold their text without paragraphs, as in `mdast-util-to-hast`. */\nfunction isTight(node: Nodes) {\n if (node.type !== 'list' || node.spread) {\n return false\n }\n return node.children.every((item) => !(item.spread ?? item.children.length > 1))\n}\n\n/**\n * Prepares the markdown's syntax tree for its templates, as `remark-rehype` prepares it for HTML: references become\n * links and images, a tight list's items lose their paragraphs, footnotes move to the end, and the tags of HTML in a\n * line of text are paired into elements.\n */\nexport function prepareTree(tree: Root) {\n const definitions = new Map<string, Definition>()\n const footnotes = new Array<FootnoteDefinition>()\n const collect = (node: Nodes) => {\n if (node.type === 'definition') {\n definitions.set(node.identifier, node)\n }\n if ('children' in node) {\n node.children.forEach(collect)\n }\n }\n collect(tree)\n\n const transform = (node: Nodes) => {\n if (!('children' in node)) {\n return\n }\n const children = new Array<RootContent>()\n for (const child of node.children as RootContent[]) {\n if (child.type === 'definition') {\n continue\n }\n if (child.type === 'footnoteDefinition') {\n footnotes.push(child)\n transform(child)\n continue\n }\n if (child.type === 'linkReference') {\n const { url = '', title } = definitions.get(child.identifier) ?? {}\n const link = { type: 'link', url, title, children: child.children } as const\n transform(link)\n children.push(link)\n continue\n }\n if (child.type === 'imageReference') {\n const { url = '', title } = definitions.get(child.identifier) ?? {}\n children.push({ type: 'image', url, title, alt: child.alt })\n continue\n }\n transform(child)\n if (child.type === 'listItem' && isTight(node)) {\n child.children = child.children.flatMap((content) =>\n content.type === 'paragraph' ? (content.children as typeof child.children) : [content]\n )\n }\n children.push(child)\n }\n const hasHtml = children.some((child): child is Html => child.type === 'html')\n node.children = (hasHtml && !blockParents.has(node.type) ? pairTags(children) : children) as typeof node.children\n }\n transform(tree)\n\n if (footnotes.length) {\n // Each footnote ends with a link back to where the text refers to it, as GitHub's do.\n for (const footnote of footnotes) {\n const back: NbMarkdownFootnoteBack = { type: 'nbFootnoteBack', identifier: footnote.identifier }\n const last = footnote.children.at(-1)\n if (last?.type === 'paragraph') {\n last.children.push(back)\n } else {\n footnote.children.push({ type: 'paragraph', children: [back] })\n }\n }\n tree.children.push({ type: 'nbFootnotes', children: footnotes })\n }\n return tree\n}\n","import { injectNbTexts, NbLocalize } from '@liquid-js/lyr-core'\n\n/** @internal */\ndeclare const $localize: NbLocalize\n\n/**\n * The texts of the markdown viewer. `provideNbTexts({ markdownViewer: { ... } })` changes them, and they're translated\n * with Angular's i18n, as `$localize` messages with ids like `@@nb.markdownViewer.footnotes`.\n */\nexport interface NbMarkdownViewerTexts {\n /** Names the footnotes at the end of the text. */\n footnotes: string\n /** Names the link at the end of a footnote back to where the text refers to it. */\n backToText: string\n}\n\ndeclare module '@liquid-js/lyr-core' {\n interface NbTexts {\n markdownViewer: NbMarkdownViewerTexts\n }\n}\n\n/** @internal */\nexport function injectNbMarkdownViewerTexts() {\n return injectNbTexts('markdownViewer', () => ({\n footnotes: $localize`:@@nb.markdownViewer.footnotes:Footnotes`,\n backToText: $localize`:@@nb.markdownViewer.backToText:Back to the text`\n }))\n}\n","import {\n booleanAttribute,\n computed,\n contentChildren,\n Directive,\n ElementRef,\n inject,\n input,\n TemplateRef,\n viewChild,\n viewChildren\n} from '@angular/core'\nimport type { Node, Root } from 'mdast'\nimport { RemarkTemplateDirective, RemarkTemplatesService } from 'ngx-remark'\nimport { NXT_HIGHLIGHT_OPTIONS } from 'nxt-highlightjs'\n\nimport { prepareTree } from './markdown-tree'\nimport { injectNbMarkdownViewerTexts } from './texts'\n\n/** A unified processor that parses markdown, with its plugins, e.g. `remark().use(remarkGfm)`. */\nexport interface NbMarkdownProcessor {\n parse(markdown: string): Node\n runSync(tree: Node): Node\n}\n\n/** HTML elements the markdown can use in a line of text, without their attributes. */\nconst htmlElements = new Set([\n 'abbr',\n 'b',\n 'br',\n 'cite',\n 'code',\n 'del',\n 'em',\n 'i',\n 'ins',\n 'kbd',\n 'mark',\n 's',\n 'samp',\n 'small',\n 'span',\n 'strong',\n 'sub',\n 'sup',\n 'u',\n 'var',\n 'wbr'\n])\n\nconst blockParents = new Set(['root', 'blockquote', 'listItem', 'footnoteDefinition'])\n\nlet nextId = 0\n\n/**\n * What `nb-markdown-renderer` and `nb-markdown-viewer` share: the markdown's syntax tree and the templates that render\n * it. They differ in the processor they parse with and in their styles. Each provides its own `RemarkTemplatesService`,\n * so templates put in it, and the templates' own content, find its templates.\n */\n@Directive()\nexport abstract class NbMarkdownRendering {\n /** The markdown to show. */\n readonly markdown = input('')\n /**\n * Gives each block of the document, e.g. a paragraph or a list, the direction of its own text (`dir=\"auto\"`), for\n * text in more than one direction; `false` by default.\n */\n readonly autoDirection = input(false, { transform: booleanAttribute })\n\n /** The markdown's syntax tree, as its templates render it. */\n readonly tree = computed(() => {\n const processor = this.parser()\n return prepareTree(processor.runSync(processor.parse(this.markdown())) as Root)\n })\n\n protected readonly id = `nb-markdown-${nextId++}`\n protected readonly texts = injectNbMarkdownViewerTexts()\n protected readonly htmlElements = htmlElements\n protected readonly blockParents = blockParents\n protected readonly element = inject<ElementRef<HTMLElement>>(ElementRef)\n /** Whether the app loads highlight.js for code, the same on the server and in the browser. */\n protected readonly highlighting = !!inject(NXT_HIGHLIGHT_OPTIONS, { optional: true })\n protected readonly defaultTemplates = viewChildren(RemarkTemplateDirective)\n protected readonly customTemplates = contentChildren(RemarkTemplateDirective)\n protected readonly fallback = viewChild.required<TemplateRef<unknown>>('fallback')\n\n constructor() {\n // A node without a template, e.g. of a plugin, shows its content.\n inject(RemarkTemplatesService).templates = computed(() => {\n const templates: Record<string, TemplateRef<unknown> | undefined> = {}\n for (const template of [...this.defaultTemplates(), ...this.customTemplates()]) {\n templates[template.nodeType()] = template.template\n }\n const fallback = this.fallback()\n return new Proxy(templates, { get: (target, type: string) => target[type] ?? fallback })\n })\n }\n\n /** The processor the markdown is parsed with. */\n protected abstract parser(): NbMarkdownProcessor\n\n /** `auto` for a block of the document, with `autoDirection`, which a block in a quote or a list shares. */\n protected direction(parent: Node) {\n return this.autoDirection() && parent.type === 'root' ? 'auto' : null\n }\n\n protected footnoteId(identifier: string, reference = false) {\n return `${this.id}-${reference ? 'fnref' : 'fn'}-${identifier}`\n }\n\n /** Moves to a footnote in the page, whose address the document's base would otherwise change. */\n protected showFootnote(event: Event, id: string) {\n const target = this.element.nativeElement.querySelector<HTMLElement>(`#${CSS.escape(id)}`)\n if (target) {\n event.preventDefault()\n target.scrollIntoView()\n }\n }\n}\n","import { ChangeDetectionStrategy, Component, input, ViewEncapsulation } from '@angular/core'\nimport { RemarkNodeComponent, RemarkTemplateDirective, RemarkTemplatesService } from 'ngx-remark'\nimport { HighlightDirective } from 'nxt-highlightjs'\n\nimport { NbMarkdownProcessor, NbMarkdownRendering } from './markdown-rendering'\n\n/**\n * Renders markdown with a processor of the app's, and no styles of its own, for an app that styles its content itself:\n *\n * ```html\n * <nb-markdown-renderer [markdown]=\"text\" [processor]=\"processor\" />\n * ```\n *\n * @stacked-example(Renderer, markdown/markdown-renderer.component)\n *\n * It renders as `nb-markdown-viewer` does, with the same templates, which templates of the app's replace the same way,\n * and the same `autoDirection`, footnotes and code highlighting. Unlike the viewer, it doesn't load `remark` or\n * `remark-smartypants` for a default processor, nor the editor's content styles: the processor is the app's, and the\n * content is styled by the app, in the element with class `uf-contents`.\n *\n * ```sh\n * npm install ngx-remark nxt-highlightjs highlight.js\n * ```\n *\n * Import `NbMarkdownRendererComponent` from `@liquid-js/lyr-extras/markdown-renderer`, and give it a processor that\n * parses markdown, e.g. with `unified` and `remark-parse`, which `ngx-remark` uses too:\n *\n * ```ts\n * import { unified } from 'unified';\n * import remarkParse from 'remark-parse';\n * import remarkGfm from 'remark-gfm';\n *\n * readonly processor = unified().use(remarkParse).use(remarkGfm).freeze();\n * ```\n */\n@Component({\n selector: 'nb-markdown-renderer',\n templateUrl: './markdown-renderer.component.html',\n styleUrl: './markdown-renderer.component.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [RemarkTemplatesService],\n imports: [RemarkNodeComponent, RemarkTemplateDirective, HighlightDirective]\n})\nexport class NbMarkdownRendererComponent extends NbMarkdownRendering {\n /** Parses the markdown, with the plugins the app uses. */\n readonly processor = input.required<NbMarkdownProcessor>()\n\n protected parser() {\n return this.processor()\n }\n}\n","<div class=\"uf-contents\"\n [remarkNode]=\"tree()\"></div>\n\n<ng-template #fallback\n let-node>\n @if (node.children) {\n <remark-node [remarkNode]=\"node\" />\n }\n</ng-template>\n\n<!-- Blocks -->\n\n<p *remarkTemplate=\"'paragraph'; let node; let parent = parent\"\n [attr.dir]=\"direction(parent)\"\n [remarkNode]=\"node\"></p>\n\n<ng-template remarkTemplate=\"heading\"\n let-node\n let-parent=\"parent\">\n @let dir = direction(parent);\n @switch (node.depth) {\n @case (1) {\n <h1 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h1>\n }\n @case (2) {\n <h2 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h2>\n }\n @case (3) {\n <h3 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h3>\n }\n @case (4) {\n <h4 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h4>\n }\n @case (5) {\n <h5 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h5>\n }\n @default {\n <h6 [attr.dir]=\"dir\"\n [remarkNode]=\"node\"></h6>\n }\n }\n</ng-template>\n\n<blockquote *remarkTemplate=\"'blockquote'; let node; let parent = parent\"\n [attr.dir]=\"direction(parent)\"\n [remarkNode]=\"node\"></blockquote>\n\n<ng-template remarkTemplate=\"list\"\n let-node\n let-parent=\"parent\">\n @if (node.ordered) {\n <ol [remarkNode]=\"node\"\n [attr.dir]=\"direction(parent)\"\n [attr.start]=\"node.start === 1 ? null : node.start\"></ol>\n } @else {\n <ul [attr.dir]=\"direction(parent)\"\n [remarkNode]=\"node\"></ul>\n }\n</ng-template>\n\n<ng-template remarkTemplate=\"listItem\"\n let-node>\n @if (node.checked === true || node.checked === false) {\n <li class=\"task-list-item\"\n [class.checked]=\"node.checked\">\n <!-- The state for assistive technology; the box is drawn in the item's styles. -->\n <input type=\"checkbox\"\n class=\"visually-hidden\"\n disabled\n [checked]=\"node.checked\" />\n <remark-node [remarkNode]=\"node\" />\n </li>\n } @else {\n <li [remarkNode]=\"node\"></li>\n }\n</ng-template>\n\n<ng-template remarkTemplate=\"code\"\n let-node>\n @if (highlighting) {\n <pre><code [nxtHighlight]=\"node.value\" [language]=\"node.lang ?? undefined\" [attr.data-language]=\"node.lang\"></code></pre>\n } @else {\n <pre><code [attr.data-language]=\"node.lang\">{{ node.value }}</code></pre>\n }\n</ng-template>\n\n<hr *remarkTemplate=\"'thematicBreak'\" />\n\n<ng-template remarkTemplate=\"html\"\n let-node\n let-parent=\"parent\">\n <!-- Tags in a line of text that aren't paired into an element are left out. -->\n @if (blockParents.has(parent.type)) {\n <div [attr.dir]=\"direction(parent)\"\n [innerHTML]=\"node.value\"></div>\n }\n</ng-template>\n\n<table *remarkTemplate=\"'table'; let node; let parent = parent\"\n [attr.dir]=\"direction(parent)\">\n <thead>\n @if (node.children[0]; as row) {\n <tr>\n @for (cell of row.children; track $index) {\n <th [remarkNode]=\"cell\"\n [style.text-align]=\"node.align?.[$index]\"></th>\n }\n </tr>\n }\n </thead>\n <tbody>\n @for (row of node.children.slice(1); track $index) {\n <tr>\n @for (cell of row.children; track $index) {\n <td [remarkNode]=\"cell\"\n [style.text-align]=\"node.align?.[$index]\"></td>\n }\n </tr>\n }\n </tbody>\n</table>\n\n<section *remarkTemplate=\"'nbFootnotes'; let node; let parent = parent\"\n class=\"nb-markdown-footnotes\"\n [attr.aria-label]=\"texts().footnotes\"\n [attr.dir]=\"direction(parent)\">\n <hr />\n <ol [remarkNode]=\"node\"></ol>\n</section>\n\n<!-- The way back from a footnote to its reference, after its text. -->\n<ng-template remarkTemplate=\"nbFootnoteBack\"\n let-node><a class=\"nb-markdown-footnote-back\"\n [href]=\"'#' + footnoteId(node.identifier, true)\"\n [attr.aria-label]=\"texts().backToText\"\n (click)=\"showFootnote($event, footnoteId(node.identifier, true))\">↩&#xFE0E;</a></ng-template>\n\n<li *remarkTemplate=\"'footnoteDefinition'; let node\"\n [id]=\"footnoteId(node.identifier)\"\n [remarkNode]=\"node\"></li>\n\n<!-- Text -->\n\n<ng-container *remarkTemplate=\"'text'; let node\">{{ node.value }}</ng-container>\n\n<em *remarkTemplate=\"'emphasis'; let node\"\n [remarkNode]=\"node\"></em>\n\n<strong *remarkTemplate=\"'strong'; let node\"\n [remarkNode]=\"node\"></strong>\n\n<del *remarkTemplate=\"'delete'; let node\"\n [remarkNode]=\"node\"></del>\n\n<code *remarkTemplate=\"'inlineCode'; let node\">{{ node.value }}</code>\n\n<br *remarkTemplate=\"'break'\" />\n\n<a *remarkTemplate=\"'link'; let node\"\n [href]=\"node.url\"\n [attr.title]=\"node.title\"\n [remarkNode]=\"node\"></a>\n\n<img *remarkTemplate=\"'image'; let node\"\n [src]=\"node.url\"\n [alt]=\"node.alt ?? ''\"\n [attr.title]=\"node.title\" />\n\n<sup *remarkTemplate=\"'footnoteReference'; let node\">\n <a [id]=\"footnoteId(node.identifier, true)\"\n [href]=\"'#' + footnoteId(node.identifier)\"\n (click)=\"showFootnote($event, footnoteId(node.identifier))\">{{ node.label }}</a>\n</sup>\n\n<ng-template remarkTemplate=\"nbHtmlElement\"\n let-node>\n @switch (htmlElements.has(node.tagName) ? node.tagName : '') {\n @case ('abbr') {\n <abbr [remarkNode]=\"node\"></abbr>\n }\n @case ('b') {\n <b [remarkNode]=\"node\"></b>\n }\n @case ('br') {\n <br />\n }\n @case ('cite') {\n <cite [remarkNode]=\"node\"></cite>\n }\n @case ('code') {\n <code [remarkNode]=\"node\"></code>\n }\n @case ('del') {\n <del [remarkNode]=\"node\"></del>\n }\n @case ('em') {\n <em [remarkNode]=\"node\"></em>\n }\n @case ('i') {\n <i [remarkNode]=\"node\"></i>\n }\n @case ('ins') {\n <ins [remarkNode]=\"node\"></ins>\n }\n @case ('kbd') {\n <kbd [remarkNode]=\"node\"></kbd>\n }\n @case ('mark') {\n <mark [remarkNode]=\"node\"></mark>\n }\n @case ('s') {\n <s [remarkNode]=\"node\"></s>\n }\n @case ('samp') {\n <samp [remarkNode]=\"node\"></samp>\n }\n @case ('small') {\n <small [remarkNode]=\"node\"></small>\n }\n @case ('span') {\n <span [remarkNode]=\"node\"></span>\n }\n @case ('strong') {\n <strong [remarkNode]=\"node\"></strong>\n }\n @case ('sub') {\n <sub [remarkNode]=\"node\"></sub>\n }\n @case ('sup') {\n <sup [remarkNode]=\"node\"></sup>\n }\n @case ('u') {\n <u [remarkNode]=\"node\"></u>\n }\n @case ('var') {\n <var [remarkNode]=\"node\"></var>\n }\n @case ('wbr') {\n <wbr />\n }\n @default {\n <remark-node [remarkNode]=\"node\" />\n }\n }\n</ng-template>\n"],"mappings":";;;;;AAgCA,MAAM,+BAAe,IAAI,IAAI;CAAC;CAAM;CAAO;CAAO;AAAI,CAAC;AACvD,MAAM,aAAa;AACnB,MAAM,iBAAiB;AACvB,MAAM,aAAa;AAEnB,MAAMA,iCAAe,IAAI,IAAI;CAAC;CAAQ;CAAc;CAAY;CAAsB;AAAa,CAAC;AAEpG,SAAS,QAAQ,MAAmB,SAAe;CAC/C,OAAO,KAAK,SAAS,SAAS,QAAQ,KAAK,KAAK,KAAK,CAAC,GAAG,EAAE,CAAC,YAAW,IAAK;AAChF;AAGA,SAAS,SAAS,UAAuB;CACrC,MAAM,SAAS,IAAI,MAAK;CACxB,KAAK,IAAI,QAAQ,GAAG,QAAQ,SAAS,QAAQ,SAAS;EAClD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