Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@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 197 weekly downloads. As such, @contember/react-richtext-renderer popularity was classified as not 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.