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
1
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.0.3
npmnpm
Version published
Weekly downloads
161
4.55%
Maintainers
1
Weekly downloads
 
Created
Source

tiptap-parser

tiptap-parser: HTML parser for Tiptap html-react-parser with code syntax highlighting.

Table of Contents

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>
      {html}
    </TiptapParser>
  );
}

Content with code

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

function App() {
  return (
    <TiptapParser language="typescript">
      {html}
    </TiptapParser>
  );
}

Customization

const html = `<p><h1>Hello there</h1></p>`;

<TiptapParser
  classNames={{
    codeClassName: 'p-6',
    h1ClassName: 'text-xl',
    aClassName: 'underline',
    pClassName: 'text-gray-400'
  }}
/>
  {html}
</TiptapParser>

Props

propstypeDefault valueDescription
containerClassNamestringemptystyles of the container
classNamesClassNamePropsemptyclass names of each element withing the container
languagestringemptylanguage of the code. see the list

classNames Props

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

Contributing

Get started here.

Keywords

tiptap

FAQs

Package last updated on 30 May 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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.