How to use @contentful/rich-text-plain-text-renderer - 3 common examples

To help you get started, we’ve selected a few @contentful/rich-text-plain-text-renderer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ModiiMedia / contentful-hugo / index.js View on Github external
case 'Entry':
										frontMatter[field] = getEntryFields(
											fieldContent
										);
										break;
									default:
										frontMatter[field] = fieldContent;
										break;
								}
							}
							// rich text (see rich text function)
							else if ('nodeType' in fieldContent) {
								frontMatter[field] = [];
								frontMatter[
									`${field}_plaintext`
								] = richTextToPlain(fieldContent);
								const nodes = fieldContent.content;
								for (let i = 0; i < nodes.length; i++) {
									frontMatter[field].push(
										richTextNodes(nodes[i])
									);
								}
							}
							// arrays
							else {
								if (!fieldContent.length) {
									frontMatter[field] = fieldContent;
								} else {
									frontMatter[field] = [];
									for (
										let i = 0;
										i < fieldContent.length;
github ModiiMedia / contentful-hugo / src / getContentType.js View on Github external
case 'Entry':
										frontMatter[field] = getEntryFields(
											fieldContent
										);
										break;
									default:
										frontMatter[field] = fieldContent;
										break;
								}
							}
							// rich text (see rich text function)
							else if ('nodeType' in fieldContent) {
								frontMatter[field] = [];
								frontMatter[
									`${field}_plaintext`
								] = richTextToPlain(fieldContent);
								const nodes = fieldContent.content;
								for (let i = 0; i < nodes.length; i++) {
									frontMatter[field].push(
										richTextNodes(nodes[i])
									);
								}
							}
							// arrays
							else {
								if (!fieldContent.length) {
									frontMatter[field] = fieldContent;
								} else {
									frontMatter[field] = [];
									for (
										let i = 0;
										i < fieldContent.length;
github contentful / extensions / marketplace / sensitive-language / src / language-checker.js View on Github external
function checkContent(isRichText, value, config = {}) {
  const { messages } = isRichText
    ? alex.text(documentToPlainTextString(value), config)
    : alex.markdown(value, config);

  return messages;
}

@contentful/rich-text-plain-text-renderer

Plain text renderer for the Rich Text document.

MIT
Latest version published 2 months ago

Package Health Score

92 / 100
Full package analysis

Popular @contentful/rich-text-plain-text-renderer functions

Similar packages