@analogjs/content 0.2.0-beta.9 → 0.2.0-rc.1

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,21 +1,66 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, Injectable, Directive, HostListener, Component, ViewEncapsulation, Input, PLATFORM_ID } from '@angular/core';
3
- import { ActivatedRoute, Router } from '@angular/router';
4
- import { isObservable, firstValueFrom, of } from 'rxjs';
2
+ import { inject, Directive, HostListener, InjectionToken, Injectable, PLATFORM_ID, Component, ViewEncapsulation, Input, NgZone } from '@angular/core';
3
+ import { DOCUMENT, Location, AsyncPipe, isPlatformBrowser } from '@angular/common';
4
+ import { Router, ActivatedRoute } from '@angular/router';
5
+ import { isObservable, firstValueFrom, of, from } from 'rxjs';
5
6
  import { map, switchMap, mergeMap, catchError } from 'rxjs/operators';
6
7
  import fm from 'front-matter';
7
- import { DOCUMENT, Location, AsyncPipe } from '@angular/common';
8
- import { DomSanitizer } from '@angular/platform-browser';
9
8
  import { marked } from 'marked';
9
+ import { gfmHeadingId } from 'marked-gfm-heading-id';
10
+ import { markedHighlight } from 'marked-highlight';
10
11
  import 'prismjs';
11
12
  import 'prismjs/plugins/toolbar/prism-toolbar';
12
- import 'prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard';
13
13
  import 'prismjs/components/prism-bash';
14
14
  import 'prismjs/components/prism-css';
15
15
  import 'prismjs/components/prism-javascript';
16
16
  import 'prismjs/components/prism-json';
17
17
  import 'prismjs/components/prism-markup';
18
18
  import 'prismjs/components/prism-typescript';
19
+ import 'prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard';
20
+ import { DomSanitizer } from '@angular/platform-browser';
21
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
22
+
23
+ class AnchorNavigationDirective {
24
+ constructor() {
25
+ this.document = inject(DOCUMENT);
26
+ this.location = inject(Location);
27
+ this.router = inject(Router);
28
+ }
29
+ handleNavigation(element) {
30
+ if (element instanceof HTMLAnchorElement &&
31
+ isInternalUrl(element, this.document) &&
32
+ hasTargetSelf(element) &&
33
+ !hasDownloadAttribute(element)) {
34
+ const { pathname, search, hash } = element;
35
+ const url = this.location.normalize(`${pathname}${search}${hash}`);
36
+ this.router.navigateByUrl(url);
37
+ return false;
38
+ }
39
+ return true;
40
+ }
41
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: AnchorNavigationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
42
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.0", type: AnchorNavigationDirective, isStandalone: true, selector: "[analogAnchorNavigation]", host: { listeners: { "click": "handleNavigation($event.target)" } }, ngImport: i0 }); }
43
+ }
44
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: AnchorNavigationDirective, decorators: [{
45
+ type: Directive,
46
+ args: [{
47
+ selector: '[analogAnchorNavigation]',
48
+ standalone: true,
49
+ }]
50
+ }], propDecorators: { handleNavigation: [{
51
+ type: HostListener,
52
+ args: ['click', ['$event.target']]
53
+ }] } });
54
+ function hasDownloadAttribute(anchorElement) {
55
+ return anchorElement.getAttribute('download') !== null;
56
+ }
57
+ function hasTargetSelf(anchorElement) {
58
+ return !anchorElement.target || anchorElement.target === '_self';
59
+ }
60
+ function isInternalUrl(anchorElement, document) {
61
+ return (anchorElement.host === document.location.host &&
62
+ anchorElement.protocol === document.location.protocol);
63
+ }
19
64
 
20
65
  /**
21
66
  * Returns the list of content files by filename with ?analog-content-list=true.
@@ -38,14 +83,55 @@ const getContentFiles = () => import.meta.glob(['/src/content/**/*.md'], {
38
83
  as: 'raw',
39
84
  });
40
85
 
86
+ function getSlug(filename) {
87
+ const parts = filename.match(/^(\\|\/)(.+(\\|\/))*(.+)\.(.+)$/);
88
+ return parts?.length ? parts[4] : '';
89
+ }
90
+ const CONTENT_FILES_LIST_TOKEN = new InjectionToken('@analogjs/content Content Files List', {
91
+ providedIn: 'root',
92
+ factory() {
93
+ const contentFiles = getContentFilesList();
94
+ return Object.keys(contentFiles).map((filename) => {
95
+ const attributes = contentFiles[filename];
96
+ const slug = attributes['slug'];
97
+ return {
98
+ filename,
99
+ attributes,
100
+ slug: slug ? encodeURI(slug) : encodeURI(getSlug(filename)),
101
+ };
102
+ });
103
+ },
104
+ });
105
+
41
106
  const CONTENT_FILES_TOKEN = new InjectionToken('@analogjs/content Content Files', {
42
107
  providedIn: 'root',
43
108
  factory() {
44
109
  const contentFiles = getContentFiles();
45
- return contentFiles;
110
+ const contentFilesList = inject(CONTENT_FILES_LIST_TOKEN);
111
+ const lookup = {};
112
+ contentFilesList.forEach((item) => {
113
+ const fileParts = item.filename.split('/');
114
+ const filePath = fileParts.slice(0, fileParts.length - 1).join('/');
115
+ lookup[item.filename] = `${filePath}/${item.slug}.md`;
116
+ });
117
+ const objectUsingSlugAttribute = {};
118
+ Object.entries(contentFiles).forEach((entry) => {
119
+ const filename = entry[0];
120
+ const value = entry[1];
121
+ const newFilename = lookup[filename];
122
+ if (newFilename !== undefined) {
123
+ objectUsingSlugAttribute[newFilename] = value;
124
+ }
125
+ });
126
+ return objectUsingSlugAttribute;
46
127
  },
47
128
  });
48
129
 
130
+ function parseRawContentFile(rawContentFile) {
131
+ const { body, attributes } = fm(rawContentFile);
132
+ return { content: body, attributes };
133
+ }
134
+
49
135
  async function waitFor(prom) {
50
136
  if (isObservable(prom)) {
51
137
  prom = firstValueFrom(prom);
@@ -57,11 +143,6 @@ async function waitFor(prom) {
57
143
  });
58
144
  }
59
145
 
60
- function parseRawContentFile(rawContentFile) {
61
- const { body, attributes } = fm(rawContentFile);
62
- return { content: body, attributes };
63
- }
64
-
65
146
  /// <reference types="vite/client" />
