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.1
npmnpm
Version published
Weekly downloads
134
-7.59%
Maintainers
1
Weekly downloads
 
Created
Source

tiptap-parser

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

Table of Contents

Demo

Try it yourself in this CodeSandbox live demo

Screenshot

Installation


npm  install  html-code-editor

or


yarn  add  html-code-editor


## Get started

#### Simple usage

```tsx
import parseHtml from 'html-code-editor';

const html = `<p><h1>Hello there</h1><code>console.log("Using it as a component")</code></p>`;

function App() {
  return (
    <div>
      {parseHtml(html)}
    </div>
  );
}

Using as a component

import { HtmlCodeParser } from '../Parse'

const html = `<p><h1>Hello there</h1><code>console.log("Using it as a component")</code></p>`;

const App = () => {
  return (
    <HtmlCodeParser language="typescript" codeContainerClassName="custom-class">
      {html}
    </HtmlCodeParser>
  )
}

Language

By default it's use Javascript

  parseHtml(html, { language: 'php' })
  <HtmlCodeParser language="php">
    {html}
  </HtmlCodeParser>

Customization

  parseHtml(html, { codeContainerClassName: 'bg-gray-300' })
  <HtmlCodeParser codeContainerClassName="bg-gray-300">
    {html}
  </HtmlCodeParser>

Props

propstypeDefault valueDescription
childrenstring[]emptyhtml string
codeContainerClassNamestringemptystyles of the code container
languagestringemptylanguage of the code ((see the list)[https://github.com/wooorm/lowlight?tab=readme-ov-file#data])

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.