@analogjs/content 0.2.0-beta.9 → 0.2.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/index.mjs +5 -5
- package/esm2022/lib/anchor-navigation.directive.mjs +3 -3
- package/esm2022/lib/content-files-list-token.mjs +3 -2
- package/esm2022/lib/content-files-token.mjs +20 -3
- package/esm2022/lib/content-renderer.mjs +3 -3
- package/esm2022/lib/content.mjs +3 -3
- package/esm2022/lib/markdown-content-renderer.service.mjs +27 -66
- package/esm2022/lib/markdown-route.component.mjs +38 -0
- package/esm2022/lib/markdown.component.mjs +26 -8
- package/esm2022/lib/marked-setup.service.mjs +81 -0
- package/fesm2022/analogjs-content.mjs +242 -141
- package/fesm2022/analogjs-content.mjs.map +1 -1
- package/index.d.ts +4 -4
- package/lib/anchor-navigation.directive.d.ts +1 -1
- package/lib/markdown-content-renderer.service.d.ts +7 -15
- package/lib/markdown-route.component.d.ts +15 -0
- package/lib/markdown.component.d.ts +8 -2
- package/lib/marked-setup.service.d.ts +18 -0
- package/migrations/migration.json +33 -0
- package/package.json +5 -2
|
@@ -1,21 +1,65 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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';
|
|
4
5
|
import { isObservable, firstValueFrom, of } 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
|
+
|
|
22
|
+
class AnchorNavigationDirective {
|
|
23
|
+
constructor() {
|
|
24
|
+
this.document = inject(DOCUMENT);
|
|
25
|
+
this.location = inject(Location);
|
|
26
|
+
this.router = inject(Router);
|
|
27
|
+
}
|
|
28
|
+
handleNavigation(element) {
|
|
29
|
+
if (element instanceof HTMLAnchorElement &&
|
|
30
|
+
isInternalUrl(element, this.document) &&
|
|
31
|
+
hasTargetSelf(element) &&
|
|
32
|
+
!hasDownloadAttribute(element)) {
|
|
33
|
+
const { pathname, search, hash } = element;
|
|
34
|
+
const url = this.location.normalize(`${pathname}${search}${hash}`);
|
|
35
|
+
this.router.navigateByUrl(url);
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: AnchorNavigationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
41
|
+
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 }); }
|
|
42
|
+
}
|
|
43
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: AnchorNavigationDirective, decorators: [{
|
|
44
|
+
type: Directive,
|
|
45
|
+
args: [{
|
|
46
|
+
selector: '[analogAnchorNavigation]',
|
|
47
|
+
standalone: true,
|
|
48
|
+
}]
|
|
49
|
+
}], propDecorators: { handleNavigation: [{
|
|
50
|
+
type: HostListener,
|
|
51
|
+
args: ['click', ['$event.target']]
|
|
52
|
+
}] } });
|
|
53
|
+
function hasDownloadAttribute(anchorElement) {
|
|
54
|
+
return anchorElement.getAttribute('download') !== null;
|
|
55
|
+
}
|
|
56
|
+
function hasTargetSelf(anchorElement) {
|
|
57
|
+
return !anchorElement.target || anchorElement.target === '_self';
|
|
58
|
+
}
|
|
59
|
+
function isInternalUrl(anchorElement, document) {
|
|
60
|
+
return (anchorElement.host === document.location.host &&
|
|
61
|
+
anchorElement.protocol === document.location.protocol);
|
|
62
|
+
}
|
|
19
63
|
|
|
20
64
|
/**
|
|
21
65
|
* Returns the list of content files by filename with ?analog-content-list=true.
|
|
@@ -38,14 +82,55 @@ const getContentFiles = () => import.meta.glob(['/src/content/**/*.md'], {
|
|
|
38
82
|
as: 'raw',
|
|
39
83
|
});
|
|
40
84
|
|
|
85
|
+
function getSlug(filename) {
|
|
86
|
+
const parts = filename.match(/^(\\|\/)(.+(\\|\/))*(.+)\.(.+)$/);
|
|
87
|
+
return parts?.length ? parts[4] : '';
|
|
88
|
+
}
|
|
89
|
+
const CONTENT_FILES_LIST_TOKEN = new InjectionToken('@analogjs/content Content Files List', {
|
|
90
|
+
providedIn: 'root',
|
|
91
|
+
factory() {
|
|
92
|
+
const contentFiles = getContentFilesList();
|
|
93
|
+
return Object.keys(contentFiles).map((filename) => {
|
|
94
|
+
const attributes = contentFiles[filename];
|
|
95
|
+
const slug = attributes['slug'];
|
|
96
|
+
return {
|
|
97
|
+
filename,
|
|
98
|
+
attributes,
|
|
99
|
+
slug: slug ? encodeURI(slug) : encodeURI(getSlug(filename)),
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
|
|
41
105
|
const CONTENT_FILES_TOKEN = new InjectionToken('@analogjs/content Content Files', {
|
|
42
106
|
providedIn: 'root',
|
|
43
107
|
factory() {
|
|
44
108
|
const contentFiles = getContentFiles();
|
|
45
|
-
|
|
109
|
+
const contentFilesList = inject(CONTENT_FILES_LIST_TOKEN);
|
|
110
|
+
const lookup = {};
|
|
111
|
+
contentFilesList.forEach((item) => {
|
|
112
|
+
const fileParts = item.filename.split('/');
|
|
113
|
+
const filePath = fileParts.slice(0, fileParts.length - 1).join('/');
|
|
114
|
+
lookup[item.filename] = `${filePath}/${item.slug}.md`;
|
|
115
|
+
});
|
|
116
|
+
const objectUsingSlugAttribute = {};
|
|
117
|
+
Object.entries(contentFiles).forEach((entry) => {
|
|
118
|
+
const filename = entry[0];
|
|
119
|
+
const value = entry[1];
|
|
120
|
+
const newFilename = lookup[filename];
|
|
121
|
+
if (newFilename !== undefined) {
|
|
122
|
+
objectUsingSlugAttribute[newFilename] = value;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
return objectUsingSlugAttribute;
|
|
46
126
|
},
|
|
47
127
|
});
|
|
48
128
|
|
|
129
|
+
function parseRawContentFile(rawContentFile) {
|
|
130
|
+
const { body, attributes } = fm(rawContentFile);
|
|
131
|
+
return { content: body, attributes };
|
|
132
|
+
}
|
|
133
|
+
|
|
49
134
|
async function waitFor(prom) {
|
|
50
135
|
if (isObservable(prom)) {
|
|
51
136
|
prom = firstValueFrom(prom);
|
|
@@ -57,11 +142,6 @@ async function waitFor(prom) {
|
|
|
57
142
|
});
|
|
58
143
|
}
|
|
59
144
|
|
|
60
|
-
function parseRawContentFile(rawContentFile) {
|
|
61
|
-
const { body, attributes } = fm(rawContentFile);
|
|
62
|
-
return { content: body, attributes };
|
|
63
|
-
}
|
|
64
|
-
|
|
65
145
|
/// <reference types="vite/client" />
|
|
66
146
|
/**
|
|
67
147
|
* Retrieves the static content using the provided param and/or prefix.
|
|
@@ -80,7 +160,7 @@ function injectContent(param = 'slug', fallback = 'No Content Found') {
|
|
|
80
160
|
if (!contentFile) {
|
|
81
161
|
return of({
|
|
82
162
|
attributes: {},
|
|
83
|
-
filename,
|
|
163
|
+
filename: filename,
|
|
84
164
|
slug: slug || '',
|
|
85
165
|
content: fallback,
|
|
86
166
|
});
|
|
@@ -109,24 +189,18 @@ function injectContent(param = 'slug', fallback = 'No Content Found') {
|
|
|
109
189
|
}));
|
|
110
190
|
}
|
|
111
191
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
192
|
+
class ContentRenderer {
|
|
193
|
+
async render(content) {
|
|
194
|
+
return content;
|
|
195
|
+
}
|
|
196
|
+
// eslint-disable-next-line
|
|
197
|
+
enhance() { }
|
|
198
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: ContentRenderer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
199
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: ContentRenderer }); }
|
|
115
200
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
-
});
|
|
201
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: ContentRenderer, decorators: [{
|
|
202
|
+
type: Injectable
|
|
203
|
+
}] });
|
|
130
204
|
|
|
131
205
|
function injectContentFiles(filterFn) {
|
|
132
206
|
const allContentFiles = inject(CONTENT_FILES_LIST_TOKEN);
|
|
@@ -137,68 +211,163 @@ function injectContentFiles(filterFn) {
|
|
|
137
211
|
return allContentFiles;
|
|
138
212
|
}
|
|
139
213
|
|
|
140
|
-
|
|
214
|
+
/**
|
|
215
|
+
* Credit goes to Scully for original implementation
|
|
216
|
+
* https://github.com/scullyio/scully/blob/main/libs/scully/src/lib/fileHanderPlugins/markdown.ts
|
|
217
|
+
*/
|
|
218
|
+
class MarkedSetupService {
|
|
219
|
+
constructor() {
|
|
220
|
+
const renderer = new marked.Renderer();
|
|
221
|
+
renderer.code = (code, lang) => {
|
|
222
|
+
// Let's do a language based detection like on GitHub
|
|
223
|
+
// So we can still have non-interpreted mermaid code
|
|
224
|
+
if (lang === 'mermaid') {
|
|
225
|
+
return '<pre class="mermaid">' + code + '</pre>';
|
|
226
|
+
}
|
|
227
|
+
if (!lang) {
|
|
228
|
+
return '<pre><code>' + code + '</code></pre>';
|
|
229
|
+
}
|
|
230
|
+
const langClass = 'language-' + lang;
|
|
231
|
+
const html = '<pre class="' +
|
|
232
|
+
langClass +
|
|
233
|
+
'"><code class="' +
|
|
234
|
+
langClass +
|
|
235
|
+
'">' +
|
|
236
|
+
code +
|
|
237
|
+
'</code></pre>';
|
|
238
|
+
return html;
|
|
239
|
+
};
|
|
240
|
+
marked.use(gfmHeadingId(), markedHighlight({
|
|
241
|
+
async: true,
|
|
242
|
+
highlight: (code, lang) => {
|
|
243
|
+
lang = lang || 'typescript';
|
|
244
|
+
if (!Prism.languages[lang]) {
|
|
245
|
+
if (lang !== 'mermaid') {
|
|
246
|
+
console.warn(`Notice:
|
|
247
|
+
---------------------------------------------------------------------------------------
|
|
248
|
+
The requested language '${lang}' is not available with the provided setup.
|
|
249
|
+
To enable, import your main.ts as:
|
|
250
|
+
import 'prismjs/components/prism-${lang}';
|
|
251
|
+
---------------------------------------------------------------------------------------
|
|
252
|
+
`);
|
|
253
|
+
}
|
|
254
|
+
return code;
|
|
255
|
+
}
|
|
256
|
+
return Prism.highlight(code, Prism.languages[lang], lang);
|
|
257
|
+
},
|
|
258
|
+
}), {
|
|
259
|
+
renderer,
|
|
260
|
+
pedantic: false,
|
|
261
|
+
gfm: true,
|
|
262
|
+
breaks: false,
|
|
263
|
+
sanitize: false,
|
|
264
|
+
smartypants: false,
|
|
265
|
+
xhtml: false,
|
|
266
|
+
mangle: false,
|
|
267
|
+
});
|
|
268
|
+
this.marked = marked;
|
|
269
|
+
}
|
|
270
|
+
getMarkedInstance() {
|
|
271
|
+
return this.marked;
|
|
272
|
+
}
|
|
273
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: MarkedSetupService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
274
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: MarkedSetupService }); }
|
|
275
|
+
}
|
|
276
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: MarkedSetupService, decorators: [{
|
|
277
|
+
type: Injectable
|
|
278
|
+
}], ctorParameters: function () { return []; } });
|
|
279
|
+
|
|
280
|
+
class MarkdownContentRendererService {
|
|
281
|
+
constructor() {
|
|
282
|
+
this.platformId = inject(PLATFORM_ID);
|
|
283
|
+
this.#marked = inject(MarkedSetupService, { self: true });
|
|
284
|
+
}
|
|
285
|
+
#marked;
|
|
141
286
|
async render(content) {
|
|
142
|
-
return content;
|
|
287
|
+
return this.#marked.getMarkedInstance().parse(content);
|
|
143
288
|
}
|
|
144
289
|
// eslint-disable-next-line
|
|
145
290
|
enhance() { }
|
|
146
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
147
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.
|
|
291
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: MarkdownContentRendererService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
292
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: MarkdownContentRendererService }); }
|
|
148
293
|
}
|
|
149
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
294
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: MarkdownContentRendererService, decorators: [{
|
|
150
295
|
type: Injectable
|
|
151
296
|
}] });
|
|
297
|
+
function withMarkdownRenderer(options) {
|
|
298
|
+
return [
|
|
299
|
+
{
|
|
300
|
+
provide: ContentRenderer,
|
|
301
|
+
useFactory: () => new MarkdownContentRendererService(),
|
|
302
|
+
deps: [MarkedSetupService],
|
|
303
|
+
},
|
|
304
|
+
options?.loadMermaid
|
|
305
|
+
? [
|
|
306
|
+
{
|
|
307
|
+
provide: MERMAID_IMPORT_TOKEN,
|
|
308
|
+
useFactory: options.loadMermaid,
|
|
309
|
+
},
|
|
310
|
+
]
|
|
311
|
+
: [],
|
|
312
|
+
];
|
|
313
|
+
}
|
|
314
|
+
function provideContent(...features) {
|
|
315
|
+
return [...features, MarkedSetupService];
|
|
316
|
+
}
|
|
317
|
+
const MERMAID_IMPORT_TOKEN = new InjectionToken('mermaid_import');
|
|
152
318
|
|
|
153
|
-
class
|
|
319
|
+
class AnalogMarkdownRouteComponent {
|
|
154
320
|
constructor() {
|
|
155
|
-
this.
|
|
156
|
-
this.
|
|
157
|
-
this.
|
|
321
|
+
this.sanitizer = inject(DomSanitizer);
|
|
322
|
+
this.route = inject(ActivatedRoute);
|
|
323
|
+
this.contentRenderer = inject(ContentRenderer);
|
|
324
|
+
this.content = this.sanitizer.bypassSecurityTrustHtml(this.route.snapshot.data['renderedAnalogContent']);
|
|
325
|
+
this.classes = 'analog-markdown-route';
|
|
158
326
|
}
|
|
159
|
-
|
|
160
|
-
|
|
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;
|
|
327
|
+
ngAfterViewChecked() {
|
|
328
|
+
this.contentRenderer.enhance();
|
|
170
329
|
}
|
|
171
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
172
|
-
static { this.ɵ
|
|
330
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: AnalogMarkdownRouteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
331
|
+
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
332
|
}
|
|
174
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
175
|
-
type:
|
|
333
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: AnalogMarkdownRouteComponent, decorators: [{
|
|
334
|
+
type: Component,
|
|
176
335
|
args: [{
|
|
177
|
-
selector: '
|
|
336
|
+
selector: 'analog-markdown-route',
|
|
178
337
|
standalone: true,
|
|
338
|
+
imports: [AsyncPipe],
|
|
339
|
+
hostDirectives: [AnchorNavigationDirective],
|
|
340
|
+
preserveWhitespaces: true,
|
|
341
|
+
encapsulation: ViewEncapsulation.None,
|
|
342
|
+
template: `<div [innerHTML]="content" [class]="classes"></div>`,
|
|
179
343
|
}]
|
|
180
|
-
}], propDecorators: {
|
|
181
|
-
type:
|
|
182
|
-
args: ['click', ['$event.target']]
|
|
344
|
+
}], propDecorators: { classes: [{
|
|
345
|
+
type: Input
|
|
183
346
|
}] } });
|
|
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
347
|
|
|
195
348
|
class AnalogMarkdownComponent {
|
|
196
349
|
constructor() {
|
|
197
350
|
this.sanitizer = inject(DomSanitizer);
|
|
198
351
|
this.route = inject(ActivatedRoute);
|
|
352
|
+
this.zone = inject(NgZone);
|
|
353
|
+
this.platformId = inject(PLATFORM_ID);
|
|
354
|
+
this.mermaidImport = inject(MERMAID_IMPORT_TOKEN, {
|
|
355
|
+
optional: true,
|
|
356
|
+
});
|
|
199
357
|
this.content$ = of('');
|
|
200
358
|
this.classes = 'analog-markdown';
|
|
201
359
|
this.contentRenderer = inject(ContentRenderer);
|
|
360
|
+
if (isPlatformBrowser(this.platformId) && this.mermaidImport) {
|
|
361
|
+
// Mermaid can only be loaded on client side
|
|
362
|
+
this.loadMermaid(this.mermaidImport);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
async loadMermaid(mermaidImport) {
|
|
366
|
+
this.mermaid = await mermaidImport;
|
|
367
|
+
this.mermaid.default.initialize({ startOnLoad: false });
|
|
368
|
+
// Explicitly running mermaid as ngAfterViewChecked
|
|
369
|
+
// has probably already been called
|
|
370
|
+
this.zone.runOutsideAngular(() => this.mermaid?.default.run());
|
|
202
371
|
}
|
|
203
372
|
ngOnInit() {
|
|
204
373
|
this.updateContent();
|
|
@@ -214,11 +383,12 @@ class AnalogMarkdownComponent {
|
|
|
214
383
|
}
|
|
215
384
|
ngAfterViewChecked() {
|
|
216
385
|
this.contentRenderer.enhance();
|
|
386
|
+
this.zone.runOutsideAngular(() => this.mermaid?.default.run());
|
|
217
387
|
}
|
|
218
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
219
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.
|
|
388
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: AnalogMarkdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
389
|
+
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
390
|
}
|
|
221
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
391
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: AnalogMarkdownComponent, decorators: [{
|
|
222
392
|
type: Component,
|
|
223
393
|
args: [{
|
|
224
394
|
selector: 'analog-markdown',
|
|
@@ -229,84 +399,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImpor
|
|
|
229
399
|
encapsulation: ViewEncapsulation.None,
|
|
230
400
|
template: `<div [innerHTML]="content$ | async" [class]="classes"></div>`,
|
|
231
401
|
}]
|
|
232
|
-
}], propDecorators: { content: [{
|
|
402
|
+
}], ctorParameters: function () { return []; }, propDecorators: { content: [{
|
|
233
403
|
type: Input
|
|
234
404
|
}], classes: [{
|
|
235
405
|
type: Input
|
|
236
406
|
}] } });
|
|
237
407
|
|
|
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
408
|
/**
|
|
308
409
|
* Generated bundle index. Do not edit.
|
|
309
410
|
*/
|
|
310
411
|
|
|
311
|
-
export { AnchorNavigationDirective, ContentRenderer, AnalogMarkdownComponent as MarkdownComponent, MarkdownContentRendererService, injectContent, injectContentFiles, parseRawContentFile, provideContent, withMarkdownRenderer };
|
|
412
|
+
export { AnchorNavigationDirective, ContentRenderer, AnalogMarkdownComponent as MarkdownComponent, MarkdownContentRendererService, AnalogMarkdownRouteComponent as MarkdownRouteComponent, injectContent, injectContentFiles, parseRawContentFile, provideContent, withMarkdownRenderer };
|
|
312
413
|
//# 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,IAAI;AACX,IAAA,MAAM,EAAE,SAAS;AACjB,IAAA,KAAK,EAAE,EAAE,qBAAqB,EAAE,IAAI,EAAE;AACvC,CAAA,CAAC,CAAC;AAEL;;;;AAIG;AACI,MAAM,eAAe,GAAG,MAC7B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,sBAAsB,CAAC,EAAE;AACzC,IAAA,EAAE,EAAE,KAAK;AACV,CAAA,CAAC;;AClBG,MAAM,mBAAmB,GAAG,IAAI,cAAc,CAEnD,iCAAiC,EAAE;AACnC,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,GAAA;AACL,QAAA,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;AAEvC,QAAA,OAAO,YAAY,CAAC;KACrB;AACF,CAAA,CAAC;;ACTK,eAAe,OAAO,CAAI,IAAgC,EAAA;AAC/D,IAAA,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE;AACtB,QAAA,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;AAC7B,KAAA;IACD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAC9C,CAAA,qBAAA,EAAwB,IAAI,CAAC,MAAM,EAAE,CAAE,CAAA,EACvC,MAAO,GAAC,EACR,EAAE,EACF,MAAK,GAAG,CACT,CAAC;AACF,IAAA,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CA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AK;AACb,YAAA,QAAQ,EAAE,KAAK;AACf,YAAA,UAAU,EAAE,IAAI;AAChB,YAAA,WAAW,EAAE,KAAK;AAClB,YAAA,KAAK,EAAE,KAAK;AACb,SAAA,CAAC,CAAC;AAEH,QAAA,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC;KACxB;;AAGD,IAAA,OAAO,MAAK;8GAjCD,8BAA8B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;kHAA9B,8BAA8B,EAAA,CAAA,CAAA,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 { 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 { 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 async loadMermaid(mermaidImport: Promise<typeof import('mermaid')>) {\n this.mermaid = await mermaidImport;\n this.mermaid.default.initialize({ startOnLoad: false });\n // Explicitly running mermaid as ngAfterViewChecked\n // has probably already been called\n this.zone.runOutsideAngular(() => this.mermaid?.default.run());\n }\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 this.zone.runOutsideAngular(() => this.mermaid?.default.run());\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;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AA,iBAAA,CAAA,IAAA,EAAA,mBAAA,EAAA,IAAA,EAAA,CAAA,CAAA,EAAA;;2FAMA,uBAAuB,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;;;AC7CR;;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';
|
|
@@ -5,5 +5,5 @@ export declare class AnchorNavigationDirective {
|
|
|
5
5
|
private readonly router;
|
|
6
6
|
handleNavigation(element: HTMLElement): boolean;
|
|
7
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<AnchorNavigationDirective, never>;
|
|
8
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<AnchorNavigationDirective, "[analogAnchorNavigation]", never, {}, {}, never, never, true, never>;
|
|
8
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AnchorNavigationDirective, "[analogAnchorNavigation]", never, {}, {}, never, never, true, never, false>;
|
|
9
9
|
}
|