66
147
  /**
67
148
  * Retrieves the static content using the provided param and/or prefix.
@@ -80,7 +161,7 @@ function injectContent(param = 'slug', fallback = 'No Content Found') {
80
161
  if (!contentFile) {
81
162
  return of({
82
163
  attributes: {},
83
- filename,
164
+ filename: filename,
84
165
  slug: slug || '',
85
166
  content: fallback,
86
167
  });
@@ -109,24 +190,18 @@ function injectContent(param = 'slug', fallback = 'No Content Found') {
109
190
  }));
110
191
  }
111
192
 
112
- function getSlug(filename) {
113
- const parts = filename.match(/^(\\|\/)(.+(\\|\/))*(.+)\.(.+)$/);
114
- return parts?.length ? parts[4] : '';
193
+ class ContentRenderer {
194
+ async render(content) {
195
+ return content;
196
+ }
197
+ // eslint-disable-next-line
198
+ enhance() { }
199
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: ContentRenderer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
200
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: ContentRenderer }); }
115
201
  }
116
- const CONTENT_FILES_LIST_TOKEN = new InjectionToken('@analogjs/content Content Files List', {
117
- providedIn: 'root',
118
- factory() {
119
- const contentFiles = getContentFilesList();
120
- return Object.keys(contentFiles).map((filename) => {
121
- const attributes = contentFiles[filename];
122
- return {
123
- filename,
124
- attributes,
125
- slug: encodeURI(getSlug(filename)),
126
- };
127
- });
128
- },
129
- });
202
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: ContentRenderer, decorators: [{
203
+ type: Injectable
204
+ }] });
130
205
 
131
206
  function injectContentFiles(filterFn) {
132
207
  const allContentFiles = inject(CONTENT_FILES_LIST_TOKEN);
@@ -137,68 +212,156 @@ function injectContentFiles(filterFn) {
137
212
  return allContentFiles;
138
213
  }
139
214
 
140
- class ContentRenderer {
215
+ /**
216
+ * Credit goes to Scully for original implementation
217
+ * https://github.com/scullyio/scully/blob/main/libs/scully/src/lib/fileHanderPlugins/markdown.ts
218
+ */
219
+ class MarkedSetupService {
220
+ constructor() {
221
+ const renderer = new marked.Renderer();
222
+ renderer.code = (code, lang) => {
223
+ // Let's do a language based detection like on GitHub
224
+ // So we can still have non-interpreted mermaid code
225
+ if (lang === 'mermaid') {
226
+ return '<pre class="mermaid">' + code + '</pre>';
227
+ }
228
+ if (!lang) {
229
+ return '<pre><code>' + code + '</code></pre>';
230
+ }
231
+ const langClass = 'language-' + lang;
232
+ const html = '<pre class="' +
233
+ langClass +
234
+ '"><code class="' +
235
+ langClass +
236
+ '">' +
237
+ code +
238
+ '</code></pre>';
239
+ return html;
240
+ };
241
+ marked.use(gfmHeadingId(), markedHighlight({
242
+ async: true,
243
+ highlight: (code, lang) => {
244
+ lang = lang || 'typescript';
245
+ if (!Prism.languages[lang]) {
246
+ if (lang !== 'mermaid') {
247
+ console.warn(`Notice:
248
+ ---------------------------------------------------------------------------------------
249
+ The requested language '${lang}' is not available with the provided setup.
250
+ To enable, import your main.ts as:
251
+ import 'prismjs/components/prism-${lang}';
252
+ ---------------------------------------------------------------------------------------
253
+ `);
254
+ }
255
+ return code;
256
+ }
257
+ return Prism.highlight(code, Prism.languages[lang], lang);
258
+ },
259
+ }), {
260
+ renderer,
261
+ pedantic: false,
262
+ gfm: true,
263
+ breaks: false,
264
+ sanitize: false,
265
+ smartypants: false,
266
+ xhtml: false,
267
+ mangle: false,
268
+ });
269
+ this.marked = marked;
270
+ }
271
+ getMarkedInstance() {
272
+ return this.marked;
273
+ }
274
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: MarkedSetupService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
275
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: MarkedSetupService }); }
276
+ }
277
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: MarkedSetupService, decorators: [{
278
+ type: Injectable
279
+ }], ctorParameters: function () { return []; } });
280
+
281
+ class MarkdownContentRendererService {
282
+ constructor() {
283
+ this.platformId = inject(PLATFORM_ID);
284
+ this.#marked = inject(MarkedSetupService, { self: true });
285
+ }
286
+ #marked;
141
287
  async render(content) {
142
- return content;
288
+ return this.#marked.getMarkedInstance().parse(content);
143
289
  }
144
290
  // eslint-disable-next-line
145
291
  enhance() { }
146
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: ContentRenderer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
147
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: ContentRenderer }); }
292
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: MarkdownContentRendererService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
293
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: MarkdownContentRendererService }); }
148
294
  }
149
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: ContentRenderer, decorators: [{
295
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: MarkdownContentRendererService, decorators: [{
150
296
  type: Injectable
151
297
  }] });
298
+ function withMarkdownRenderer(options) {
299
+ return [
300
+ {
301
+ provide: ContentRenderer,
302
+ useFactory: () => new MarkdownContentRendererService(),
303
+ deps: [MarkedSetupService],
304
+ },
305
+ options?.loadMermaid
306
+ ? [
307
+ {
308
+ provide: MERMAID_IMPORT_TOKEN,
309
+ useFactory: options.loadMermaid,
310
+ },
311
+ ]
312
+ : [],
313
+ ];
314
+ }
315
+ function provideContent(...features) {
316
+ return [...features, MarkedSetupService];
317
+ }
318
+ const MERMAID_IMPORT_TOKEN = new InjectionToken('mermaid_import');
152
319
 
153
- class AnchorNavigationDirective {
320
+ class AnalogMarkdownRouteComponent {
154
321
  constructor() {
155
- this.document = inject(DOCUMENT);
156
- this.location = inject(Location);
157
- this.router = inject(Router);
322
+ this.sanitizer = inject(DomSanitizer);
323
+ this.route = inject(ActivatedRoute);
324
+ this.contentRenderer = inject(ContentRenderer);
325
+ this.content = this.sanitizer.bypassSecurityTrustHtml(this.route.snapshot.data['renderedAnalogContent']);
326
+ this.classes = 'analog-markdown-route';
158
327
  }
159
- handleNavigation(element) {
160
- if (element instanceof HTMLAnchorElement &&
161
- isInternalUrl(element, this.document) &&
162
- hasTargetSelf(element) &&
163
- !hasDownloadAttribute(element)) {
164
- const { pathname, search, hash } = element;
165
- const url = this.location.normalize(`${pathname}${search}${hash}`);
166
- this.router.navigateByUrl(url);
167
- return false;
168
- }
169
- return true;
328
+ ngAfterViewChecked() {
329
+ this.contentRenderer.enhance();
170
330
  }
171
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: AnchorNavigationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
172
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: AnchorNavigationDirective, isStandalone: true, selector: "[analogAnchorNavigation]", host: { listeners: { "click": "handleNavigation($event.target)" } }, ngImport: i0 }); }
331
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: AnalogMarkdownRouteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
332
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.0", type: AnalogMarkdownRouteComponent, isStandalone: true, selector: "analog-markdown-route", inputs: { classes: "classes" }, hostDirectives: [{ directive: AnchorNavigationDirective }], ngImport: i0, template: `<div [innerHTML]="content" [class]="classes"></div>`, isInline: true, encapsulation: i0.ViewEncapsulation.None, preserveWhitespaces: true }); }
173
333
  }
