Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@contember/react-richtext-renderer
Advanced tools
This package provides a React renderer for Contember Rich Text format.
yarn add @contember/react-richtext-renderer
import { RichTextBlocksRenderer } from '@contember/react-richtext-renderer'
const App = () => {
const blocks = [] // blocks from Contember API
return (
<RichTextBlocksRenderer
blocks={blocks}
sourceField={'content'}
referencesField={'references'}
referenceDiscriminationField={'type'}
/>
)
}
import { RichTextFieldRenderer } from '@contember/react-richtext-renderer'
const App = () => {
const value = {} // value from Contember API
return (
<RichTextFieldRenderer
source={value}
/>
)
}
import { RichTextBlocksRenderer } from '@contember/react-richtext-renderer'
const App = () => {
// ...
return (
<RichTextBlocksRenderer
// ...
renderElement={it => {
if (it.element.type === 'blockquote') {
return <blockquote>{it.children}</blockquote>
}
return it.fallback
}}
/>
)
}
import { RichTextBlocksRenderer } from '@contember/react-richtext-renderer'
const App = () => {
// ...
return (
<RichTextBlocksRenderer
// ...
renderLeaf={it => {
if (it.leaf.isSup) {
return <sup>{it.fallback}</sup>
}
return it.fallback
}}
/>
)
}
Make sure to use it.fallback
instead of it.children
in renderLeaf
callback, to render already applied leafs as well.
import { RichTextBlocksRenderer } from '@contember/react-richtext-renderer'
const App = () => {
// ...
return (
<RichTextBlocksRenderer
// ...
referenceRenderers={{
image: ({ reference }) => <img src={reference.url} />,
}}
/>
)
}
FAQs
Unknown package
The npm package @contember/react-richtext-renderer receives a total of 1,012 weekly downloads. As such, @contember/react-richtext-renderer popularity was classified as popular.
We found that @contember/react-richtext-renderer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.