Skip to content

Commit

Permalink
feat: add HTMLRichTextSerializer export
Browse files Browse the repository at this point in the history
  • Loading branch information
lihbr committed Jan 24, 2023
1 parent af81b62 commit 014f15e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/helpers/asHTML.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ type ExtractTextTypeGeneric<T> = T extends RichTextMapSerializerFunction<
? U
: never;

/**
* Serializes a node from a Rich Text or Title field with a map or a function to HTML
*
* @see {@link HTMLRichTextMapSerializer} and {@link HTMLRichTextFunctionSerializer}
* @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
*/
export type HTMLRichTextSerializer =
| HTMLRichTextMapSerializer
| HTMLRichTextFunctionSerializer;

/**
* Creates a default HTML Rich Text Serializer with a given Link Resolver providing
* sensible and safe defaults for every node type
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export type {
HTMLMapSerializer,
HTMLFunctionSerializer,
};
export type { HTMLRichTextSerializer } from "./helpers/asHTML";

//=============================================================================
// Errors - Custom errors for Prismic APIs.
Expand Down

0 comments on commit 014f15e

Please sign in to comment.