174
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: AnchorNavigationDirective, decorators: [{
175
- type: Directive,
334
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: AnalogMarkdownRouteComponent, decorators: [{
335
+ type: Component,
176
336
  args: [{
177
- selector: '[analogAnchorNavigation]',
337
+ selector: 'analog-markdown-route',
178
338
  standalone: true,
339
+ imports: [AsyncPipe],
340
+ hostDirectives: [AnchorNavigationDirective],
341
+ preserveWhitespaces: true,
342
+ encapsulation: ViewEncapsulation.None,
343
+ template: `<div [innerHTML]="content" [class]="classes"></div>`,
179
344
  }]
180
- }], propDecorators: { handleNavigation: [{
181
- type: HostListener,
182
- args: ['click', ['$event.target']]
345
+ }], propDecorators: { classes: [{
346
+ type: Input
183
347
  }] } });
184
- function hasDownloadAttribute(anchorElement) {
185
- return anchorElement.getAttribute('download') !== null;
186
- }
187
- function hasTargetSelf(anchorElement) {
188
- return !anchorElement.target || anchorElement.target === '_self';
189
- }
190
- function isInternalUrl(anchorElement, document) {
191
- return (anchorElement.host === document.location.host &&
192
- anchorElement.protocol === document.location.protocol);
193
- }
194
348
 
195
349
  class AnalogMarkdownComponent {
196
350
  constructor() {
197
351
  this.sanitizer = inject(DomSanitizer);
198
352
  this.route = inject(ActivatedRoute);
353
+ this.zone = inject(NgZone);
354
+ this.platformId = inject(PLATFORM_ID);
355
+ this.mermaidImport = inject(MERMAID_IMPORT_TOKEN, {
356
+ optional: true,
357
+ });
199
358
  this.content$ = of('');
200
359
  this.classes = 'analog-markdown';
201
360
  this.contentRenderer = inject(ContentRenderer);
361
+ if (isPlatformBrowser(this.platformId) && this.mermaidImport) {
362
+ // Mermaid can only be loaded on client side
363
+ this.loadMermaid(this.mermaidImport);
364
+ }
202
365
  }
203
366
  ngOnInit() {
204
367
  this.updateContent();
@@ -214,11 +377,26 @@ class AnalogMarkdownComponent {
214
377
  }
215
378
  ngAfterViewChecked() {
216
379
  this.contentRenderer.enhance();
380
+ this.zone.runOutsideAngular(() => this.mermaid?.default.run());
217
381
  }
218
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: AnalogMarkdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
219
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: AnalogMarkdownComponent, isStandalone: true, selector: "analog-markdown", inputs: { content: "content", classes: "classes" }, usesOnChanges: true, hostDirectives: [{ directive: AnchorNavigationDirective }], ngImport: i0, template: `<div [innerHTML]="content$ | async" [class]="classes"></div>`, isInline: true, dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], encapsulation: i0.ViewEncapsulation.None, preserveWhitespaces: true }); }
382
+ loadMermaid(mermaidImport) {
383
+ this.zone.runOutsideAngular(() =>
384
+ // Wrap into an observable to avoid redundant initialization once
385
+ // the markdown component is destroyed before the promise is resolved.
386
+ from(mermaidImport)
387
+ .pipe(takeUntilDestroyed())
388
+ .subscribe((mermaid) => {
389
+ this.mermaid = mermaid;
390
+ this.mermaid.default.initialize({ startOnLoad: false });
391
+ // Explicitly running mermaid as ngAfterViewChecked
392
+ // has probably already been called
393
+ this.mermaid?.default.run();
394
+ }));
395
+ }
396
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: AnalogMarkdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
397
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.0", type: AnalogMarkdownComponent, isStandalone: true, selector: "analog-markdown", inputs: { content: "content", classes: "classes" }, usesOnChanges: true, hostDirectives: [{ directive: AnchorNavigationDirective }], ngImport: i0, template: `<div [innerHTML]="content$ | async" [class]="classes"></div>`, isInline: true, dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], encapsulation: i0.ViewEncapsulation.None, preserveWhitespaces: true }); }
220
398
  }
221
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: AnalogMarkdownComponent, decorators: [{
399
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: AnalogMarkdownComponent, decorators: [{
222
400
  type: Component,
223
401
  args: [{
224
402
  selector: 'analog-markdown',
@@ -229,84 +407,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
229
407
  encapsulation: ViewEncapsulation.None,
230
408
  template: `<div [innerHTML]="content$ | async" [class]="classes"></div>`,
231
409
  }]
232
- }], propDecorators: { content: [{
410
+ }], ctorParameters: function () { return []; }, propDecorators: { content: [{
233
411
  type: Input
234
412
  }], classes: [{
235
413
  type: Input
236
414
  }] } });
237
415
 
238
- /**
239
- * Credit goes to Scully for original implementation
240
- * https://github.com/scullyio/scully/blob/main/libs/scully/src/lib/fileHanderPlugins/markdown.ts
241
- */
242
- const renderer = new marked.Renderer();
243
- // wrap code block the way Prism.js expects it
244
- renderer.code = function (code, lang) {
245
- // eslint-disable-next-line
246
- code = this.options.highlight(code, lang);
247
- if (!lang) {
248
- return '<pre><code>' + code + '</code></pre>';
249
- }
250
- // e.g. "language-js"
251
- const langClass = 'language-' + lang;
252
- return ('<pre class="' +
253
- langClass +
254
- '"><code class="' +
255
- langClass +
256
- '">' +
257
- code +
258
- '</code></pre>');
259
- };
260
- // ------------------------------
261
- class MarkdownContentRendererService {
262
- constructor() {
263
- this.platformId = inject(PLATFORM_ID);
264
- }
265
- async render(content) {
266
- marked.setOptions({
267
- renderer,
268
- highlight: (code, lang) => {
269
- lang = lang || 'typescript';
270
- if (!Prism.languages[lang]) {
271
- console.warn(`Notice:
272
- ---------------------------------------------------------------------------------------
273
- The requested language '${lang}' is not available with the provided setup.
274
- To enable, import your main.ts as:
275
- import 'prismjs/components/prism-${lang}';
276
- ---------------------------------------------------------------------------------------
277
- `);
278
- return code;
279
- }
280
- return Prism.highlight(code, Prism.languages[lang], lang);
281
- },
282
- pedantic: false,
283
- gfm: true,
284
- breaks: false,
285
- sanitize: false,
286
- smartLists: true,
287
- smartypants: false,
288
- xhtml: false,
289
- });
290
- return marked(content);
291
- }
292
- // eslint-disable-next-line
293
- enhance() { }
294
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MarkdownContentRendererService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
295
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MarkdownContentRendererService }); }
296
- }
297
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MarkdownContentRendererService, decorators: [{
298
- type: Injectable
299
- }] });
300
- function withMarkdownRenderer() {
301
- return { provide: ContentRenderer, useClass: MarkdownContentRendererService };
302
- }
303
- function provideContent(...features) {
304
- return [...features];
305
- }
306
-
307
416
  /**
308
417
  * Generated bundle index. Do not edit.
309
418
  */
