
Security News
Official Go SDK for MCP in Development, Stable Release Expected in August
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
react-tiny-markup
Advanced tools
This component aims to parse a simple markup language nontechnical users may input - typically <i>
, <b>
and <img />
tags. It will never be a complete HTML5 parser (tag nesting validation, autoclosing tags - none of that). I wanted a smaller (~2.4kB vs ~60+kB) alternative to sanitize-html.
It doesn't use dangerouslySetInnerHTML
.
// replace or remove tags
const str = `
<ooo>inner</ooo>
<remove>invi<b>s</b>ible</remove>
<b>left in</b>
`;
<ReactTinyMarkup
renderer={p => {
switch (p.tag) {
case 'ooo':
return createElement('c', { key: p.key }, p.children);
case 'remove':
return null;
default:
return createElement(p.tag, { key: p.key }, p.children);
}
}}
>
{str}
</ReactTinyMarkup>
// <c>inner</c><b>left in</b>
// simply parse tags
const str = 'abc<strong>a</strong>b<i>c</i>d<b>e</b>';
<ReactTinyMarkup>{str}</ReactTinyMarkup>
// abc<strong>a</strong>b<i>c</i>d<b>e</b>
// rewrite tag (`strong` in this case) and simply parse the rest
<ReactTinyMarkup
renderer={p =>
p.tag === 'strong' ? (
<i key={p.key}>{p.children}</i>
) : (
defaultRenderer(p)
)
}
>
{str}
</ReactTinyMarkup>
// abc<i>a</i>b<i>c</i>d<b>e</b>
// Parse tags with attributes
const str = 'Look at this <em class="red">dog</em> <img src="dog.jpg" alt="my dog" />';
<ReactTinyMarkup
allowedAttributes={{ img: '', alt: '', class: 'className' }}
>
{str}
</ReactTinyMarkup>
// renders
// <>Look at this <em className="red">dog</em> <img src="dog.jpg" alt="my dog" /></>
FAQs
Parse strings with tags into react components
The npm package react-tiny-markup receives a total of 748 weekly downloads. As such, react-tiny-markup popularity was classified as not popular.
We found that react-tiny-markup demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.