You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

tiptap-parser

Package Overview
Dependencies
Maintainers
0
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiptap-parser

HTML parser to React component built on the top of html-react-parser with code syntax highlighting

0.2.5
latest
npmnpm
Version published
Weekly downloads
252
3.28%
Maintainers
0
Weekly downloads
 
Created
Source

tiptap-parser

HTML parser for Tiptap editor build on the of html-react-parser with code syntax highlighting.

NPM Version Language

Use case

The Tiptap editor is primarily used as a text editor for blogging, particularly in back-office applications. However, if the goal is simply to display content (for example, on a Next.js website), it may be excessive to install either the Tiptap or the mui-tiptap-editor along with the entire MUI library.

This library is specifically designed to display the contents of the mui-tiptap-editor, which saves HTML as text. If you're using a developer-oriented blogging platform like Medium, this library is ideal for you.

Demo

Try it yourself in this CodeSandbox live demo

Screenshot

Installation


npm install tiptap-parser

or


yarn add tiptap-parser

Get started

Simple usage

import TiptapParser from "tiptap-parser";

const html = `<h1>Hello world</h1>`;

function App() {
  return (
    <TiptapParser content={html} />
  );
}

Content with code

const html = `<><h1>Hello there</h1><pre><code>console.log("Log something here")</code></pre></>`;

<TiptapParser content={html} language="typescript" />

Customization

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

propstypeDefault valueDescription
contentstringemptyhtml string to be displayed
containerClassNamestringemptystyles of the container
classNamesClassNamePropsemptyclass names of each element withing the container
languagestringjavascriptlanguage of the code. see the list

Types

propstypeDefault valueDescription
codeClassNamestringemptyclass name of code element
h1ClassNamestringemptyclass name of h1 element
h2ClassNamestringemptyclass name of h2 element
h3ClassNamestringemptyclass name of h3 element
h4ClassNamestringemptyclass name of h4 element
h5ClassNamestringemptyclass name of h5 element
h6ClassNamestringemptyclass name of h6 element
pClassNamestringemptyclass name of p element
ulClassNamestringemptyclass name of ul element
spanClassNamestringemptyclass name of span element
divClassNamestringemptyclass name of div element
aClassNamestringemptyclass name of a element
tableClassNamestringemptyclass name of table element
imageClassNamestringemptyclass name of image element
other propsHTMLReactParserOptionsemptyall html-react-parser props

Contributing

Get started here.

Keywords

tiptap

FAQs

Package last updated on 12 Oct 2024

Did you know?

Socket

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.

Install

Related posts