310
419
 
311
- export { AnchorNavigationDirective, ContentRenderer, AnalogMarkdownComponent as MarkdownComponent, MarkdownContentRendererService, injectContent, injectContentFiles, parseRawContentFile, provideContent, withMarkdownRenderer };
420
+ export { AnchorNavigationDirective, ContentRenderer, AnalogMarkdownComponent as MarkdownComponent, MarkdownContentRendererService, AnalogMarkdownRouteComponent as MarkdownRouteComponent, injectContent, injectContentFiles, parseRawContentFile, provideContent, withMarkdownRenderer };
312
421
  //# sourceMappingURL=analogjs-content.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"analogjs-content.mjs","sources":["../../../../packages/content/src/lib/get-content-files.ts","../../../../packages/content/src/lib/content-files-token.ts","../../../../packages/content/src/lib/utils/zone-wait-for.ts","../../../../packages/content/src/lib/parse-raw-content-file.ts","../../../../packages/content/src/lib/content.ts","../../../../packages/content/src/lib/content-files-list-token.ts","../../../../packages/content/src/lib/inject-content-files.ts","../../../../packages/content/src/lib/content-renderer.ts","../../../../packages/content/src/lib/anchor-navigation.directive.ts","../../../../packages/content/src/lib/markdown.component.ts","../../../../packages/content/src/lib/markdown-content-renderer.service.ts","../../../../packages/content/src/analogjs-content.ts"],"sourcesContent":["/**\n * Returns the list of content files by filename with ?analog-content-list=true.\n * We use the query param to transform the return into an array of\n * just front matter attributes.\n *\n * @returns\n */\nexport const getContentFilesList = () =>\n import.meta.glob<Record<string, any>>('/src/content/**/*.md', {\n eager: true,\n import: 'default',\n query: { 'analog-content-list': true },\n });\n\n/**\n * Returns the lazy loaded content files for lookups.\n *\n * @returns\n */\nexport const getContentFiles = () =>\n import.meta.glob(['/src/content/**/*.md'], {\n as: 'raw',\n });\n","import { InjectionToken } from '@angular/core';\n\nimport { getContentFiles } from './get-content-files';\n\nexport const CONTENT_FILES_TOKEN = new InjectionToken<\n Record<string, () => Promise<string>>\n>('@analogjs/content Content Files', {\n providedIn: 'root',\n factory() {\n const contentFiles = getContentFiles();\n\n return contentFiles;\n },\n});\n","import { firstValueFrom, isObservable, Observable } from 'rxjs';\n\ndeclare const Zone: any;\n\nexport async function waitFor<T>(prom: Promise<T> | Observable<T>): Promise<T> {\n if (isObservable(prom)) {\n prom = firstValueFrom(prom);\n }\n const macroTask = Zone.current.scheduleMacroTask(\n `AnalogContentResolve-${Math.random()}`,\n () => {},\n {},\n () => {}\n );\n return prom.then((p: T) => {\n macroTask.invoke();\n return p;\n });\n}\n","import fm from 'front-matter';\n\nexport function parseRawContentFile<Attributes extends Record<string, any>>(\n rawContentFile: string\n): { content: string; attributes: Attributes } {\n const { body, attributes } = fm<Attributes>(rawContentFile);\n return { content: body, attributes };\n}\n","/// <reference types=\"vite/client\" />\n\nimport { inject } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { Observable, of } from 'rxjs';\nimport { map, switchMap } from 'rxjs/operators';\n\nimport { ContentFile } from './content-file';\nimport { CONTENT_FILES_TOKEN } from './content-files-token';\nimport { waitFor } from './utils/zone-wait-for';\nimport { parseRawContentFile } from './parse-raw-content-file';\n\n/**\n * Retrieves the static content using the provided param and/or prefix.\n *\n * @param param route parameter (default: 'slug')\n * @param fallback fallback text if content file is not found (default: 'No Content Found')\n */\nexport function injectContent<\n Attributes extends Record<string, any> = Record<string, any>\n>(\n param: string | { param: string; subdirectory: string } = 'slug',\n fallback = 'No Content Found'\n): Observable<ContentFile<Attributes | Record<string, never>>> {\n const route = inject(ActivatedRoute);\n const contentFiles = inject(CONTENT_FILES_TOKEN);\n const prefix = typeof param === 'string' ? '' : `${param.subdirectory}/`;\n const paramKey = typeof param === 'string' ? param : param.param;\n return route.paramMap.pipe(\n map((params) => params.get(paramKey)),\n switchMap((slug) => {\n const filename = `/src/content/${prefix}${slug}.md`;\n const contentFile = contentFiles[filename];\n\n if (!contentFile) {\n return of({\n attributes: {},\n filename,\n slug: slug || '',\n content: fallback,\n });\n }\n\n return new Promise<string>((resolve) => {\n const contentResolver = contentFile();\n\n if (import.meta.env.SSR === true) {\n waitFor(contentResolver).then((content) => {\n resolve(content);\n });\n } else {\n contentResolver.then((content) => {\n resolve(content);\n });\n }\n }).then((rawContentFile) => {\n const { content, attributes } =\n parseRawContentFile<Attributes>(rawContentFile);\n\n return {\n filename,\n slug: slug || '',\n attributes,\n content,\n };\n });\n })\n );\n}\n","import { InjectionToken } from '@angular/core';\n\nimport { ContentFile } from './content-file';\nimport { getContentFilesList } from './get-content-files';\n\nfunction getSlug(filename: string) {\n const parts = filename.match(/^(\\\\|\\/)(.+(\\\\|\\/))*(.+)\\.(.+)$/);\n return parts?.length ? parts[4] : '';\n}\n\nexport const CONTENT_FILES_LIST_TOKEN = new InjectionToken<ContentFile[]>(\n '@analogjs/content Content Files List',\n {\n providedIn: 'root',\n factory() {\n const contentFiles = getContentFilesList();\n\n return Object.keys(contentFiles).map((filename) => {\n const attributes = contentFiles[filename];\n\n return {\n filename,\n attributes,\n slug: encodeURI(getSlug(filename)),\n };\n });\n },\n }\n);\n","import { ContentFile } from './content-file';\nimport { inject } from '@angular/core';\nimport { CONTENT_FILES_LIST_TOKEN } from './content-files-list-token';\n\nexport function injectContentFiles<Attributes extends Record<string, any>>(\n filterFn?: InjectContentFilesFilterFunction<Attributes>\n): ContentFile<Attributes>[] {\n const allContentFiles = inject(\n CONTENT_FILES_LIST_TOKEN\n ) as ContentFile<Attributes>[];\n\n if (filterFn) {\n const filteredContentFiles = allContentFiles.filter(filterFn);\n\n return filteredContentFiles;\n }\n return allContentFiles;\n}\n\nexport type InjectContentFilesFilterFunction<T extends Record<string, any>> = (\n value: ContentFile<T>,\n index: number,\n array: ContentFile<T>[]\n) => boolean;\n","import { Injectable } from '@angular/core';\n\n@Injectable()\nexport abstract class ContentRenderer {\n async render(content: string): Promise<string> {\n return content;\n }\n\n // eslint-disable-next-line\n enhance() {}\n}\n","import { Directive, HostListener, inject } from '@angular/core';\nimport { DOCUMENT, Location } from '@angular/common';\nimport { Router } from '@angular/router';\n\n@Directive({\n selector: '[analogAnchorNavigation]',\n standalone: true,\n})\nexport class AnchorNavigationDirective {\n private readonly document = inject(DOCUMENT);\n private readonly location = inject(Location);\n private readonly router = inject(Router);\n\n @HostListener('click', ['$event.target'])\n handleNavigation(element: HTMLElement): boolean {\n if (\n element instanceof HTMLAnchorElement &&\n isInternalUrl(element, this.document) &&\n hasTargetSelf(element) &&\n !hasDownloadAttribute(element)\n ) {\n const { pathname, search, hash } = element;\n const url = this.location.normalize(`${pathname}${search}${hash}`);\n this.router.navigateByUrl(url);\n\n return false;\n }\n\n return true;\n }\n}\n\nfunction hasDownloadAttribute(anchorElement: HTMLAnchorElement): boolean {\n return anchorElement.getAttribute('download') !== null;\n}\n\nfunction hasTargetSelf(anchorElement: HTMLAnchorElement): boolean {\n return !anchorElement.target || anchorElement.target === '_self';\n}\n\nfunction isInternalUrl(\n anchorElement: HTMLAnchorElement,\n document: Document\n): boolean {\n return (\n anchorElement.host === document.location.host &&\n anchorElement.protocol === document.location.protocol\n );\n}\n","import { AsyncPipe } from '@angular/common';\nimport {\n AfterViewChecked,\n Component,\n inject,\n Input,\n OnInit,\n OnChanges,\n ViewEncapsulation,\n} from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { ActivatedRoute, Data } from '@angular/router';\nimport { Observable, of } from 'rxjs';\nimport { catchError, map, mergeMap } from 'rxjs/operators';\n\nimport { ContentRenderer } from './content-renderer';\nimport { AnchorNavigationDirective } from './anchor-navigation.directive';\n\n@Component({\n selector: 'analog-markdown',\n standalone: true,\n imports: [AsyncPipe],\n hostDirectives: [AnchorNavigationDirective],\n preserveWhitespaces: true,\n encapsulation: ViewEncapsulation.None,\n template: `<div [innerHTML]=\"content$ | async\" [class]=\"classes\"></div>`,\n})\nexport default class AnalogMarkdownComponent\n implements OnInit, OnChanges, AfterViewChecked\n{\n private sanitizer = inject(DomSanitizer);\n private route = inject(ActivatedRoute);\n public content$: Observable<SafeHtml> = of('');\n\n @Input() content!: string | undefined | null;\n @Input() classes = 'analog-markdown';\n\n contentRenderer = inject(ContentRenderer);\n\n ngOnInit() {\n this.updateContent();\n }\n\n ngOnChanges(): void {\n this.updateContent();\n }\n\n updateContent() {\n this.content$ = this.route.data.pipe(\n map<Data, string>((data) => this.content ?? data['_analogContent']),\n mergeMap((contentString) => this.renderContent(contentString)),\n map((content) => this.sanitizer.bypassSecurityTrustHtml(content)),\n catchError((e) => of(`There was an error ${e}`))\n );\n }\n\n async renderContent(content: string): Promise<string> {\n return this.contentRenderer.render(content);\n }\n\n ngAfterViewChecked() {\n this.contentRenderer.enhance();\n }\n}\n","/**\n * Credit goes to Scully for original implementation\n * https://github.com/scullyio/scully/blob/main/libs/scully/src/lib/fileHanderPlugins/markdown.ts\n */\nimport { inject, Injectable, PLATFORM_ID, Provider } from '@angular/core';\nimport { marked } from 'marked';\n\nimport 'prismjs';\nimport 'prismjs/plugins/toolbar/prism-toolbar';\nimport 'prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard';\nimport 'prismjs/components/prism-bash';\nimport 'prismjs/components/prism-css';\nimport 'prismjs/components/prism-javascript';\nimport 'prismjs/components/prism-json';\nimport 'prismjs/components/prism-markup';\nimport 'prismjs/components/prism-typescript';\n\nimport { ContentRenderer } from './content-renderer';\n\ndeclare const Prism: typeof import('prismjs');\n\nconst renderer = new marked.Renderer();\n// wrap code block the way Prism.js expects it\nrenderer.code = function (this: any, code, lang) {\n // eslint-disable-next-line\n code = this.options.highlight(code, lang);\n if (!lang) {\n return '<pre><code>' + code + '</code></pre>';\n }\n // e.g. \"language-js\"\n const langClass = 'language-' + lang;\n return (\n '<pre class=\"' +\n langClass +\n '\"><code class=\"' +\n langClass +\n '\">' +\n code +\n '</code></pre>'\n );\n};\n// ------------------------------\n\n@Injectable()\nexport class MarkdownContentRendererService implements ContentRenderer {\n platformId = inject(PLATFORM_ID);\n\n async render(content: string) {\n marked.setOptions({\n renderer,\n highlight: (code, lang) => {\n lang = lang || 'typescript';\n if (!Prism.languages[lang]) {\n console.warn(`Notice:\n ---------------------------------------------------------------------------------------\n The requested language '${lang}' is not available with the provided setup.\n To enable, import your main.ts as:\n import 'prismjs/components/prism-${lang}';\n ---------------------------------------------------------------------------------------\n `);\n return code;\n }\n return Prism.highlight(code, Prism.languages[lang], lang);\n },\n pedantic: false,\n gfm: true,\n breaks: false,\n sanitize: false,\n smartLists: true,\n smartypants: false,\n xhtml: false,\n });\n\n return marked(content);\n }\n\n // eslint-disable-next-line\n enhance() {}\n}\n\nexport function withMarkdownRenderer(): Provider {\n return { provide: ContentRenderer, useClass: MarkdownContentRendererService };\n}\n\nexport function provideContent(...features: Provider[]) {\n return [...features];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.AnchorNavigationDirective"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;AAMG;AACI,MAAM,mBAAmB,GAAG,MACjC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAsB,sBAAsB,EAAE;AAC5D,IAAA,KAAK,EAAE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AA,EAAA;;2FAA9B,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAD1C,UAAU;;SAqCK,oBAAoB,GAAA;IAClC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,8BAA8B,EAAE,CAAC;AAChF,CAAC;AAEe,SAAA,cAAc,CAAC,GAAG,QAAoB,EAAA;AACpD,IAAA,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC;AACvB;;ACtFA;;AAEG;;;;"}
