
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
tiptap-parser
Advanced tools
HTML parser to React component built on the top of html-react-parser with code syntax highlighting
tiptap-parser: HTML parser for Tiptap editor build on the of html-react-parser with code syntax highlighting.
Tiptap editor is a text editor used mainly for blogging, and therefore in the back office.
The problem is that if it's just to display the content (for example in a Next.js website), it is overkill to install Tiptap or mui-tiptap editor (and the whole MUI library).
The purpose of this library is precisely to display the contents of mui-tiptap-editor which is an html saved as text.
If you are using a dev oriented blog like Medium, this library is for you.
Try it yourself in this CodeSandbox live demo
npm install tiptap-parser
or
yarn add tiptap-parser
import TiptapParser from "tiptap-parser";
const html = `<h1>Hello world</h1>`;
function App() {
return (
<TiptapParser content={html} />
);
}
const html = `<><h1>Hello there</h1><pre><code>console.log("Log something here")</code></pre></>`;
<TiptapParser content={html} language="typescript" />
const html = `<p><h1>Hello there</h1></p>`;
<TiptapParser
containerClassName="bg-gray-100"
classNames={{
codeClassName: 'p-6',
h1ClassName: 'text-xl',
aClassName: 'underline',
pClassName: 'text-gray-400'
}}
content={html}
/>
props | type | Default value | Description |
---|---|---|---|
content | string | empty | html string to be displayed |
containerClassName | string | empty | styles of the container |
classNames | ClassNameProps | empty | class names of each element withing the container |
language | string | javascript | language of the code. see the list |
props | type | Default value | Description |
---|---|---|---|
codeClassName | string | empty | class name of code element |
h1ClassName | string | empty | class name of h1 element |
h2ClassName | string | empty | class name of h2 element |
h3ClassName | string | empty | class name of h3 element |
h4ClassName | string | empty | class name of h4 element |
h5ClassName | string | empty | class name of h5 element |
h6ClassName | string | empty | class name of h6 element |
pClassName | string | empty | class name of p element |
ulClassName | string | empty | class name of ul element |
spanClassName | string | empty | class name of span element |
divClassName | string | empty | class name of div element |
aClassName | string | empty | class name of a element |
tableClassName | string | empty | class name of table element |
imageClassName | string | empty | class name of image element |
other props | HTMLReactParserOptions | empty | all html-react-parser props |
Get started here.
FAQs
HTML parser to React component built on the top of html-react-parser with code syntax highlighting
The npm package tiptap-parser receives a total of 148 weekly downloads. As such, tiptap-parser popularity was classified as not popular.
We found that tiptap-parser demonstrated a healthy version release cadence and project activity because the last version was released less than 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.