@prismicio/richtext
Advanced tools
Comparing version 2.0.0-alpha.7 to 2.0.0-beta.0
@@ -8,3 +8,2 @@ import { RichTextNodeType, RTAnyNode, RTHeading1Node, RTHeading2Node, RTHeading3Node, RTHeading4Node, RTHeading5Node, RTHeading6Node, RTParagraphNode, RTPreformattedNode, RTStrongNode, RTEmNode, RTListItemNode, RTOListItemNode, RTListNode, RTOListNode, RTImageNode, RTEmbedNode, RTLinkNode, RTLabelNode, RTSpanNode, RTNode, RichTextField } from '@prismicio/types'; | ||
* @typeParam ReturnType - Return type of the function serializer | ||
* | ||
* @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/technologies/templating-rich-text-and-title-fields-javascript} | ||
@@ -28,10 +27,7 @@ */ | ||
* | ||
* @remarks | ||
* This type of serializer needs to be processed through | ||
* {@link wrapMapSerializer} before being used with {@link serialize} | ||
* @typeParam ReturnType - Return type of the map serializer | ||
* | ||
* @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/technologies/templating-rich-text-and-title-fields-javascript} | ||
* | ||
* @remarks | ||
* | ||
* This type of serializer needs to be processed through {@link wrapMapSerializer} | ||
* before being used with {@link serialize} | ||
*/ | ||
@@ -74,9 +70,8 @@ declare type RichTextMapSerializer<ReturnType> = { | ||
* | ||
* @remarks | ||
* This is a low level helper mainly intended to be used by higher level | ||
* packages. Most users aren't expected to this function directly. | ||
* @param nodes - A rich text or title field from Prismic | ||
* | ||
* @returns Tree from given rich text or title field | ||
* | ||
* @remarks | ||
* | ||
* This is a low level helper mainly intended to be used by higher level packages. Most users aren't expected to this function directly. | ||
*/ | ||
@@ -89,6 +84,5 @@ declare const asTree: (nodes: RTNode[]) => Tree; | ||
* @param richTextField - A rich text or title field from Prismic | ||
* @param [separator] - Separator used to join each element, defaults to a space | ||
* @param separator - Separator used to join each element, defaults to a space | ||
* | ||
* @returns Plain text equivalent of the provided rich text or title field | ||
* | ||
* @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/technologies/templating-rich-text-and-title-fields-javascript} | ||
@@ -101,2 +95,6 @@ */ | ||
* | ||
* @remarks | ||
* This is a low level helper mainly intended to be used by higher level | ||
* packages Most users aren't expected to this function directly | ||
* @typeParam SerializerReturnType - Return type of the serializer | ||
* @param richTextField - A rich text or title field from Prismic | ||
@@ -106,11 +104,3 @@ * @param serializer - A function serializer to apply | ||
* @returns An array of serialized nodes | ||
* | ||
* @typeParam SerializerReturnType - Return type of the serializer | ||
* | ||
* @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/technologies/templating-rich-text-and-title-fields-javascript} | ||
* | ||
* @remarks | ||
* | ||
* This is a low level helper mainly intended to be used by higher level packages | ||
* Most users aren't expected to this function directly | ||
*/ | ||
@@ -122,12 +112,9 @@ declare const serialize: <SerializerReturnType>(richTextField: RichTextField, serializer: RichTextFunctionSerializer<SerializerReturnType>) => SerializerReturnType[]; | ||
* | ||
* @remarks | ||
* This is a low level helper mainly intended to be used by higher level | ||
* packages Most users aren't expected to this function directly | ||
* @typeParam SerializerReturnType - Return type of the map serializer | ||
* @param mapSerializer - Map serializer to wrap | ||
* | ||
* @return A regular function serializer | ||
* | ||
* @typeParam SerializerReturnType - Return type of the map serializer | ||
* | ||
* @remarks | ||
* | ||
* This is a low level helper mainly intended to be used by higher level packages | ||
* Most users aren't expected to this function directly | ||
* @returns A regular function serializer | ||
*/ | ||
@@ -137,15 +124,12 @@ declare const wrapMapSerializer: <SerializerReturnType>(mapSerializer: RichTextMapSerializer<SerializerReturnType>) => RichTextFunctionSerializer<SerializerReturnType>; | ||
/** | ||
* Takes an array of serializers and returns a serializer applying | ||
* provided serializers sequentially until a result is returned | ||
* Takes an array of serializers and returns a serializer applying provided | ||
* serializers sequentially until a result is returned | ||
* | ||
* @remarks | ||
* This is a low level helper mainly intended to be used by higher level | ||
* packages Most users aren't expected to this function directly | ||
* @typeParam SerializerReturnType - Return type of serializers | ||
* @param serializers - Serializers to compose | ||
* | ||
* @returns Composed serializer | ||
* | ||
* @typeParam SerializerReturnType - Return type of serializers | ||
* | ||
* @remarks | ||
* | ||
* This is a low level helper mainly intended to be used by higher level packages | ||
* Most users aren't expected to this function directly | ||
*/ | ||
@@ -152,0 +136,0 @@ declare const composeSerializers: <SerializerReturnType>(serializers_0: RichTextFunctionSerializer<SerializerReturnType>, ...serializers_1: RichTextFunctionSerializer<SerializerReturnType>[]) => RichTextFunctionSerializer<SerializerReturnType>; |
{ | ||
"name": "@prismicio/richtext", | ||
"version": "2.0.0-alpha.7", | ||
"version": "2.0.0-beta.0", | ||
"description": "A parser and serializer for Prismic's Rich Text format", | ||
@@ -34,17 +34,17 @@ "keywords": [ | ||
"format": "prettier --write .", | ||
"lint": "eslint --ext .js,.ts .", | ||
"prepare": "npm run build", | ||
"release": "npm run build && npm run test && standard-version && git push --follow-tags && npm run build && npm publish", | ||
"release:beta": "npm run build && npm run test && standard-version --release-as major --prerelease beta && git push --follow-tags && npm run build && npm publish --tag beta", | ||
"release:beta:dry": "standard-version --release-as major --prerelease beta --dry-run", | ||
"release:dry": "standard-version --dry-run", | ||
"release:alpha": "npm run build && npm run test && standard-version --release-as major --prerelease alpha && git push --follow-tags && npm run build && npm publish --tag alpha", | ||
"release:alpha:dry": "standard-version --release-as major --prerelease alpha --dry-run", | ||
"lint": "eslint --ext .js,.ts .", | ||
"unit": "nyc --reporter=lcovonly --reporter=text --exclude-after-remap=false ava", | ||
"test": "npm run lint && npm run unit" | ||
"test": "npm run lint && npm run unit", | ||
"unit": "nyc --reporter=lcovonly --reporter=text --exclude-after-remap=false ava" | ||
}, | ||
"dependencies": { | ||
"@prismicio/types": "^0.1.12" | ||
"@prismicio/types": "^0.1.13" | ||
}, | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^4.31.1", | ||
"@typescript-eslint/parser": "^4.31.1", | ||
"@typescript-eslint/eslint-plugin": "^4.32.0", | ||
"@typescript-eslint/parser": "^4.32.0", | ||
"ava": "^3.15.0", | ||
@@ -54,4 +54,6 @@ "eslint": "^7.32.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint-plugin-tsdoc": "^0.2.14", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.4.0", | ||
"prettier": "^2.4.1", | ||
"prettier-plugin-jsdoc": "^0.3.24", | ||
"siroc": "^0.16.0", | ||
@@ -58,0 +60,0 @@ "standard-version": "^9.3.1", |
@@ -0,1 +1,11 @@ | ||
<!-- | ||
Replace all on all files (README.md, CONTRIBUTING.md, bug_report.md, package.json): | ||
- @prismicio/richtext | ||
- A parser and serializer for Prismic's Rich Text format | ||
- prismicio/prismic-richtext | ||
- prismic-richtext | ||
--> | ||
# @prismicio/richtext | ||
@@ -12,12 +22,14 @@ | ||
- 🌳 Builds a generic tree from Rich Text | ||
- 🧬 Serializes Rich Text into a different format (e.g. HTML or React components) | ||
- ✂️ Strips formatting from Rich Text to extract raw text | ||
<!-- | ||
You probably do not need to use this package directly. The following libraries provide a more accessible API: | ||
TODO: Create a small list of package features: | ||
- [`@prismicio/helpers`](https://github.com/prismicio/prismic-helpers): `asText`, `asHTML` | ||
- [`@prismicio/react`](https://github.com/prismicio/prismic-reactjs): `<PrismicText>`, `<PrismicRichText>` | ||
- [`@prismicio/vue`](https://github.com/prismicio/prismic-vue): `<prismic-rich-text>` | ||
- 🤔 A useful feature; | ||
- 🥴 Another useful feature; | ||
- 🙃 A final useful feature. | ||
Non-breaking space: are here on purpose to fix emoji rendering on certain systems. | ||
--> | ||
## Install | ||
@@ -43,4 +55,6 @@ | ||
**Submitting code changes**: For small fixes, feel free to [open a PR][repo-pull-requests] with a description of your changes. For large changes, please first [open an issue][repo-feature-request] so we can discuss if and how the changes should be implemented. | ||
**Submitting code changes**: For small fixes, feel free to [open a pull request][repo-pull-requests] with a description of your changes. For large changes, please first [open an issue][repo-feature-request] so we can discuss if and how the changes should be implemented. | ||
For more clarity on this project and its structure you can also check out the detailed [CONTRIBUTING.md][contributing] document. | ||
## License | ||
@@ -71,3 +85,4 @@ | ||
[prismic-docs]: https://prismic.io/docs | ||
[changelog]: /CHANGELOG.md | ||
[changelog]: ./CHANGELOG.md | ||
[contributing]: ./CONTRIBUTING.md | ||
@@ -74,0 +89,0 @@ <!-- TODO: Replace link with a more useful one if available --> |
@@ -7,6 +7,5 @@ import { RichTextField, RTTextNode } from "@prismicio/types"; | ||
* @param richTextField - A rich text or title field from Prismic | ||
* @param [separator] - Separator used to join each element, defaults to a space | ||
* @param separator - Separator used to join each element, defaults to a space | ||
* | ||
* @returns Plain text equivalent of the provided rich text or title field | ||
* | ||
* @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/technologies/templating-rich-text-and-title-fields-javascript} | ||
@@ -13,0 +12,0 @@ */ |
@@ -21,9 +21,8 @@ import { | ||
* | ||
* @remarks | ||
* This is a low level helper mainly intended to be used by higher level | ||
* packages. Most users aren't expected to this function directly. | ||
* @param nodes - A rich text or title field from Prismic | ||
* | ||
* @returns Tree from given rich text or title field | ||
* | ||
* @remarks | ||
* | ||
* This is a low level helper mainly intended to be used by higher level packages. Most users aren't expected to this function directly. | ||
*/ | ||
@@ -30,0 +29,0 @@ export const asTree = (nodes: RTNode[]): Tree => { |
import { RichTextFunctionSerializer } from "./types"; | ||
/** | ||
* Takes an array of serializers and returns a serializer applying | ||
* provided serializers sequentially until a result is returned | ||
* Takes an array of serializers and returns a serializer applying provided | ||
* serializers sequentially until a result is returned | ||
* | ||
* @remarks | ||
* This is a low level helper mainly intended to be used by higher level | ||
* packages Most users aren't expected to this function directly | ||
* @typeParam SerializerReturnType - Return type of serializers | ||
* @param serializers - Serializers to compose | ||
* | ||
* @returns Composed serializer | ||
* | ||
* @typeParam SerializerReturnType - Return type of serializers | ||
* | ||
* @remarks | ||
* | ||
* This is a low level helper mainly intended to be used by higher level packages | ||
* Most users aren't expected to this function directly | ||
*/ | ||
@@ -18,0 +15,0 @@ export const composeSerializers = <SerializerReturnType>( |
@@ -8,2 +8,6 @@ import { RichTextField } from "@prismicio/types"; | ||
* | ||
* @remarks | ||
* This is a low level helper mainly intended to be used by higher level | ||
* packages Most users aren't expected to this function directly | ||
* @typeParam SerializerReturnType - Return type of the serializer | ||
* @param richTextField - A rich text or title field from Prismic | ||
@@ -13,11 +17,3 @@ * @param serializer - A function serializer to apply | ||
* @returns An array of serialized nodes | ||
* | ||
* @typeParam SerializerReturnType - Return type of the serializer | ||
* | ||
* @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/technologies/templating-rich-text-and-title-fields-javascript} | ||
* | ||
* @remarks | ||
* | ||
* This is a low level helper mainly intended to be used by higher level packages | ||
* Most users aren't expected to this function directly | ||
*/ | ||
@@ -24,0 +20,0 @@ export const serialize = <SerializerReturnType>( |
@@ -31,3 +31,2 @@ import { | ||
* @typeParam ReturnType - Return type of the function serializer | ||
* | ||
* @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/technologies/templating-rich-text-and-title-fields-javascript} | ||
@@ -63,10 +62,7 @@ */ | ||
* | ||
* @remarks | ||
* This type of serializer needs to be processed through | ||
* {@link wrapMapSerializer} before being used with {@link serialize} | ||
* @typeParam ReturnType - Return type of the map serializer | ||
* | ||
* @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/technologies/templating-rich-text-and-title-fields-javascript} | ||
* | ||
* @remarks | ||
* | ||
* This type of serializer needs to be processed through {@link wrapMapSerializer} | ||
* before being used with {@link serialize} | ||
*/ | ||
@@ -73,0 +69,0 @@ export type RichTextMapSerializer<ReturnType> = { |
@@ -10,12 +10,9 @@ import { | ||
* | ||
* @remarks | ||
* This is a low level helper mainly intended to be used by higher level | ||
* packages Most users aren't expected to this function directly | ||
* @typeParam SerializerReturnType - Return type of the map serializer | ||
* @param mapSerializer - Map serializer to wrap | ||
* | ||
* @return A regular function serializer | ||
* | ||
* @typeParam SerializerReturnType - Return type of the map serializer | ||
* | ||
* @remarks | ||
* | ||
* This is a low level helper mainly intended to be used by higher level packages | ||
* Most users aren't expected to this function directly | ||
* @returns A regular function serializer | ||
*/ | ||
@@ -22,0 +19,0 @@ export const wrapMapSerializer = <SerializerReturnType>( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80854
15
107
14
906
Updated@prismicio/types@^0.1.13