1
+ {"version":3,"file":"analogjs-content.mjs","sources":["../../../../packages/content/src/lib/anchor-navigation.directive.ts","../../../../packages/content/src/lib/get-content-files.ts","../../../../packages/content/src/lib/content-files-list-token.ts","../../../../packages/content/src/lib/content-files-token.ts","../../../../packages/content/src/lib/parse-raw-content-file.ts","../../../../packages/content/src/lib/utils/zone-wait-for.ts","../../../../packages/content/src/lib/content.ts","../../../../packages/content/src/lib/content-renderer.ts","../../../../packages/content/src/lib/inject-content-files.ts","../../../../packages/content/src/lib/marked-setup.service.ts","../../../../packages/content/src/lib/markdown-content-renderer.service.ts","../../../../packages/content/src/lib/markdown-route.component.ts","../../../../packages/content/src/lib/markdown.component.ts","../../../../packages/content/src/analogjs-content.ts"],"sourcesContent":["import { Directive, HostListener, inject } from '@angular/core';\nimport { DOCUMENT, Location } from '@angular/common';\nimport { Router } from '@angular/router';\n\n@Directive({\n selector: '[analogAnchorNavigation]',\n standalone: true,\n})\nexport class AnchorNavigationDirective {\n private readonly document = inject(DOCUMENT);\n private readonly location = inject(Location);\n private readonly router = inject(Router);\n\n @HostListener('click', ['$event.target'])\n handleNavigation(element: HTMLElement): boolean {\n if (\n element instanceof HTMLAnchorElement &&\n isInternalUrl(element, this.document) &&\n hasTargetSelf(element) &&\n !hasDownloadAttribute(element)\n ) {\n const { pathname, search, hash } = element;\n const url = this.location.normalize(`${pathname}${search}${hash}`);\n this.router.navigateByUrl(url);\n\n return false;\n }\n\n return true;\n }\n}\n\nfunction hasDownloadAttribute(anchorElement: HTMLAnchorElement): boolean {\n return anchorElement.getAttribute('download') !== null;\n}\n\nfunction hasTargetSelf(anchorElement: HTMLAnchorElement): boolean {\n return !anchorElement.target || anchorElement.target === '_self';\n}\n\nfunction isInternalUrl(\n anchorElement: HTMLAnchorElement,\n document: Document\n): boolean {\n return (\n anchorElement.host === document.location.host &&\n anchorElement.protocol === document.location.protocol\n );\n}\n","/**\n * Returns the list of content files by filename with ?analog-content-list=true.\n * We use the query param to transform the return into an array of\n * just front matter attributes.\n *\n * @returns\n */\nexport const getContentFilesList = () =>\n import.meta.glob<Record<string, any>>('/src/content/**/*.md', {\n eager: true,\n import: 'default',\n query: { 'analog-content-list': true },\n });\n\n/**\n * Returns the lazy loaded content files for lookups.\n *\n * @returns\n */\nexport const getContentFiles = () =>\n import.meta.glob(['/src/content/**/*.md'], {\n as: 'raw',\n });\n","import { InjectionToken } from '@angular/core';\nimport { ContentFile } from './content-file';\nimport { getContentFilesList } from './get-content-files';\n\nfunction getSlug(filename: string) {\n const parts = filename.match(/^(\\\\|\\/)(.+(\\\\|\\/))*(.+)\\.(.+)$/);\n return parts?.length ? parts[4] : '';\n}\n\nexport const CONTENT_FILES_LIST_TOKEN = new InjectionToken<ContentFile[]>(\n '@analogjs/content Content Files List',\n {\n providedIn: 'root',\n factory() {\n const contentFiles = getContentFilesList();\n\n return Object.keys(contentFiles).map((filename) => {\n const attributes = contentFiles[filename];\n const slug = attributes['slug'];\n\n return {\n filename,\n attributes,\n slug: slug ? encodeURI(slug) : encodeURI(getSlug(filename)),\n };\n });\n },\n }\n);\n","import { InjectionToken, inject } from '@angular/core';\n\nimport { getContentFiles } from './get-content-files';\nimport { CONTENT_FILES_LIST_TOKEN } from './content-files-list-token';\n\nexport const CONTENT_FILES_TOKEN = new InjectionToken<\n Record<string, () => Promise<string>>\n>('@analogjs/content Content Files', {\n providedIn: 'root',\n factory() {\n const contentFiles = getContentFiles();\n const contentFilesList = inject(CONTENT_FILES_LIST_TOKEN);\n\n const lookup: Record<string, string> = {};\n contentFilesList.forEach((item) => {\n const fileParts = item.filename.split('/');\n const filePath = fileParts.slice(0, fileParts.length - 1).join('/');\n lookup[item.filename] = `${filePath}/${item.slug}.md`;\n });\n\n const objectUsingSlugAttribute: Record<string, () => Promise<string>> = {};\n Object.entries(contentFiles).forEach((entry) => {\n const filename = entry[0];\n const value = entry[1];\n\n const newFilename = lookup[filename];\n if (newFilename !== undefined) {\n objectUsingSlugAttribute[newFilename] = value;\n }\n });\n\n return objectUsingSlugAttribute;\n },\n});\n","import fm from 'front-matter';\n\nexport function parseRawContentFile<Attributes extends Record<string, any>>(\n rawContentFile: string\n): { content: string; attributes: Attributes } {\n const { body, attributes } = fm<Attributes>(rawContentFile);\n return { content: body, attributes };\n}\n","import { firstValueFrom, isObservable, Observable } from 'rxjs';\n\ndeclare const Zone: any;\n\nexport async function waitFor<T>(prom: Promise<T> | Observable<T>): Promise<T> {\n if (isObservable(prom)) {\n prom = firstValueFrom(prom);\n }\n const macroTask = Zone.current.scheduleMacroTask(\n `AnalogContentResolve-${Math.random()}`,\n () => {},\n {},\n () => {}\n );\n return prom.then((p: T) => {\n macroTask.invoke();\n return p;\n });\n}\n","/// <reference types=\"vite/client\" />\n\nimport { inject } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { Observable, of } from 'rxjs';\nimport { map, switchMap } from 'rxjs/operators';\n\nimport { ContentFile } from './content-file';\nimport { CONTENT_FILES_TOKEN } from './content-files-token';\nimport { parseRawContentFile } from './parse-raw-content-file';\nimport { waitFor } from './utils/zone-wait-for';\n\n/**\n * Retrieves the static content using the provided param and/or prefix.\n *\n * @param param route parameter (default: 'slug')\n * @param fallback fallback text if content file is not found (default: 'No Content Found')\n */\nexport function injectContent<\n Attributes extends Record<string, any> = Record<string, any>\n>(\n param:\n | string\n | {\n param: string;\n subdirectory: string;\n } = 'slug',\n fallback = 'No Content Found'\n): Observable<ContentFile<Attributes | Record<string, never>>> {\n const route = inject(ActivatedRoute);\n const contentFiles = inject(CONTENT_FILES_TOKEN);\n const prefix = typeof param === 'string' ? '' : `${param.subdirectory}/`;\n\n const paramKey = typeof param === 'string' ? param : param.param;\n return route.paramMap.pipe(\n map((params) => params.get(paramKey)),\n switchMap((slug) => {\n const filename = `/src/content/${prefix}${slug}.md`;\n const contentFile = contentFiles[filename];\n\n if (!contentFile) {\n return of({\n attributes: {},\n filename: filename,\n slug: slug || '',\n content: fallback,\n });\n }\n\n return new Promise<string>((resolve) => {\n const contentResolver = contentFile();\n\n if (import.meta.env.SSR === true) {\n waitFor(contentResolver).then((content) => {\n resolve(content);\n });\n } else {\n contentResolver.then((content) => {\n resolve(content);\n });\n }\n }).then((rawContentFile) => {\n const { content, attributes } =\n parseRawContentFile<Attributes>(rawContentFile);\n\n return {\n filename,\n slug: slug || '',\n attributes,\n content,\n };\n });\n })\n );\n}\n","import { Injectable } from '@angular/core';\n\n@Injectable()\nexport abstract class ContentRenderer {\n async render(content: string): Promise<string> {\n return content;\n }\n\n // eslint-disable-next-line\n enhance() {}\n}\n","import { ContentFile } from './content-file';\nimport { inject } from '@angular/core';\nimport { CONTENT_FILES_LIST_TOKEN } from './content-files-list-token';\n\nexport function injectContentFiles<Attributes extends Record<string, any>>(\n filterFn?: InjectContentFilesFilterFunction<Attributes>\n): ContentFile<Attributes>[] {\n const allContentFiles = inject(\n CONTENT_FILES_LIST_TOKEN\n ) as ContentFile<Attributes>[];\n\n if (filterFn) {\n const filteredContentFiles = allContentFiles.filter(filterFn);\n\n return filteredContentFiles;\n }\n return allContentFiles;\n}\n\nexport type InjectContentFilesFilterFunction<T extends Record<string, any>> = (\n value: ContentFile<T>,\n index: number,\n array: ContentFile<T>[]\n) => boolean;\n","/**\n * Credit goes to Scully for original implementation\n * https://github.com/scullyio/scully/blob/main/libs/scully/src/lib/fileHanderPlugins/markdown.ts\n */\nimport { Injectable } from '@angular/core';\nimport { marked } from 'marked';\nimport { gfmHeadingId } from 'marked-gfm-heading-id';\nimport { markedHighlight } from 'marked-highlight';\n\nimport 'prismjs';\nimport 'prismjs/plugins/toolbar/prism-toolbar';\nimport 'prismjs/components/prism-bash';\nimport 'prismjs/components/prism-css';\nimport 'prismjs/components/prism-javascript';\nimport 'prismjs/components/prism-json';\nimport 'prismjs/components/prism-markup';\nimport 'prismjs/components/prism-typescript';\nimport 'prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard';\n\ndeclare const Prism: typeof import('prismjs');\n\n@Injectable()\nexport class MarkedSetupService {\n private readonly marked: typeof marked;\n\n constructor() {\n const renderer = new marked.Renderer();\n renderer.code = (code, lang) => {\n // Let's do a language based detection like on GitHub\n // So we can still have non-interpreted mermaid code\n if (lang === 'mermaid') {\n return '<pre class=\"mermaid\">' + code + '</pre>';\n }\n\n if (!lang) {\n return '<pre><code>' + code + '</code></pre>';\n }\n const langClass = 'language-' + lang;\n const html =\n '<pre class=\"' +\n langClass +\n '\"><code class=\"' +\n langClass +\n '\">' +\n code +\n '</code></pre>';\n return html;\n };\n\n marked.use(\n gfmHeadingId(),\n markedHighlight({\n async: true,\n highlight: (code, lang) => {\n lang = lang || 'typescript';\n if (!Prism.languages[lang]) {\n if (lang !== 'mermaid') {\n console.warn(`Notice:\n ---------------------------------------------------------------------------------------\n The requested language '${lang}' is not available with the provided setup.\n To enable, import your main.ts as:\n import 'prismjs/components/prism-${lang}';\n ---------------------------------------------------------------------------------------\n `);\n }\n return code;\n }\n return Prism.highlight(code, Prism.languages[lang], lang);\n },\n }),\n {\n renderer,\n pedantic: false,\n gfm: true,\n breaks: false,\n sanitize: false,\n smartypants: false,\n xhtml: false,\n mangle: false,\n }\n );\n\n this.marked = marked;\n }\n\n getMarkedInstance(): typeof marked {\n return this.marked;\n }\n}\n","import {\n inject,\n Injectable,\n InjectionToken,\n PLATFORM_ID,\n Provider,\n} from '@angular/core';\n\nimport { ContentRenderer } from './content-renderer';\nimport { MarkedSetupService } from './marked-setup.service';\n\n@Injectable()\nexport class MarkdownContentRendererService implements ContentRenderer {\n platformId = inject(PLATFORM_ID);\n #marked = inject(MarkedSetupService, { self: true });\n\n async render(content: string) {\n return this.#marked.getMarkedInstance().parse(content);\n }\n\n // eslint-disable-next-line\n enhance() {}\n}\n\nexport interface MarkdownRendererOptions {\n loadMermaid?: () => Promise<typeof import('mermaid')>;\n}\n\nexport function withMarkdownRenderer(\n options?: MarkdownRendererOptions\n): Provider {\n return [\n {\n provide: ContentRenderer,\n useFactory: () => new MarkdownContentRendererService(),\n deps: [MarkedSetupService],\n },\n options?.loadMermaid\n ? [\n {\n provide: MERMAID_IMPORT_TOKEN,\n useFactory: options.loadMermaid,\n },\n ]\n : [],\n ];\n}\n\nexport function provideContent(...features: Provider[]) {\n return [...features, MarkedSetupService];\n}\n\nexport const MERMAID_IMPORT_TOKEN = new InjectionToken<\n Promise<typeof import('mermaid')>\n>('mermaid_import');\n","import { AsyncPipe } from '@angular/common';\nimport {\n AfterViewChecked,\n Component,\n inject,\n Input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { ActivatedRoute } from '@angular/router';\n\nimport { ContentRenderer } from './content-renderer';\nimport { AnchorNavigationDirective } from './anchor-navigation.directive';\n\n@Component({\n selector: 'analog-markdown-route',\n standalone: true,\n imports: [AsyncPipe],\n hostDirectives: [AnchorNavigationDirective],\n preserveWhitespaces: true,\n encapsulation: ViewEncapsulation.None,\n template: `<div [innerHTML]=\"content\" [class]=\"classes\"></div>`,\n})\nexport default class AnalogMarkdownRouteComponent implements AfterViewChecked {\n private sanitizer = inject(DomSanitizer);\n private route = inject(ActivatedRoute);\n contentRenderer = inject(ContentRenderer);\n\n protected content: SafeHtml = this.sanitizer.bypassSecurityTrustHtml(\n this.route.snapshot.data['renderedAnalogContent']\n );\n\n @Input() classes = 'analog-markdown-route';\n\n ngAfterViewChecked() {\n this.contentRenderer.enhance();\n }\n}\n","import { AsyncPipe, isPlatformBrowser } from '@angular/common';\nimport {\n AfterViewChecked,\n Component,\n Input,\n NgZone,\n OnChanges,\n OnInit,\n PLATFORM_ID,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { ActivatedRoute, Data } from '@angular/router';\nimport { Observable, from, of } from 'rxjs';\nimport { catchError, map, mergeMap } from 'rxjs/operators';\n\nimport { AnchorNavigationDirective } from './anchor-navigation.directive';\nimport { ContentRenderer } from './content-renderer';\nimport { MERMAID_IMPORT_TOKEN } from './markdown-content-renderer.service';\n\n@Component({\n selector: 'analog-markdown',\n standalone: true,\n imports: [AsyncPipe],\n hostDirectives: [AnchorNavigationDirective],\n preserveWhitespaces: true,\n encapsulation: ViewEncapsulation.None,\n template: `<div [innerHTML]=\"content$ | async\" [class]=\"classes\"></div>`,\n})\nexport default class AnalogMarkdownComponent\n implements OnInit, OnChanges, AfterViewChecked\n{\n private sanitizer = inject(DomSanitizer);\n private route = inject(ActivatedRoute);\n private zone = inject(NgZone);\n private readonly platformId = inject(PLATFORM_ID);\n private readonly mermaidImport = inject(MERMAID_IMPORT_TOKEN, {\n optional: true,\n });\n private mermaid: typeof import('mermaid') | undefined;\n\n public content$: Observable<SafeHtml> = of('');\n\n @Input() content!: string | undefined | null;\n @Input() classes = 'analog-markdown';\n\n contentRenderer = inject(ContentRenderer);\n\n constructor() {\n if (isPlatformBrowser(this.platformId) && this.mermaidImport) {\n // Mermaid can only be loaded on client side\n this.loadMermaid(this.mermaidImport);\n }\n }\n\n ngOnInit(): void {\n this.updateContent();\n }\n\n ngOnChanges(): void {\n this.updateContent();\n }\n\n updateContent() {\n this.content$ = this.route.data.pipe(\n map<Data, string>((data) => this.content ?? data['_analogContent']),\n mergeMap((contentString) => this.renderContent(contentString)),\n map((content) => this.sanitizer.bypassSecurityTrustHtml(content)),\n catchError((e) => of(`There was an error ${e}`))\n );\n }\n\n async renderContent(content: string): Promise<string> {\n return this.contentRenderer.render(content);\n }\n\n ngAfterViewChecked() {\n this.contentRenderer.enhance();\n this.zone.runOutsideAngular(() => this.mermaid?.default.run());\n }\n\n private loadMermaid(mermaidImport: Promise<typeof import('mermaid')>) {\n this.zone.runOutsideAngular(() =>\n // Wrap into an observable to avoid redundant initialization once\n // the markdown component is destroyed before the promise is resolved.\n from(mermaidImport)\n .pipe(takeUntilDestroyed())\n .subscribe((mermaid) => {\n this.mermaid = mermaid;\n this.mermaid.default.initialize({ startOnLoad: false });\n // Explicitly running mermaid as ngAfterViewChecked\n // has probably already been called\n this.mermaid?.default.run();\n })\n );\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.AnchorNavigationDirective"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAIA,MAIa,yBAAyB,CAAA;AAJtC,IAAA,WAAA,GAAA;AAKmB,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC5B,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC5B,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAmB1C,KAAA;AAhBC,IAAA,gBAAgB,CAAC,OAAoB,EAAA;QACnC,IACE,OAAO,YAAY,iBAAiB;AACpC,YAAA,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC;YACrC,aAAa,CAAC,OAAO,CAAC;AACtB,YAAA,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAC9B;YACA,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;AAC3C,YAAA,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAG,EAAA,QAAQ,GAAG,MAAM,CAAA,EAAG,IAAI,CAAA,CAAE,CAAC,CAAC;AACnE,YAAA,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;AAE/B,YAA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uB,EAAA,UAAA,EAAA,CAAA;kBAT3C,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,SAAS,CAAC;oBACpB,cAAc,EAAE,CAAC,yBAAyB,CAAC;AAC3C,oBAAA,mBAAmB,EAAE,IAAI;oBACzB,aAAa,EAAE,iBAAiB,CAAC,IAAI;AACrC,oBAAA,QAAQ,EAAE,CAA8D,4DAAA,CAAA;AACzE,iBAAA,CAAA;0EAeU,OAAO,EAAA,CAAA;sBAAf,KAAK;gBACG,OAAO,EAAA,CAAA;sBAAf,KAAK;;;AC9CR;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
+ export { AnchorNavigationDirective } from './lib/anchor-navigation.directive';
1
2
  export { injectContent } from './lib/content';
2
- export { injectContentFiles } from './lib/inject-content-files';
3
3
  export { ContentFile } from './lib/content-file';
4
4
  export { ContentRenderer } from './lib/content-renderer';
5
+ export { injectContentFiles } from './lib/inject-content-files';
6
+ export { MarkdownContentRendererService, provideContent, withMarkdownRenderer, } from './lib/markdown-content-renderer.service';
7
+ export { default as MarkdownRouteComponent } from './lib/markdown-route.component';
5
8
  export { default as MarkdownComponent } from './lib/markdown.component';
6
- export { MarkdownContentRendererService } from './lib/markdown-content-renderer.service';
7
- export { provideContent, withMarkdownRenderer, } from './lib/markdown-content-renderer.service';
8
9
  export { parseRawContentFile } from './lib/parse-raw-content-file';
9
- export { AnchorNavigationDirective } from './lib/anchor-navigation.directive';