@mdfriday/foundry 25.12.1 → 26.2.2

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 (34) hide show
  1. package/README.md +8 -0
  2. package/dist/index.js +1 -1
  3. package/dist/internal/application/incremental-build-coordinator.d.ts +1 -1
  4. package/dist/internal/application/ssg.d.ts +5 -5
  5. package/dist/internal/domain/config/entity/config.d.ts +6 -2
  6. package/dist/internal/domain/config/entity/markdown.d.ts +16 -0
  7. package/dist/internal/domain/config/index.d.ts +2 -0
  8. package/dist/internal/domain/config/type.d.ts +11 -0
  9. package/dist/internal/domain/config/vo/markdown.d.ts +5 -0
  10. package/dist/internal/domain/content/entity/page.d.ts +2 -0
  11. package/dist/internal/domain/content/entity/pagesource.d.ts +2 -0
  12. package/dist/internal/domain/content/type.d.ts +13 -3
  13. package/dist/internal/domain/content/vo/fileinfo.d.ts +1 -0
  14. package/dist/internal/domain/markdown/entity/markdown.d.ts +2 -0
  15. package/dist/internal/domain/markdown/factory/it/config.d.ts +107 -0
  16. package/dist/internal/domain/markdown/factory/it/index.d.ts +32 -0
  17. package/dist/internal/domain/markdown/factory/it/parserresult.d.ts +18 -0
  18. package/dist/internal/domain/markdown/factory/it/plugins/callout-plugin.d.ts +6 -0
  19. package/dist/internal/domain/markdown/factory/it/plugins/latex-plugin.d.ts +6 -0
  20. package/dist/internal/domain/markdown/factory/it/plugins/mermaid-plugin.d.ts +6 -0
  21. package/dist/internal/domain/markdown/factory/it/plugins/tag-plugin.d.ts +24 -0
  22. package/dist/internal/domain/markdown/factory/it/plugins/wikilink-plugin.d.ts +12 -0
  23. package/dist/internal/domain/markdown/factory/it/plugins/wikilink.d.ts +16 -0
  24. package/dist/internal/domain/markdown/factory/it/tableofcontents.d.ts +60 -0
  25. package/dist/internal/domain/markdown/factory/it/util/path.d.ts +32 -0
  26. package/dist/internal/domain/markdown/factory/it/util/slugger-fallback.d.ts +2 -0
  27. package/dist/internal/domain/markdown/factory/markdown.d.ts +1 -1
  28. package/dist/internal/domain/paths/entity/path.d.ts +1 -0
  29. package/dist/internal/domain/site/entity/page.d.ts +6 -0
  30. package/dist/internal/domain/site/entity/pagegraph.d.ts +17 -0
  31. package/dist/internal/domain/site/entity/site.d.ts +8 -0
  32. package/dist/internal/domain/site/service/html-link-processor.d.ts +20 -0
  33. package/dist/internal/domain/site/vo/path.d.ts +18 -0
  34. package/package.json +23 -1
