datocms-html-to-structured-text
Version:
Convert HTML (or a `hast` syntax tree) to a valid DatoCMS Structured Text `dast` document
79 lines • 2.34 kB
TypeScript
import { Mark } from 'datocms-structured-text-utils';
import type { Handler, Context, Node, CreateNodeFunction } from './types.js';
import type { Nodes as HastNodes } from 'hast';
export declare const root: Handler;
export declare const paragraph: Handler;
export declare const thematicBreak: Handler;
export declare const heading: Handler;
export declare const code: Handler;
export declare const blockquote: Handler;
export declare const list: Handler;
export declare const listItem: Handler;
export declare const link: Handler;
export declare const span: Handler;
export declare const newLine: Handler;
export declare const inlineCode: Handler;
export declare const strong: Handler;
export declare const italic: Handler;
export declare const underline: Handler;
export declare const strikethrough: Handler;
export declare const highlight: Handler;
export declare const head: Handler;
export declare const base: Handler;
export declare const extractInlineStyles: Handler;
export declare function noop(): void;
export declare function withMark(type: Mark): Handler;
export declare const handlers: {
root: Handler;
p: Handler;
summary: Handler;
h1: Handler;
h2: Handler;
h3: Handler;
h4: Handler;
h5: Handler;
h6: Handler;
ul: Handler;
ol: Handler;
dir: Handler;
dt: Handler;
dd: Handler;
li: Handler;
listing: Handler;
plaintext: Handler;
pre: Handler;
xmp: Handler;
blockquote: Handler;
a: Handler;
code: Handler;
kbd: Handler;
samp: Handler;
tt: Handler;
var: Handler;
strong: Handler;
b: Handler;
em: Handler;
i: Handler;
u: Handler;
strike: Handler;
s: Handler;
mark: Handler;
base: Handler;
span: Handler;
text: Handler;
br: Handler;
hr: Handler;
head: Handler;
comment: typeof noop;
script: typeof noop;
style: typeof noop;
title: typeof noop;
video: typeof noop;
audio: typeof noop;
embed: typeof noop;
iframe: typeof noop;
};
export declare function wrapListItems(createNode: CreateNodeFunction, node: HastNodes, context: Context): Promise<Node[]>;
export declare function wrapText(context: Context, value: string): string;
export declare function resolveUrl(context: Context, url: unknown): string;
//# sourceMappingURL=handlers.d.ts.map