### Install Umbraco Rich Text Package Source: https://github.com/charlie-tango/umbraco-rich-text/blob/main/README.md Installs the `@charlietango/umbraco-rich-text` package using npm. This is the first step to integrate the rich text rendering functionality into your project. ```sh npm install @charlietango/umbraco-rich-text ``` -------------------------------- ### UmbracoRichText Component Usage Source: https://context7.com/charlie-tango/umbraco-rich-text/llms.txt Demonstrates how to use the UmbracoRichText component with custom node and block renderers, along with HTML attribute and style stripping configurations. ```APIDOC ## UmbracoRichText Component ### Description Main component for rendering rich text content from Umbraco Content Delivery API. It transforms JSON-formatted rich text into React components. ### Method React Component (Client-side rendering) ### Endpoint N/A (Client-side component) ### Parameters #### Props - **data** (object) - Required - The JSON-formatted rich text data from Umbraco. - **renderNode** (function) - Optional - A function to customize the rendering of specific HTML nodes (e.g., `p`, `a`, `img`). It receives a `RenderNodeContext` object. - **renderBlock** (function) - Optional - A function to customize the rendering of Umbraco block elements. It receives a `RenderBlockContext` object. - **htmlAttributes** (object) - Optional - An object where keys are HTML tag names and values are objects of HTML attributes to apply to those tags (e.g., `{ p: { className: "text-base" } }`). - **stripStyles** (object) - Optional - An object to control the stripping of inline styles. Use `except` to specify tags for which styles should not be stripped (e.g., `{ except: ["img"] }`). ### Request Example ```jsx import { UmbracoRichText, RenderBlockContext, RenderNodeContext } from "@charlietango/umbraco-rich-text"; import Image from "next/image"; import Link from "next/link"; // Custom node renderer function renderNode({ tag, children, attributes, route, meta }: RenderNodeContext) { switch (tag) { case "a": const href = route?.path || attributes.href; return {children}; case "img": return ( {attributes.alt ); case "p": const nodeInfo = meta(); const isFirstParagraph = !nodeInfo.previous; return (

{children}

); default: return undefined; // Use default rendering } } // Custom block renderer function renderBlock({ content, settings }: RenderBlockContext) { if (!content) return null; switch (content.contentType) { case "imageBlock": return (
{content.properties.altText {content.properties.caption && (
{content.properties.caption as string}
)}
); case "videoBlock": return (