@analogjs/content 3.0.0-alpha.2 → 3.0.0-alpha.20

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.
Files changed (93) hide show
  1. package/LICENSE +21 -0
  2. package/fesm2022/analogjs-content-md4x.mjs +290 -0
  3. package/fesm2022/analogjs-content-md4x.mjs.map +1 -0
  4. package/fesm2022/analogjs-content-mdc.mjs +170 -0
  5. package/fesm2022/analogjs-content-mdc.mjs.map +1 -0
  6. package/fesm2022/analogjs-content-og.mjs +34 -46
  7. package/fesm2022/analogjs-content-og.mjs.map +1 -1
  8. package/fesm2022/analogjs-content-prism-highlighter.mjs +81 -68
  9. package/fesm2022/analogjs-content-prism-highlighter.mjs.map +1 -1
  10. package/fesm2022/analogjs-content-resources.mjs +113 -124
  11. package/fesm2022/analogjs-content-resources.mjs.map +1 -1
  12. package/fesm2022/analogjs-content-shiki-highlighter.mjs +9 -14
  13. package/fesm2022/analogjs-content-shiki-highlighter.mjs.map +1 -1
  14. package/fesm2022/analogjs-content.mjs +658 -636
  15. package/fesm2022/analogjs-content.mjs.map +1 -1
  16. package/fesm2022/content-list-loader.mjs +284 -0
  17. package/fesm2022/content-list-loader.mjs.map +1 -0
  18. package/md4x/package.json +4 -0
  19. package/mdc/package.json +4 -0
  20. package/og/package.json +2 -2
  21. package/package.json +56 -30
  22. package/plugin/package.json +2 -22
  23. package/plugin/src/index.d.ts +4 -2
  24. package/plugin/src/index.js +6 -3
  25. package/plugin/src/index.js.map +1 -1
  26. package/plugin/src/migrations/update-markdown-version/compat.d.ts +6 -2
  27. package/plugin/src/migrations/update-markdown-version/compat.js +8 -5
  28. package/plugin/src/migrations/update-markdown-version/compat.js.map +1 -1
  29. package/plugin/src/migrations/update-markdown-version/update-markdown-version.d.ts +6 -2
  30. package/plugin/src/migrations/update-markdown-version/update-markdown-version.js +18 -20
  31. package/plugin/src/migrations/update-markdown-version/update-markdown-version.js.map +1 -1
  32. package/prism-highlighter/package.json +2 -2
  33. package/resources/package.json +2 -2
  34. package/shiki-highlighter/package.json +2 -2
  35. package/src/lib/devtools/content-devtools-client.ts +215 -0
  36. package/src/lib/devtools/content-devtools.styles.css +194 -0
  37. package/types/md4x/src/index.d.ts +5 -0
  38. package/types/md4x/src/lib/md4x-content-renderer.service.d.ts +33 -0
  39. package/types/md4x/src/lib/md4x-wasm-content-renderer.service.d.ts +16 -0
  40. package/types/md4x/src/lib/provide-md4x.d.ts +26 -0
  41. package/types/md4x/src/lib/streaming-markdown-renderer.d.ts +21 -0
  42. package/types/mdc/src/index.d.ts +2 -0
  43. package/types/mdc/src/lib/mdc-component-registry.d.ts +25 -0
  44. package/types/mdc/src/lib/mdc-renderer.directive.d.ts +33 -0
  45. package/types/og/src/index.d.ts +2 -0
  46. package/types/og/src/lib/og.d.ts +5 -0
  47. package/types/og/src/lib/options.d.ts +11 -0
  48. package/types/prism-highlighter/src/index.d.ts +8 -0
  49. package/types/prism-highlighter/src/lib/prism/angular.d.ts +1 -0
  50. package/types/prism-highlighter/src/lib/prism-highlighter.d.ts +8 -0
  51. package/types/resources/src/content-file-resource.d.ts +37 -0
  52. package/types/resources/src/content-files-resource.d.ts +3 -0
  53. package/types/resources/src/index.d.ts +2 -0
  54. package/types/shiki-highlighter/src/index.d.ts +7 -0
  55. package/types/src/index.d.ts +18 -0
  56. package/types/src/lib/anchor-navigation.directive.d.ts +9 -0
  57. package/types/src/lib/content-file-loader.d.ts +6 -0
  58. package/types/src/lib/content-file.d.ts +8 -0
  59. package/types/src/lib/content-files-list-token.d.ts +3 -0
  60. package/types/src/lib/content-files-token.d.ts +3 -0
  61. package/types/src/lib/content-list-loader.d.ts +7 -0
  62. package/types/src/lib/content-renderer.d.ts +33 -0
  63. package/types/src/lib/content.d.ts +14 -0
  64. package/types/src/lib/devtools/content-devtools-plugin.d.ts +23 -0
  65. package/types/src/lib/devtools/content-devtools-renderer.d.ts +23 -0
  66. package/types/src/lib/devtools/index.d.ts +23 -0
  67. package/types/src/lib/get-content-files.d.ts +14 -0
  68. package/types/src/lib/inject-content-files.d.ts +4 -0
  69. package/types/src/lib/markdown-content-renderer.service.d.ts +10 -0
  70. package/types/src/lib/markdown-route.component.d.ts +15 -0
  71. package/types/src/lib/markdown.component.d.ts +26 -0
  72. package/types/src/lib/marked-content-highlighter.d.ts +17 -0
  73. package/types/src/lib/marked-setup.service.d.ts +10 -0
  74. package/types/src/lib/parse-raw-content-file.d.ts +18 -0
  75. package/types/src/lib/provide-content.d.ts +7 -0
  76. package/types/src/lib/render-task.service.d.ts +8 -0
  77. package/types/src/lib/utils/zone-wait-for.d.ts +2 -0
  78. package/og/README.md +0 -3
  79. package/plugin/README.md +0 -11
  80. package/plugin/src/migrations/update-markdown-renderer-feature/compat.d.ts +0 -2
  81. package/plugin/src/migrations/update-markdown-renderer-feature/compat.js +0 -6
  82. package/plugin/src/migrations/update-markdown-renderer-feature/compat.js.map +0 -1
  83. package/plugin/src/migrations/update-markdown-renderer-feature/update-markdown-renderer-feature.d.ts +0 -2
  84. package/plugin/src/migrations/update-markdown-renderer-feature/update-markdown-renderer-feature.js +0 -48
  85. package/plugin/src/migrations/update-markdown-renderer-feature/update-markdown-renderer-feature.js.map +0 -1
  86. package/prism-highlighter/README.md +0 -3
  87. package/resources/README.md +0 -3
  88. package/shiki-highlighter/README.md +0 -3
  89. package/types/analogjs-content-og.d.ts +0 -19
  90. package/types/analogjs-content-prism-highlighter.d.ts +0 -15
  91. package/types/analogjs-content-resources.d.ts +0 -20
  92. package/types/analogjs-content-shiki-highlighter.d.ts +0 -11
  93. package/types/analogjs-content.d.ts +0 -168
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Returns the list of content files by filename with ?analog-content-list=true.
3
+ * We use the query param to transform the return into an array of
4
+ * just front matter attributes.
5
+ *
6
+ * @returns
7
+ */
8
+ export declare const getContentFilesList: () => Record<string, Record<string, any>>;
9
+ /**
10
+ * Returns the lazy loaded content files for lookups.
11
+ *
12
+ * @returns
13
+ */
14
+ export declare const getContentFiles: () => Record<string, () => Promise<string>>;
@@ -0,0 +1,4 @@
1
+ import { ContentFile } from './content-file';
2
+ export declare function injectContentFiles<Attributes extends Record<string, any>>(filterFn?: InjectContentFilesFilterFunction<Attributes>): ContentFile<Attributes>[];
3
+ export type InjectContentFilesFilterFunction<T extends Record<string, any>> = (value: ContentFile<T>, index: number, array: ContentFile<T>[]) => boolean;
4
+ export declare function injectContentFilesMap(): Record<string, () => Promise<string>>;
@@ -0,0 +1,10 @@
1
+ import { ContentRenderer, RenderedContent, TableOfContentItem } from './content-renderer';
2
+ import * as i0 from "@angular/core";
3
+ export declare class MarkdownContentRendererService implements ContentRenderer {
4
+ #private;
5
+ render(content: string): Promise<RenderedContent>;
6
+ getContentHeadings(content: string): TableOfContentItem[];
7
+ enhance(): void;
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<MarkdownContentRendererService, never>;
9
+ static ɵprov: i0.ɵɵInjectableDeclaration<MarkdownContentRendererService>;
10
+ }
@@ -0,0 +1,15 @@
1
+ import { AfterViewChecked } from '@angular/core';
2
+ import { SafeHtml } from '@angular/platform-browser';
3
+ import { ContentRenderer } from './content-renderer';
4
+ import * as i0 from "@angular/core";
5
+ import * as i1 from "./anchor-navigation.directive";
6
+ export default class AnalogMarkdownRouteComponent implements AfterViewChecked {
7
+ private sanitizer;
8
+ private route;
9
+ contentRenderer: ContentRenderer;
10
+ protected content: SafeHtml;
11
+ classes: string;
12
+ ngAfterViewChecked(): void;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<AnalogMarkdownRouteComponent, never>;
14
+ static ɵcmp: i0.ɵɵComponentDeclaration<AnalogMarkdownRouteComponent, "analog-markdown-route", never, { "classes": { "alias": "classes"; "required": false; }; }, {}, never, never, true, [{ directive: typeof i1.AnchorNavigationDirective; inputs: {}; outputs: {}; }]>;
15
+ }
@@ -0,0 +1,26 @@
1
+ import { AfterViewChecked, InputSignal, Signal } from '@angular/core';
2
+ import { SafeHtml } from '@angular/platform-browser';
3
+ import { Observable } from 'rxjs';
4
+ import { ContentRenderer } from './content-renderer';
5
+ import * as i0 from "@angular/core";
6
+ import * as i1 from "./anchor-navigation.directive";
7
+ export default class AnalogMarkdownComponent implements AfterViewChecked {
8
+ private sanitizer;
9
+ private route;
10
+ private zone;
11
+ private readonly platformId;
12
+ private readonly mermaidImport;
13
+ private mermaid;
14
+ private contentSource;
15
+ readonly htmlContent: Signal<SafeHtml | string | undefined>;
16
+ readonly content: InputSignal<string | object | null | undefined>;
17
+ readonly classes: InputSignal<string>;
18
+ contentRenderer: ContentRenderer;
19
+ constructor();
20
+ getContentSource(): Observable<SafeHtml | string>;
21
+ renderContent(content: string): Promise<string>;
22
+ ngAfterViewChecked(): void;
23
+ private loadMermaid;
24
+ static ɵfac: i0.ɵɵFactoryDeclaration<AnalogMarkdownComponent, never>;
25
+ static ɵcmp: i0.ɵɵComponentDeclaration<AnalogMarkdownComponent, "analog-markdown", never, { "content": { "alias": "content"; "required": false; "isSignal": true; }; "classes": { "alias": "classes"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.AnchorNavigationDirective; inputs: {}; outputs: {}; }]>;
26
+ }
@@ -0,0 +1,17 @@
1
+ import { AbstractType, Provider, ProviderToken, Type } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare abstract class MarkedContentHighlighter {
4
+ augmentCodeBlock?(code: string, lang: string): string;
5
+ abstract getHighlightExtension(): import('marked').MarkedExtension;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<MarkedContentHighlighter, never>;
7
+ static ɵprov: i0.ɵɵInjectableDeclaration<MarkedContentHighlighter>;
8
+ }
9
+ export declare function withHighlighter(provider: ({
10
+ useValue: MarkedContentHighlighter;
11
+ } | {
12
+ useClass: Type<MarkedContentHighlighter> | AbstractType<MarkedContentHighlighter>;
13
+ } | {
14
+ useFactory: (...deps: any[]) => MarkedContentHighlighter;
15
+ }) & {
16
+ deps?: ProviderToken<any>[];
17
+ }): Provider;
@@ -0,0 +1,10 @@
1
+ import { marked } from 'marked';
2
+ import * as i0 from "@angular/core";
3
+ export declare class MarkedSetupService {
4
+ private readonly marked;
5
+ private readonly highlighter;
6
+ constructor();
7
+ getMarkedInstance(): typeof marked;
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<MarkedSetupService, never>;
9
+ static ɵprov: i0.ɵɵInjectableDeclaration<MarkedSetupService>;
10
+ }
@@ -0,0 +1,18 @@
1
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
2
+ export declare class FrontmatterValidationError extends Error {
3
+ readonly issues: ReadonlyArray<StandardSchemaV1.Issue>;
4
+ readonly filename?: string | undefined;
5
+ constructor(issues: ReadonlyArray<StandardSchemaV1.Issue>, filename?: string | undefined);
6
+ }
7
+ export declare function parseRawContentFile<Attributes extends Record<string, any> = Record<string, any>>(rawContentFile: string): {
8
+ content: string;
9
+ attributes: Attributes;
10
+ };
11
+ export declare function parseRawContentFile<TSchema extends StandardSchemaV1>(rawContentFile: string, schema: TSchema, filename?: string): {
12
+ content: string;
13
+ attributes: StandardSchemaV1.InferOutput<TSchema>;
14
+ };
15
+ export declare function parseRawContentFileAsync<TSchema extends StandardSchemaV1>(rawContentFile: string, schema: TSchema, filename?: string): Promise<{
16
+ content: string;
17
+ attributes: StandardSchemaV1.InferOutput<TSchema>;
18
+ }>;
@@ -0,0 +1,7 @@
1
+ import { Provider, InjectionToken } from '@angular/core';
2
+ export interface MarkdownRendererOptions {
3
+ loadMermaid?: () => Promise<typeof import('mermaid')>;
4
+ }
5
+ export declare function withMarkdownRenderer(options?: MarkdownRendererOptions): Provider;
6
+ export declare function provideContent(...features: Provider[]): Provider[];
7
+ export declare const MERMAID_IMPORT_TOKEN: InjectionToken<Promise<typeof import('mermaid')>>;
@@ -0,0 +1,8 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class RenderTaskService {
3
+ #private;
4
+ addRenderTask(): number;
5
+ clearRenderTask(clear: number | (() => void)): void;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<RenderTaskService, never>;
7
+ static ɵprov: i0.ɵɵInjectableDeclaration<RenderTaskService>;
8
+ }
@@ -0,0 +1,2 @@
1
+ import { Observable } from 'rxjs';
2
+ export declare function waitFor<T>(prom: Promise<T> | Observable<T>): Promise<T>;
package/og/README.md DELETED
@@ -1,3 +0,0 @@
1
- # @analogjs/content/og
2
-
3
- Secondary entry point of `@analogjs/content`. It can be used by importing from `@analogjs/content/og`.
package/plugin/README.md DELETED
@@ -1,11 +0,0 @@
1
- # content-plugin
2
-
3
- This library was generated with [Nx](https://nx.dev).
4
-
5
- ## Building
6
-
7
- Run `nx build content-plugin` to build the library.
8
-
9
- ## Running unit tests
10
-
11
- Run `nx test content-plugin` to execute the unit tests via [Vitest](https://vitest.dev).
@@ -1,2 +0,0 @@
1
- declare const _default: (generatorOptions: any) => (tree: any, context: any) => Promise<any>;
2
- export default _default;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const devkit_1 = require("@nx/devkit");
4
- const update_markdown_renderer_feature_1 = require("./update-markdown-renderer-feature");
5
- exports.default = (0, devkit_1.convertNxGenerator)(update_markdown_renderer_feature_1.default);
6
- //# sourceMappingURL=compat.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../../../../../packages/content-plugin/src/migrations/update-markdown-renderer-feature/compat.ts"],"names":[],"mappings":";;AAAA,uCAAgD;AAChD,yFAA+E;AAE/E,kBAAe,IAAA,2BAAkB,EAAC,0CAA6B,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export default function update(host: Tree): Promise<() => void>;
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = update;
4
- const devkit_1 = require("@nx/devkit");
5
- const ts_morph_1 = require("ts-morph");
6
- async function update(host) {
7
- let project;
8
- (0, devkit_1.visitNotIgnoredFiles)(host, '/', (file) => {
9
- if (file.endsWith('.ts')) {
10
- const content = host.read(file, 'utf-8');
11
- if (content &&
12
- content.includes('withMarkdownRenderer') &&
13
- !content.includes('withPrismHighlighter') &&
14
- !content.includes('withShikiHighlighter')) {
15
- if (!project) {
16
- project = new ts_morph_1.Project({
17
- useInMemoryFileSystem: true,
18
- skipAddingFilesFromTsConfig: true,
19
- });
20
- }
21
- const sourceFile = project.createSourceFile(file, content);
22
- const provideContentNode = sourceFile.getFirstDescendant((node) => ts_morph_1.Node.isCallExpression(node) &&
23
- node.getText().includes('provideContent') &&
24
- node.getText().includes('withMarkdownRenderer'));
25
- if (provideContentNode) {
26
- sourceFile.addImportDeclaration({
27
- moduleSpecifier: '@analogjs/content/prism-highlighter',
28
- namedImports: ['withPrismHighlighter'],
29
- });
30
- provideContentNode.addArgument('withPrismHighlighter()');
31
- }
32
- host.write(file, sourceFile.getFullText());
33
- }
34
- }
35
- });
36
- // NOTE: we only add the dependency if the project is an Angular project
37
- // Nx projects can add the dependency from migrations.json
38
- let dependencyAdded = false;
39
- if (host.exists('/angular.json')) {
40
- (0, devkit_1.addDependenciesToPackageJson)(host, { 'marked-mangle': '^1.1.7' }, {});
41
- dependencyAdded = true;
42
- }
43
- await (0, devkit_1.formatFiles)(host);
44
- if (dependencyAdded) {
45
- return () => (0, devkit_1.installPackagesTask)(host);
46
- }
47
- }
48
- //# sourceMappingURL=update-markdown-renderer-feature.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-markdown-renderer-feature.js","sourceRoot":"","sources":["../../../../../../../packages/content-plugin/src/migrations/update-markdown-renderer-feature/update-markdown-renderer-feature.ts"],"names":[],"mappings":";;AASA,yBAuDC;AAhED,uCAMoB;AACpB,uCAAyD;AAE1C,KAAK,UAAU,MAAM,CAAC,IAAU;IAC7C,IAAI,OAAgB,CAAC;IAErB,IAAA,6BAAoB,EAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE;QACvC,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACzC,IACE,OAAO;gBACP,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC;gBACxC,CAAC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC;gBACzC,CAAC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EACzC,CAAC;gBACD,IAAI,CAAC,OAAO,EAAE,CAAC;oBACb,OAAO,GAAG,IAAI,kBAAO,CAAC;wBACpB,qBAAqB,EAAE,IAAI;wBAC3B,2BAA2B,EAAE,IAAI;qBAClC,CAAC,CAAC;gBACL,CAAC;gBAED,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBAE3D,MAAM,kBAAkB,GAAG,UAAU,CAAC,kBAAkB,CACtD,CAAC,IAAI,EAA0B,EAAE,CAC/B,eAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC;oBAC3B,IAAI,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;oBACzC,IAAI,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAClD,CAAC;gBAEF,IAAI,kBAAkB,EAAE,CAAC;oBACvB,UAAU,CAAC,oBAAoB,CAAC;wBAC9B,eAAe,EAAE,qCAAqC;wBACtD,YAAY,EAAE,CAAC,sBAAsB,CAAC;qBACvC,CAAC,CAAC;oBAEH,kBAAkB,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;gBAC3D,CAAC;gBAED,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,wEAAwE;IACxE,2DAA2D;IAC3D,IAAI,eAAe,GAAG,KAAK,CAAC;IAC5B,IAAI,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC;QACjC,IAAA,qCAA4B,EAAC,IAAI,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;QACtE,eAAe,GAAG,IAAI,CAAC;IACzB,CAAC;IAED,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAExB,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,GAAG,EAAE,CAAC,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;IACzC,CAAC;AACH,CAAC"}
@@ -1,3 +0,0 @@
1
- # @analogjs/content/prism-highlighter
2
-
3
- Secondary entry point of `@analogjs/content`. It can be used by importing from `@analogjs/content/prism-highlighter`.
@@ -1,3 +0,0 @@
1
- # @analogjs/content/resources
2
-
3
- Secondary entry point of `@analogjs/content`. It can be used by importing from `@analogjs/content/resources`.
@@ -1,3 +0,0 @@
1
- # @analogjs/content/shiki-highlighter
2
-
3
- Secondary entry point of `@analogjs/content`. It can be used by importing from `@analogjs/content/shiki-highlighter`.
@@ -1,19 +0,0 @@
1
- import { SatoriOptions } from 'satori';
2
-
3
- interface ImageResponseOptions {
4
- width?: number;
5
- height?: number;
6
- fonts?: SatoriOptions['fonts'];
7
- debug?: boolean;
8
- status?: number;
9
- statusText?: string;
10
- headers?: Record<string, string>;
11
- tailwindConfig?: SatoriOptions['tailwindConfig'];
12
- }
13
-
14
- declare class ImageResponse extends Response {
15
- constructor(element: string, options?: ImageResponseOptions);
16
- }
17
-
18
- export { ImageResponse };
19
- export type { ImageResponseOptions };
@@ -1,15 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Provider } from '@angular/core';
3
- import * as marked from 'marked';
4
- import { MarkedContentHighlighter } from '@analogjs/content';
5
-
6
- declare class PrismHighlighter extends MarkedContentHighlighter {
7
- augmentCodeBlock(code: string, lang: string): string;
8
- getHighlightExtension(): marked.MarkedExtension;
9
- static ɵfac: i0.ɵɵFactoryDeclaration<PrismHighlighter, never>;
10
- static ɵprov: i0.ɵɵInjectableDeclaration<PrismHighlighter>;
11
- }
12
-
13
- declare function withPrismHighlighter(): Provider[];
14
-
15
- export { PrismHighlighter, withPrismHighlighter };
@@ -1,20 +0,0 @@
1
- import * as _angular_core from '@angular/core';
2
- import { Signal } from '@angular/core';
3
- import * as _analogjs_content from '@analogjs/content';
4
- import { InjectContentFilesFilterFunction, ContentFile } from '@analogjs/content';
5
-
6
- declare function contentFilesResource<Attributes extends Record<string, any>>(filterFn?: InjectContentFilesFilterFunction<Attributes> | undefined): _angular_core.ResourceRef<_analogjs_content.ContentFile<Attributes>[] | undefined>;
7
-
8
- type ContentFileParams = Signal<string | {
9
- customFilename: string;
10
- }>;
11
- /**
12
- * Resource for requesting an individual content file
13
- *
14
- * @param params
15
- * @param fallback
16
- * @returns
17
- */
18
- declare function contentFileResource<Attributes extends Record<string, any> = Record<string, any>>(params?: ContentFileParams, fallback?: string): _angular_core.ResourceRef<ContentFile<Record<string, never> | Attributes> | undefined>;
19
-
20
- export { contentFileResource, contentFilesResource };
@@ -1,11 +0,0 @@
1
- import { Provider } from '@angular/core';
2
- import { CodeToHastOptionsCommon, BundledLanguage, CodeOptionsMeta, CodeOptionsSingleTheme, BundledTheme, CodeOptionsMultipleThemes } from 'shiki';
3
-
4
- type ShikiHighlightOptions = Partial<Omit<CodeToHastOptionsCommon<BundledLanguage>, 'lang'>> & CodeOptionsMeta & Partial<CodeOptionsSingleTheme<BundledTheme>> & Partial<CodeOptionsMultipleThemes<BundledTheme>>;
5
- type WithShikiHighlighterOptions = ShikiHighlightOptions & {
6
- container?: string;
7
- };
8
- declare function withShikiHighlighter(_opts?: WithShikiHighlighterOptions): Provider[];
9
-
10
- export { withShikiHighlighter };
11
- export type { ShikiHighlightOptions, WithShikiHighlighterOptions };
@@ -1,168 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { InjectionToken, Provider, AfterViewChecked, Signal, Type, AbstractType, ProviderToken } from '@angular/core';
3
- import * as rxjs from 'rxjs';
4
- import { Observable } from 'rxjs';
5
- import * as mermaid from 'mermaid';
6
- import { SafeHtml } from '@angular/platform-browser';
7
- import * as marked from 'marked';
8
- import { marked as marked$1 } from 'marked';
9
-
10
- declare class AnchorNavigationDirective {
11
- private readonly document;
12
- private readonly location;
13
- private readonly router;
14
- handleNavigation(element: EventTarget | null): boolean;
15
- static ɵfac: i0.ɵɵFactoryDeclaration<AnchorNavigationDirective, never>;
16
- static ɵdir: i0.ɵɵDirectiveDeclaration<AnchorNavigationDirective, "[analogAnchorNavigation]", never, {}, {}, never, never, true, never>;
17
- }
18
-
19
- type TableOfContentItem = {
20
- id: string;
21
- level: number;
22
- text: string;
23
- };
24
- type RenderedContent = {
25
- content: string;
26
- toc: TableOfContentItem[];
27
- };
28
- declare abstract class ContentRenderer {
29
- render(content: string): Promise<RenderedContent>;
30
- getContentHeadings(_content: string): TableOfContentItem[];
31
- enhance(): void;
32
- static ɵfac: i0.ɵɵFactoryDeclaration<ContentRenderer, never>;
33
- static ɵprov: i0.ɵɵInjectableDeclaration<ContentRenderer>;
34
- }
35
- declare class NoopContentRenderer implements ContentRenderer {
36
- private readonly transferState;
37
- private contentId;
38
- /**
39
- * Generates a hash from the content string
40
- * to be used with the transfer state
41
- */
42
- private generateHash;
43
- render(content: string): Promise<RenderedContent>;
44
- enhance(): void;
45
- getContentHeadings(content: string): TableOfContentItem[];
46
- private extractHeadings;
47
- private extractHeadingsFromMarkdown;
48
- private extractHeadingsFromHtml;
49
- private makeSlug;
50
- }
51
-
52
- interface ContentFile<Attributes extends Record<string, any> = Record<string, any>> {
53
- filename: string;
54
- slug: string;
55
- content?: string | object;
56
- attributes: Attributes;
57
- toc?: TableOfContentItem[];
58
- }
59
-
60
- /**
61
- * Retrieves the static content using the provided param and/or prefix.
62
- *
63
- * @param param route parameter (default: 'slug')
64
- * @param fallback fallback text if content file is not found (default: 'No Content Found')
65
- */
66
- declare function injectContent<Attributes extends Record<string, any> = Record<string, any>>(param?: string | {
67
- param: string;
68
- subdirectory: string;
69
- } | {
70
- customFilename: string;
71
- }, fallback?: string): Observable<ContentFile<Attributes | Record<string, never>>>;
72
-
73
- declare function injectContentFiles<Attributes extends Record<string, any>>(filterFn?: InjectContentFilesFilterFunction<Attributes>): ContentFile<Attributes>[];
74
- type InjectContentFilesFilterFunction<T extends Record<string, any>> = (value: ContentFile<T>, index: number, array: ContentFile<T>[]) => boolean;
75
- declare function injectContentFilesMap(): Record<string, () => Promise<string>>;
76
-
77
- declare class MarkdownContentRendererService implements ContentRenderer {
78
- #private;
79
- render(content: string): Promise<RenderedContent>;
80
- getContentHeadings(content: string): TableOfContentItem[];
81
- enhance(): void;
82
- static ɵfac: i0.ɵɵFactoryDeclaration<MarkdownContentRendererService, never>;
83
- static ɵprov: i0.ɵɵInjectableDeclaration<MarkdownContentRendererService>;
84
- }
85
-
86
- interface MarkdownRendererOptions {
87
- loadMermaid?: () => Promise<typeof mermaid>;
88
- }
89
- declare function withMarkdownRenderer(options?: MarkdownRendererOptions): Provider;
90
- declare function provideContent(...features: Provider[]): Provider[];
91
- declare const MERMAID_IMPORT_TOKEN: InjectionToken<Promise<typeof mermaid>>;
92
-
93
- declare class AnalogMarkdownRouteComponent implements AfterViewChecked {
94
- private sanitizer;
95
- private route;
96
- contentRenderer: ContentRenderer;
97
- protected content: SafeHtml;
98
- classes: string;
99
- ngAfterViewChecked(): void;
100
- static ɵfac: i0.ɵɵFactoryDeclaration<AnalogMarkdownRouteComponent, never>;
101
- static ɵcmp: i0.ɵɵComponentDeclaration<AnalogMarkdownRouteComponent, "analog-markdown-route", never, { "classes": { "alias": "classes"; "required": false; }; }, {}, never, never, true, [{ directive: typeof AnchorNavigationDirective; inputs: {}; outputs: {}; }]>;
102
- }
103
-
104
- declare class AnalogMarkdownComponent implements AfterViewChecked {
105
- private sanitizer;
106
- private route;
107
- private zone;
108
- private readonly platformId;
109
- private readonly mermaidImport;
110
- private mermaid;
111
- private contentSource;
112
- readonly htmlContent: Signal<SafeHtml | undefined>;
113
- readonly content: i0.InputSignal<string | object | null | undefined>;
114
- readonly classes: i0.InputSignal<string>;
115
- contentRenderer: ContentRenderer;
116
- constructor();
117
- getContentSource(): rxjs.Observable<string | SafeHtml>;
118
- renderContent(content: string): Promise<string>;
119
- ngAfterViewChecked(): void;
120
- private loadMermaid;
121
- static ɵfac: i0.ɵɵFactoryDeclaration<AnalogMarkdownComponent, never>;
122
- static ɵcmp: i0.ɵɵComponentDeclaration<AnalogMarkdownComponent, "analog-markdown", never, { "content": { "alias": "content"; "required": false; "isSignal": true; }; "classes": { "alias": "classes"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof AnchorNavigationDirective; inputs: {}; outputs: {}; }]>;
123
- }
124
-
125
- declare function parseRawContentFile<Attributes extends Record<string, any>>(rawContentFile: string): {
126
- content: string;
127
- attributes: Attributes;
128
- };
129
-
130
- declare class MarkedSetupService {
131
- private readonly marked;
132
- private readonly highlighter;
133
- constructor();
134
- getMarkedInstance(): typeof marked$1;
135
- static ɵfac: i0.ɵɵFactoryDeclaration<MarkedSetupService, never>;
136
- static ɵprov: i0.ɵɵInjectableDeclaration<MarkedSetupService>;
137
- }
138
-
139
- interface MarkedContentHighlighter {
140
- augmentCodeBlock?(code: string, lang: string): string;
141
- }
142
- declare abstract class MarkedContentHighlighter {
143
- abstract getHighlightExtension(): marked.MarkedExtension;
144
- static ɵfac: i0.ɵɵFactoryDeclaration<MarkedContentHighlighter, never>;
145
- static ɵprov: i0.ɵɵInjectableDeclaration<MarkedContentHighlighter>;
146
- }
147
- declare function withHighlighter(provider: ({
148
- useValue: MarkedContentHighlighter;
149
- } | {
150
- useClass: Type<MarkedContentHighlighter> | AbstractType<MarkedContentHighlighter>;
151
- } | {
152
- useFactory: (...deps: any[]) => MarkedContentHighlighter;
153
- }) & {
154
- deps?: ProviderToken<any>[];
155
- }): Provider;
156
-
157
- type ContentListLoaderFunction<Attributes extends Record<string, any>> = () => Promise<ContentFile<Attributes>[]>;
158
- declare const CONTENT_LIST_LOADER: InjectionToken<ContentListLoaderFunction<any>>;
159
- declare function injectContentListLoader<Attributes extends Record<string, any>>(): ContentListLoaderFunction<Attributes>;
160
- declare function withContentListLoader(): Provider;
161
-
162
- type ContentFileLoaderFunction = () => Promise<Record<string, () => Promise<string>>>;
163
- declare const CONTENT_FILE_LOADER: InjectionToken<ContentFileLoaderFunction>;
164
- declare function injectContentFileLoader(): ContentFileLoaderFunction;
165
- declare function withContentFileLoader(): Provider;
166
-
167
- export { AnchorNavigationDirective, CONTENT_FILE_LOADER, CONTENT_LIST_LOADER, ContentRenderer, MERMAID_IMPORT_TOKEN, AnalogMarkdownComponent as MarkdownComponent, MarkdownContentRendererService, AnalogMarkdownRouteComponent as MarkdownRouteComponent, MarkedContentHighlighter, MarkedSetupService, NoopContentRenderer, injectContent, injectContentFileLoader, injectContentFiles, injectContentFilesMap, injectContentListLoader, parseRawContentFile, provideContent, withContentFileLoader, withContentListLoader, withHighlighter, withMarkdownRenderer };
168
- export type { ContentFile, InjectContentFilesFilterFunction };