datocms-contentful-to-structured-text
Version:
Convert Contentful Rich Text to a valid DatoCMS Structured Text `dast` document
20 lines (19 loc) • 1.08 kB
TypeScript
import { ContentfulDocument, Context as StructuredTextContext } from './types';
import visitNode from './helpers/visit-node';
import visitChildren from './helpers/visit-children';
import { Handler } from './handlers';
import { Document, Mark, BlockquoteType, CodeType, HeadingType, LinkType, ListType } from 'datocms-structured-text-utils';
export { makeHandler } from './handlers';
export { liftAssets } from './helpers/lift-assets';
export { wrapLinksAndSpansInSingleParagraph, wrapInParagraph, } from './helpers/wrap';
export declare const contentfulToDatoMark: Record<string, Mark>;
export declare type Options = Partial<{
newlines: boolean;
handlers: Handler[];
allowedBlocks: Array<BlockquoteType | CodeType | HeadingType | LinkType | ListType>;
allowedMarks: Mark[];
}>;
export declare function richTextToStructuredText(tree: ContentfulDocument | null, options?: Options): Promise<Document | null>;
export { visitNode, visitChildren };
export * as ContentfulRichTextTypes from '@contentful/rich-text-types';
export type { Handler, StructuredTextContext };