@@ -11,7 +11,7 @@ export interface IncrementalBuildConfig {
11
11
  enableWatching: boolean;
12
12
  batchDelay?: number;
13
13
  progressCallback?: SSGProgressCallback;
14
- markdown: MarkdownRenderer;
14
+ markdown?: MarkdownRenderer;
15
15
  httpClient?: HttpClient;
16
16
  liveReload?: {
17
17
  enabled?: boolean;
@@ -13,8 +13,8 @@ export interface DomainInstances {
13
13
  modules: Modules;
14
14
  resources: Resources;
15
15
  }
16
- export declare function generateStaticSite(projDir: string, modulesDir: string, markdown: MarkdownRenderer): Promise<void>;
17
- export declare function processSSG(projDir: string, modulesDir: string, markdown: MarkdownRenderer): Promise<void>;
16
+ export declare function generateStaticSite(projDir: string, modulesDir: string, markdown?: MarkdownRenderer): Promise<void>;
17
+ export declare function processSSG(projDir: string, modulesDir: string, markdown?: MarkdownRenderer): Promise<void>;
18
18
  export interface SSGProgressCallback {
19
19
  (progress: {
20
20
  stage: 'config' | 'modules' | 'filesystem' | 'content' | 'site' | 'template' | 'pages' | 'build' | 'completion';
@@ -30,6 +30,6 @@ export interface SSGProgressCallback {
30
30
  };
31
31
  }): void;
32
32
  }
33
- export declare function generateStaticSiteWithProgress(projDir: string, modulesDir: string, markdown: MarkdownRenderer, onProgress?: SSGProgressCallback, httpClient?: HttpClient): Promise<DomainInstances>;
34
- export declare function processSSGWithProgress(projDir: string, modulesDir: string, markdown: MarkdownRenderer, onProgress?: SSGProgressCallback, httpClient?: HttpClient): Promise<void>;
35
- export declare function serveSSG(projDir: string, modulesDir: string, markdown: MarkdownRenderer, onProgress?: SSGProgressCallback, httpClient?: HttpClient): Promise<DomainInstances>;
33
+ export declare function generateStaticSiteWithProgress(projDir: string, modulesDir: string, markdown?: MarkdownRenderer, onProgress?: SSGProgressCallback, httpClient?: HttpClient): Promise<DomainInstances>;
34
+ export declare function processSSGWithProgress(projDir: string, modulesDir: string, markdown?: MarkdownRenderer, onProgress?: SSGProgressCallback, httpClient?: HttpClient): Promise<void>;
35
+ export declare function serveSSG(projDir: string, modulesDir: string, markdown?: MarkdownRenderer, onProgress?: SSGProgressCallback, httpClient?: HttpClient): Promise<DomainInstances>;
@@ -7,6 +7,7 @@ import { Social } from './social';
7
7
  import { Language } from './language';
8
8
  import { Taxonomy } from './taxonomy';
9
9
  import { Dir } from "./dir";
10
+ import { Markdown } from './markdown';
10
11
  export declare class Config {
11
12
  private configSourceFs;
12
13
  private provider;
@@ -17,7 +18,8 @@ export declare class Config {
17
18
  private social;
18
19
  private language;
19
20
  private taxonomy;
20
- constructor(configSourceFs: Fs, provider: Provider, root: Root, dir: Dir, module: Module, service: Service, social: Social, language: Language, taxonomy: Taxonomy);
21
+ private markdown;
22
+ constructor(configSourceFs: Fs, provider: Provider, root: Root, dir: Dir, module: Module, service: Service, social: Social, language: Language, taxonomy: Taxonomy, markdown: Markdown);
21
23
  fs(): Fs;
22
24
  getProvider(): Provider;
23
25
  theme(): string;
@@ -28,8 +30,10 @@ export declare class Config {
28
30
  getSocial(): Social;
29
31
  getLanguage(): Language;
30
32
  getTaxonomy(): Taxonomy;
33
+ getMarkdown(): Markdown;
31
34
  setLanguage(language: Language): void;
32
35
  setTaxonomy(taxonomy: Taxonomy): void;
36
+ setMarkdown(markdown: Markdown): void;
33
37
  validate(): boolean;
34
38
  }
35
- export declare function newConfig(configSourceFs: Fs, provider: Provider, root: Root, dir: Dir, module: Module, service: Service, social: Social, language: Language, taxonomy: Taxonomy): Config;
39
+ export declare function newConfig(configSourceFs: Fs, provider: Provider, root: Root, dir: Dir, module: Module, service: Service, social: Social, language: Language, taxonomy: Taxonomy, markdown: Markdown): Config;
@@ -0,0 +1,16 @@
1
+ import { MarkdownConfig, MarkdownPlugins } from '../type';
2
+ export declare class Markdown {
3
+ private markdownConfig;
4
+ constructor(markdownConfig: MarkdownConfig);
5
+ useInternalRenderer(): boolean;
6
+ isWikilinkEnabled(): boolean;
7
+ isTagEnabled(): boolean;
8
+ isCalloutEnabled(): boolean;
9
+ isLatexEnabled(): boolean;
10
+ isMermaidEnabled(): boolean;
11
+ getMarkdownConfig(): MarkdownConfig;
12
+ getPlugins(): MarkdownPlugins;
13
+ hasEnabledPlugins(): boolean;
14
+ validate(): boolean;
15
+ }
16
+ export declare function newMarkdown(data: any): Markdown;
@@ -6,10 +6,12 @@ export { Service, newService } from './entity/service';
6
6
  export { Language, newLanguage } from './entity/language';
7
7
  export { Taxonomy, newTaxonomy } from './entity/taxonomy';
8
8
  export { Social, newSocial } from './entity/social';
9
+ export { Markdown, newMarkdown } from './entity/markdown';
9
10
  export * from './vo/root';
10
11
  export * from './vo/module';
11
12
  export * from './vo/service';
12
13
  export * from './vo/language';
13
14
  export * from './vo/taxonomy';
14
15
  export * from './vo/social';
16
+ export * from './vo/markdown';
15
17
  export { loadConfigWithParams } from './factory/config';
@@ -112,6 +112,17 @@ export interface ViewName {
112
112
  plural: string;
113
113
  pluralTreeKey: string;
114
114
  }
115
+ export interface MarkdownPlugins {
116
+ wikilink: boolean;
117
+ tag: boolean;
118
+ callout: boolean;
119
+ latex: boolean;
120
+ mermaid: boolean;
121
+ }
122
+ export interface MarkdownConfig {
123
+ useInternalRenderer: boolean;
124
+ plugins: MarkdownPlugins;
125
+ }
115
126
  export declare class ConfigError extends Error {
116
127
  code?: string | undefined;
117
128
  constructor(message: string, code?: string | undefined);
@@ -0,0 +1,5 @@
1
+ import { MarkdownConfig, MarkdownPlugins } from '../type';
2
+ export declare const DefaultMarkdownPlugins: MarkdownPlugins;
3
+ export declare const DefaultMarkdownConfig: MarkdownConfig;
4
+ export declare function decodeMarkdownConfig(data: any): MarkdownConfig;
5
+ export declare function isDefaultMarkdownConfig(config: MarkdownConfig): boolean;
@@ -26,6 +26,8 @@ export declare class PageImpl implements Page {
26
26
  section(): string;
27
27
  paths(): Path;
28
28
  path(): string;
29
+ slug(): string;
30
+ private pathToSlug;
29
31
  posOffset(offset: number): Promise<Position>;
30
32
  description(): string;
31
33
  get Description(): string;
@@ -17,6 +17,8 @@ export declare class Source implements PageSource {
17
17
  section(): string;
18
18
  paths(): any;
19
19
  path(): string;
20
+ slug(): string;
21
+ private pathToSlug;
20
22
  opener(): () => Promise<any>;
21
23
  openReader(): any;
22
24
  content(): Promise<Uint8Array>;
@@ -6,8 +6,16 @@ export interface ComponentPath {
6
6
  component(): string;
7
7
  path(): string;
8
8
  }
9
- export interface Services extends URLService, LangService, FsService, TaxonomyService {
10
- markdown(): MarkdownRenderer;
9
+ export interface Services extends URLService, LangService, FsService, TaxonomyService, MDService {
10
+ markdown(): MarkdownRenderer | undefined;
11
+ }
12
+ export interface MDService {
13
+ useInternalRenderer(): boolean;
14
+ isWikilinkEnabled(): boolean;
15
+ isTagEnabled(): boolean;
16
+ isCalloutEnabled(): boolean;
17
+ isLatexEnabled(): boolean;
18
+ isMermaidEnabled(): boolean;
11
19
  }
12
20
  export interface URLService {
13
21
  baseUrl(): string;
@@ -55,6 +63,7 @@ export interface PageSource {
55
63
  section(): string;
56
64
  paths(): Path;
57
65
  path(): string;
66
+ slug(): string;
58
67
  }
59
68
  export interface FileProvider {
60
69
  file(): File;
@@ -196,6 +205,7 @@ export interface FileWithoutOverlap {
196
205
  dir(): string;
197
206
  ext(): string;
198
207
  logicalName(): string;
208
+ originalBaseFileName(): string;
199
209
  baseFileName(): string;
200
210
  translationBaseName(): string;
201
211
  contentBaseName(): string;
@@ -261,7 +271,7 @@ export interface FrontMatter {
261
271
  title: string;
262
272
  description: string;
263
273
  weight: number;
264
- date: Date;
274
+ date?: Date;
265
275
  terms: Record<string, string[]>;
266
276
  params?: Record<string, any> | undefined;
267
277
  organization?: Organization;
@@ -19,6 +19,7 @@ export declare class FileInfo implements File {
19
19
  dir(): string;
20
20
  ext(): string;
21
21
  logicalName(): string;
22
+ originalBaseFileName(): string;
22
23
  baseFileName(): string;
23
24
  translationBaseName(): string;
24
25
  contentBaseName(): string;
@@ -10,6 +10,8 @@ export declare class MarkdownImpl implements Markdown {
10
10
  isDefaultCodeBlockRenderer(): boolean;
11
11
  prepareRender(source: Uint8Array): Promise<RenderableDocument>;
12
12
  parseAndRenderContent(source: Uint8Array, options?: ParseAndRenderOptions): Promise<ContentResult>;
13
+ private hasCollectedTagsSupport;
14
+ private getCollectedTags;
13
15
  parseContent(source: Uint8Array): Promise<ParsedContentResult>;
14
16
  private parseFrontMatter;
15
17
  private parseYAML;
@@ -0,0 +1,107 @@
1
+ export declare const AutoHeadingIDType: {
2
+ readonly GitHub: "github";
3
+ readonly GitHubAscii: "github-ascii";
4
+ readonly Blackfriday: "blackfriday";
5
+ };
6
+ export type AutoHeadingIDType = typeof AutoHeadingIDType[keyof typeof AutoHeadingIDType];
7
+ export interface TypographerConfig {
8
+ disable: boolean;
9
+ leftSingleQuote: string;
10
+ rightSingleQuote: string;
11
+ leftDoubleQuote: string;
12
+ rightDoubleQuote: string;
13
+ enDash: string;
14
+ emDash: string;
15
+ ellipsis: string;
16
+ leftAngleQuote: string;
17
+ rightAngleQuote: string;
18
+ apostrophe: string;
19
+ }
20
+ export interface CJKConfig {
21
+ enable: boolean;
22
+ eastAsianLineBreaks: boolean;
23
+ eastAsianLineBreaksStyle: string;
24
+ escapedSpace: boolean;
25
+ }
26
+ export interface DelimitersConfig {
27
+ inline: string[][];
28
+ block: string[][];
29
+ }
30
+ export interface PassthroughConfig {
31
+ enable: boolean;
32
+ delimiters: DelimitersConfig;
33
+ }
34
+ export interface HighlightConfig {
35
+ style: string;
36
+ lineNos: boolean;
37
+ lineNoStart: number;
38
+ anchorLineNos: boolean;
39
+ lineAnchors: string;
40
+ lineNumbersInTable: boolean;
41
+ noClasses: boolean;
42
+ codeFences: boolean;
43
+ guessSyntax: boolean;
44
+ tabWidth: number;
45
+ }
46
+ export interface ParserAttributeConfig {
47
+ title: boolean;
48
+ block: boolean;
49
+ }
50
+ export interface ParserConfig {
51
+ autoHeadingID: boolean;
52
+ autoHeadingIDType: AutoHeadingIDType;
53
+ wrapStandAloneImageWithinParagraph: boolean;
54
+ attribute: ParserAttributeConfig;
55
+ }
56
+ export interface RendererConfig {
57
+ unsafe: boolean;
58
+ }
59
+ export interface WikilinkConfig {
60
+ enable: boolean;
61
+ disableBrokenWikilinks?: boolean;
62
+ markdownLinkResolution?: 'absolute' | 'relative' | 'shortest';
63
+ prettyLinks?: boolean;
64
+ }
65
+ export interface LatexConfig {
66
+ enable: boolean;
67
+ }
68
+ export interface MermaidConfig {
69
+ enable: boolean;
70
+ }
71
+ export interface ExtensionsConfig {
72
+ typographer: TypographerConfig;
73
+ footnote: boolean;
74
+ definitionList: boolean;
75
+ table: boolean;
76
+ strikethrough: boolean;
77
+ linkify: boolean;
78
+ linkifyProtocol: string;
79
+ taskList: boolean;
80
+ cjk: CJKConfig;
81
+ passthrough: PassthroughConfig;
82
+ highlight: HighlightConfig;
83
+ wikilink?: WikilinkConfig;
84
+ parseTags?: boolean;
85
+ callouts?: boolean;
86
+ latex?: LatexConfig;
87
+ mermaid?: MermaidConfig;
88
+ }
89
+ export interface ImageRenderHookConfig {
90
+ enableDefault: boolean;
91
+ }
92
+ export interface LinkRenderHookConfig {
93
+ enableDefault: boolean;
94
+ }
95
+ export interface RenderHooksConfig {
96
+ image: ImageRenderHookConfig;
97
+ link: LinkRenderHookConfig;
98
+ }
99
+ export interface DomainMarkdownConfig {
100
+ renderer: RendererConfig;
101
+ parser: ParserConfig;
102
+ extensions: ExtensionsConfig;
103
+ duplicateResourceFiles: boolean;
104
+ renderHooks: RenderHooksConfig;
105
+ }
106
+ export declare const DefaultHighlightConfig: HighlightConfig;
107
+ export declare const DefaultMarkdownConfig: DomainMarkdownConfig;
@@ -0,0 +1,32 @@
1
+ import MarkdownIt from 'markdown-it';
2
+ import Token from 'markdown-it/lib/token.mjs';
3
+ import { DomainMarkdownConfig } from './config';
4
+ import { MarkdownRenderer, ParsingResult } from "@internal/domain/markdown";
5
+ export declare class MarkdownItRenderer implements MarkdownRenderer {
6
+ private md;
7
+ private config;
8
+ private idGenerator;
9
+ private collectedTags;
10
+ constructor(config: DomainMarkdownConfig, externalMd?: MarkdownIt);
11
+ private setupRendererRules;
12
+ render(source: string): Promise<string>;
13
+ getCollectedTags(): string[];
14
+ parse(source: string): Promise<ParsingResult>;
15
+ _parse(source: string): Promise<Token[]>;
16
+ getMarkdownIt(): MarkdownIt;
17
+ addPlugin(plugin: any, options?: any): void;
18
+ private createMarkdownItInstance;
19
+ private configureBasicPlugins;
20
+ }
21
+ export declare function createMarkdownItRenderer(config?: Partial<DomainMarkdownConfig>, externalMd?: MarkdownIt): MarkdownItRenderer;
22
+ export { DomainMarkdownConfig, DefaultMarkdownConfig } from './config';
23
+ export { ParserResult } from './parserresult';
24
+ export { TableOfContentsImpl, HeaderImpl, LinkImpl, ParagraphImpl, TOCBuilder, AutoIDGenerator, Fragment } from './tableofcontents';
25
+ export { wikilinkPlugin } from './plugins/wikilink-plugin';
26
+ export { tagPlugin } from './plugins/tag-plugin';
27
+ export { calloutPlugin } from './plugins/callout-plugin';
28
+ export { latexPlugin } from './plugins/latex-plugin';
29
+ export { mermaidPlugin } from './plugins/mermaid-plugin';
30
+ export { preprocessWikilinks } from './plugins/wikilink';
31
+ export * from './util/path';
32
+ export * from './util/slugger-fallback';
@@ -0,0 +1,18 @@
1
+ import Token from 'markdown-it/lib/token.mjs';
2
+ import { ParsingResult, Header, TocFragments } from '../../index';
3
+ import { AutoIDGenerator } from '@internal/domain/markdown/vo/tableofcontents';
4
+ export declare class ParserResult implements ParsingResult {
5
+ private _headers;
6
+ private _toc;
7
+ private tokens;
8
+ private source;
9
+ private idGenerator;
10
+ constructor(tokens: Token[], source: Uint8Array, idGenerator?: AutoIDGenerator);
11
+ headers(): Header[];
12
+ tableOfContents(): TocFragments;
13
+ getTokens(): Token[];
14
+ getSource(): Uint8Array;
15
+ private buildTableOfContents;
16
+ private extractHeaders;
17
+ private findNextTextToken;
18
+ }
@@ -0,0 +1,6 @@
1
+ import MarkdownIt from 'markdown-it';
2
+ export interface CalloutPluginOptions {
3
+ enable?: boolean;
4
+ }
5
+ export declare function calloutPlugin(md: MarkdownIt, options?: CalloutPluginOptions): void;
6
+ export default calloutPlugin;
@@ -0,0 +1,6 @@
1
+ import MarkdownIt from 'markdown-it';
2
+ export interface LatexPluginOptions {
3
+ enable?: boolean;
4
+ }
5
+ export declare function latexPlugin(md: MarkdownIt, options?: LatexPluginOptions): void;
6
+ export default latexPlugin;
@@ -0,0 +1,6 @@
1
+ import MarkdownIt from 'markdown-it';
2
+ export interface MermaidPluginOptions {
3
+ enable?: boolean;
4
+ }
5
+ export declare function mermaidPlugin(md: MarkdownIt, options?: MermaidPluginOptions): void;
6
+ export default mermaidPlugin;
@@ -0,0 +1,24 @@
1
+ import MarkdownIt from 'markdown-it';
2
+ interface TagPluginState {
3
+ tagBaseURL?: string;
4
+ onTagFound?: (tag: string) => void;
5
+ }
6
+ declare module 'markdown-it' {
7
+ interface MarkdownIt {
8
+ __tagPluginState?: TagPluginState;
9
+ }
10
+ }
11
+ export interface TagMeta {
12
+ rawTag: string;
13
+ slugTag: string;
14
+ url: string;
15
+ }
16
+ export declare const tagRegex: RegExp;
17
+ export interface TagPluginOptions {
18
+ enable?: boolean;
19
+ tagBaseURL?: string;
20
+ onTagFound?: (tag: string) => void;
21
+ }
22
+ export declare function slugTag(tag: string): string;
23
+ export declare function tagPlugin(md: MarkdownIt, options?: TagPluginOptions): void;
24
+ export default tagPlugin;
@@ -0,0 +1,12 @@
1
+ import MarkdownIt from 'markdown-it';
2
+ export interface WikilinkMeta {
3
+ isEmbed: boolean;
4
+ filepath: string;
5
+ anchor: string;
6
+ alias?: string | undefined;
7
+ url: string;
8
+ }
9
+ export declare function wikilinkPlugin(md: MarkdownIt, options?: {
10
+ enable?: boolean;
11
+ }): void;
12
+ export default wikilinkPlugin;
@@ -0,0 +1,16 @@
1
+ export declare const externalLinkRegex: RegExp;
2
+ export declare const wikilinkRegex: RegExp;
3
+ export declare const tableRegex: RegExp;
4
+ export declare const tableWikilinkRegex: RegExp;
5
+ export declare function preprocessWikilinks(src: string): string;
6
+ export interface WikilinkComponents {
7
+ isEmbed: boolean;
8
+ filepath: string;
9
+ anchor: string;
10
+ alias?: string;
11
+ url: string;
12
+ }
13
+ export declare function parseWikilink(match: string): WikilinkComponents | null;
14
+ export declare function getEmbedType(filepath: string): 'image' | 'video' | 'audio' | 'pdf' | 'transclude';
15
+ export declare function generateEmbedHtml(components: WikilinkComponents): string;
16
+ export declare function checkWikilinkExists(filepath: string, allSlugs: string[]): boolean;
@@ -0,0 +1,60 @@
1
+ import { TocFragments, Header, Link, Paragraph } from '../../index';
2
+ export interface Fragment {
3
+ id: string;
4
+ text: string;
5
+ level: number;
6
+ children?: Fragment[];
7
+ }
8
+ export declare class TableOfContentsImpl implements TocFragments {
9
+ private fragments;
10
+ constructor(fragments?: Fragment[]);
11
+ toHTML(startLevel: number, stopLevel: number, ordered: boolean): string;
12
+ private filterByLevel;
13
+ private renderFragments;
14
+ private escapeHTML;
15
+ addFragment(fragment: Fragment): void;
16
+ getFragments(): Fragment[];
17
+ }
18
+ export declare class HeaderImpl implements Header {
19
+ private _name;
20
+ private _level;
21
+ private _links;
22
+ private _paragraphs;
23
+ private _listParagraphs;
24
+ constructor(_name: string, _level: number, _links?: Link[], _paragraphs?: Paragraph[], _listParagraphs?: Paragraph[]);
25
+ name(): string;
26
+ level(): number;
27
+ links(): Link[];
28
+ paragraphs(): Paragraph[];
29
+ listParagraphs(): Paragraph[];
30
+ addLink(link: Link): void;
31
+ addParagraph(paragraph: Paragraph): void;
32
+ addListParagraph(paragraph: Paragraph): void;
33
+ }
34
+ export declare class LinkImpl implements Link {
35
+ private _text;
36
+ private _url;
37
+ constructor(_text: string, _url: string);
38
+ text(): string;
39
+ url(): string;
40
+ }
41
+ export declare class ParagraphImpl implements Paragraph {
42
+ private _text;
43
+ constructor(_text: string);
44
+ text(): string;
45
+ }
46
+ export declare class TOCBuilder {
47
+ private fragments;
48
+ private stack;
49
+ addHeading(text: string, level: number, id: string): void;
50
+ build(): TableOfContentsImpl;
51
+ reset(): void;
52
+ }
53
+ export declare class AutoIDGenerator {
54
+ private usedIds;
55
+ generateID(text: string, type?: 'github' | 'github-ascii' | 'blackfriday'): string;
56
+ private githubStyle;
57
+ private githubAsciiStyle;
58
+ private blackfridayStyle;
59
+ reset(): void;
60
+ }
@@ -0,0 +1,32 @@
1
+ type SlugLike<T> = string & {
2
+ __brand: T;
3
+ };
4
+ export type FilePath = SlugLike<"filepath">;
5
+ export declare function isFilePath(s: string): s is FilePath;
6
+ export type FullSlug = SlugLike<"full">;
7
+ export declare function isFullSlug(s: string): s is FullSlug;
8
+ export type SimpleSlug = SlugLike<"simple">;
9
+ export declare function isSimpleSlug(s: string): s is SimpleSlug;
10
+ export type RelativeURL = SlugLike<"relative">;
11
+ export declare function isRelativeURL(s: string): s is RelativeURL;
12
+ export declare function isAbsoluteURL(s: string): boolean;
13
+ export declare function slugifyFilePath(fp: FilePath | string, excludeExt?: boolean): FullSlug;
14
+ export declare function simplifySlug(fp: FullSlug | string): SimpleSlug;
15
+ export declare function transformInternalLink(link: string): RelativeURL;
16
+ export declare function pathToRoot(slug: FullSlug | string): RelativeURL;
17
+ export declare function resolveRelative(current: FullSlug | string, target: FullSlug | SimpleSlug | string): RelativeURL;
18
+ export declare function splitAnchor(link: string): [string, string];
19
+ export declare function slugTag(tag: string): string;
20
+ export declare function joinSegments(...args: string[]): string;
21
+ export declare function getAllSegmentPrefixes(tags: string): string[];
22
+ export interface TransformOptions {
23
+ strategy: "absolute" | "relative" | "shortest";
24
+ allSlugs: string[];
25
+ }
26
+ export declare function transformLink(src: string, target: string, opts: TransformOptions): RelativeURL;
27
+ export declare function isFolderPath(fplike: string): boolean;
28
+ export declare function endsWith(s: string, suffix: string): boolean;
29
+ export declare function trimSuffix(s: string, suffix: string): string;
30
+ export declare function getFileExtension(s: string): string | undefined;
31
+ export declare function stripSlashes(s: string, onlyStripPrefix?: boolean): string;
32
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare function slug(text: string): string;
2
+ export { slug as slugAnchor };
@@ -1,2 +1,2 @@
1
1
  import { Markdown, MarkdownRenderer } from '../type';
2
- export declare function createMarkdown(renderer: MarkdownRenderer): Markdown;
2
+ export declare function createMarkdown(renderer: MarkdownRenderer | undefined, useInternalRenderer: Boolean): Markdown;
@@ -8,6 +8,7 @@ export declare class Path implements IPath {
8
8
  component(): string;
9
9
  path(): string;
10
10
  name(): string;
11
+ originalNameNoExt(): string;
11
12
  nameNoExt(): string;
12
13
  nameNoLang(): string;
13
14
  dir(): string;
@@ -13,6 +13,7 @@ export declare class Page implements ContentPage, PageMeta {
13
13
  private site;
14
14
  private resources;
15
15
  private _paginator;
16
+ private _processedContent;
16
17
  constructor(tmplSvc: Template, langSvc: LanguageService, publisher: Publisher, contentPage: ContentPage, site: Site);
17
18
  processResources(pageSources: PageSource[]): Promise<void>;
18
19
  render(): Promise<void>;
@@ -29,6 +30,7 @@ export declare class Page implements ContentPage, PageMeta {
29
30
  section(): string;
30
31
  paths(): import("../../paths").Path;
31
32
  path(): string;
33
+ slug(): string;
32
34
  file(): import("@internal/domain/content").File;
33
35
  name(): string;
34
36
  title(): string;
@@ -42,9 +44,12 @@ export declare class Page implements ContentPage, PageMeta {
42
44
  get IsSection(): boolean;
43
45
  get IsPage(): boolean;
44
46
  get Content(): Promise<any>;
47
+ WikilinkContent(): Promise<any>;
45
48
  Summary(): Promise<string>;
46
49
  ReadingTime(): Promise<number>;
47
50
  WordCount(): Promise<number>;
51
+ Backlinks(): Promise<Page[]>;
52
+ OutgoingLinks(): string[];
48
53
  get Description(): string;
49
54
  get Date(): Date;
50
55
  get LocalDate(): String;
@@ -52,6 +57,7 @@ export declare class Page implements ContentPage, PageMeta {
52
57
  get GitInfo(): {};
53
58
  get File(): {
54
59
  BaseFileName: string;
60
+ OriginalBaseName: string;
55
61
  Dir: string;
56
62
  };
57
63
  isHome(): boolean;
@@ -0,0 +1,17 @@
1
+ import { LinkStrategy } from '../vo/path';
2
+ export declare class PageGraph {
3
+ private allSlugs;
4
+ private outgoingLinks;
5
+ constructor(slugs: string[]);
6
+ registerOutgoingLinks(srcSlug: string, links: string[]): void;
7
+ getBacklinks(targetSlug: string): string[];
8
+ getAllSlugs(): string[];
9
+ hasSlug(slug: string): boolean;
10
+ resolveLink(srcSlug: string, targetLink: string, strategy: LinkStrategy): string;
11
+ getOutgoingLinks(srcSlug: string): string[];
12
+ getAllOutgoingLinks(): Map<string, string[]>;
13
+ getStats(): {
14
+ totalPages: number;
15
+ slugs: string[];
16
+ };
17
+ }
@@ -10,6 +10,7 @@ import { Author } from '../valueobject/author';
10
10
  import { Organization } from '../valueobject/organization';
11
11
  import { TaxonomyList } from "@internal/domain/site/entity/taxonomies-builder";
12
12
  import { Menus } from "@internal/domain/site/valueobject/menu";
13
+ import { PageGraph } from './pagegraph';
13
14
  export declare class Site {
14
15
  private configSvc;
15
16
  private contentSvc;
@@ -28,6 +29,7 @@ export declare class Site {
28
29
  navigation: Navigation | null;
29
30
  private title;
30
31
  private home;
32
+ private pageGraph;
31
33
  get Title(): string;
32
34
  get Description(): string;
33
35
  get Compiler(): Compiler;
@@ -93,4 +95,10 @@ export declare class Site {
93
95
  GetPage(...ref: string[]): Page | null;
94
96
  copyStaticFiles(): Promise<void>;
95
97
  siteWeightedPage(ordinalWeightPage: any): Promise<any>;
98
+ private buildPageGraph;
99
+ private collectResourceSlugs;
100
+ ProcessWikilinks(srcSlug: string, html: string): Promise<string>;
101
+ getPageGraph(): PageGraph | null;
102
+ GetBacklinks(targetSlug: string): string[];
103
+ GetContentIndex(): Promise<Map<string, any>>;
96
104
  }
@@ -0,0 +1,20 @@
1
+ import { PageGraph } from '../entity/pagegraph';
2
+ import { LinkStrategy } from '../vo/path';
3
+ export interface LinkProcessorOptions {
4
+ markdownLinkResolution: LinkStrategy;
5
+ prettyLinks: boolean;
6
+ openLinksInNewTab: boolean;
7
+ lazyLoad: boolean;
8
+ externalLinkIcon: boolean;
9
+ baseURL?: string;
10
+ }
11
+ export declare class HtmlLinkProcessor {
12
+ private graph;
13
+ private options;
14
+ constructor(graph: PageGraph, options?: Partial<LinkProcessorOptions>);
15
+ processLinks(srcSlug: string, html: string): Promise<{
16
+ html: string;
17
+ outgoingLinks: string[];
18
+ }>;
19
+ }
20
+ export declare function createHtmlLinkProcessor(graph: PageGraph, options?: Partial<LinkProcessorOptions>): HtmlLinkProcessor;