@ng-doc/utils 17.6.15 → 18.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,7 @@
1
1
  export * from './attr-value';
2
2
  export * from './has-class';
3
3
  export * from './has-link-ancestor';
4
+ export * from './is-code-block';
4
5
  export * from './is-code-node';
5
6
  export * from './is-element';
6
- export * from './is-text';
7
- export * from './line-break';
8
- export * from './text-element';
7
+ export * from './is-heading';
@@ -0,0 +1,7 @@
1
+ import { Element, Root } from 'hast';
2
+ /**
3
+ *
4
+ * @param parent
5
+ * @param node
6
+ */
7
+ export declare function isCodeBlock(parent: Root | Element | null, node: Element): node is Element;
@@ -1,6 +1,6 @@
1
- import { Element, ElementContent } from 'hast';
1
+ import { Content, Element } from 'hast';
2
2
  /**
3
3
  *
4
4
  * @param node
5
5
  */
6
- export declare function isElement(node?: ElementContent): node is Element;
6
+ export declare function isElement(node?: Content): node is Element;
@@ -0,0 +1,6 @@
1
+ import { Element } from 'hast';
2
+ /**
3
+ *
4
+ * @param node
5
+ */
6
+ export declare function isHeading(node: Element): boolean;
@@ -0,0 +1,6 @@
1
+ /**
2
+ *
3
+ * @param options
4
+ * @param route
5
+ */
6
+ export default function addHeadingAnchors(route?: string): any;
@@ -1,10 +1,14 @@
1
- import { NgDocKeyword } from '@ng-doc/core/interfaces';
1
+ import { NgDocKeyword } from '@ng-doc/core';
2
2
  import { Element } from 'hast';
3
- import { NgDocHtmlPostProcessorConfig } from '../html-post-processor';
4
3
  export type AddKeyword = (keyword: string) => void;
5
4
  export type GetKeyword = (keyword: string) => NgDocKeyword | undefined;
5
+ interface Config {
6
+ addUsedKeyword?: AddKeyword;
7
+ getKeyword?: GetKeyword;
8
+ }
6
9
  /**
7
10
  *
8
11
  * @param config
9
12
  */
10
- export default function keywordsPlugin(config: NgDocHtmlPostProcessorConfig): (tree: Element) => void;
13
+ export default function keywordsPlugin(config: Config): (tree: Element) => undefined;
14
+ export {};
@@ -1,5 +1,5 @@
1
1
  /**
2
- *
2
+ * Marks all elements with the NG_DOC_ELEMENT class name
3
3
  * @param tree
4
4
  * @param headings
5
5
  */
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Plugin to transform mermaid code blocks into mermaid elements that are going to be rendered by the mermaid processor.
3
+ * @param tree
4
+ * @param headings
5
+ */
6
+ export default function mermaidPlugin(): any;
@@ -1,4 +1,4 @@
1
- import { NgDocEntityAnchor, NgDocHeading } from '@ng-doc/core';
1
+ import { NgDocHeading, NgDocPageAnchor } from '@ng-doc/core';
2
2
  import { Root } from 'hast';
3
3
  /**
4
4
  *
@@ -6,4 +6,4 @@ import { Root } from 'hast';
6
6
  * @param addAnchor
7
7
  * @param headings
8
8
  */
9
- export default function sluggerPlugin(addAnchor: (anchor: NgDocEntityAnchor) => void, headings?: NgDocHeading[]): (tree: Root) => void;
9
+ export default function sluggerPlugin(addAnchor?: (anchor: NgDocPageAnchor) => void, headings?: NgDocHeading[]): (tree: Root) => void;
@@ -0,0 +1,4 @@
1
+ /**
2
+ *
3
+ */
4
+ export default function (): any;
@@ -0,0 +1,13 @@
1
+ export interface PostProcessHtmlOutput {
2
+ content: string;
3
+ usedKeywords: string[];
4
+ error?: unknown;
5
+ }
6
+ /**
7
+ *
8
+ * @param html
9
+ * @param config
10
+ * @param config.addUsedKeyword
11
+ * @param addUsedKeyword
12
+ */
13
+ export declare function postProcessHtml(html: string): Promise<PostProcessHtmlOutput>;
@@ -0,0 +1,18 @@
1
+ import { NgDocHeading, NgDocPageAnchor } from '@ng-doc/core';
2
+ export interface NgDocHtmlProcessorConfig {
3
+ lightTheme?: string;
4
+ darkTheme?: string;
5
+ headings?: NgDocHeading[];
6
+ route?: string;
7
+ }
8
+ export interface NgDocHtmlProcessorOutput {
9
+ content: string;
10
+ anchors: NgDocPageAnchor[];
11
+ error?: unknown;
12
+ }
13
+ /**
14
+ *
15
+ * @param html
16
+ * @param config
17
+ */
18
+ export declare function processHtml(html: string, config: NgDocHtmlProcessorConfig): Promise<NgDocHtmlProcessorOutput>;
@@ -0,0 +1,12 @@
1
+ import { GetKeyword } from './plugins/keywords.plugin';
2
+ export interface ReplaceKeywordsConfig {
3
+ getKeyword: GetKeyword;
4
+ }
5
+ /**
6
+ *
7
+ * @param html
8
+ * @param config
9
+ * @param config.getKeyword
10
+ * @param getKeyword
11
+ */
12
+ export declare function replaceKeywords(html: string, { getKeyword }: ReplaceKeywordsConfig): Promise<string>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ *
3
+ * @param content
4
+ */
5
+ export declare function stringifyEntities(content: string): string;
package/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
- export * from './html/html-post-processor';
2
- export * from './html/html-processor';
1
+ export * from './html/post-process-html';
2
+ export * from './html/process-html';
3
3
  export * from './html/remove-not-indexable-content';
4
+ export * from './html/replace-keywords';
5
+ export * from './html/stringify-entities';