Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tiptap/extension-code-block

Package Overview
Dependencies
Maintainers
0
Versions
182
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tiptap/extension-code-block

code block extension for tiptap

  • 2.5.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1M
increased by3.1%
Maintainers
0
Weekly downloads
 
Created

What is @tiptap/extension-code-block?

@tiptap/extension-code-block is an extension for the Tiptap editor that allows you to add and manage code blocks within your rich text editor. It provides functionality for syntax highlighting, code formatting, and more, making it easier to work with code snippets in a text editor.

What are @tiptap/extension-code-block's main functionalities?

Basic Code Block

This feature allows you to add a basic code block to your Tiptap editor. The code sample shows how to import and use the CodeBlock extension in a Tiptap editor instance.

import { CodeBlock } from '@tiptap/extension-code-block';

const editor = new Editor({
  extensions: [
    CodeBlock,
  ],
});

Syntax Highlighting

This feature enables syntax highlighting for code blocks. The code sample demonstrates how to configure the CodeBlock extension with the 'lowlight' library to provide syntax highlighting.

import { CodeBlock } from '@tiptap/extension-code-block';
import { lowlight } from 'lowlight';

const editor = new Editor({
  extensions: [
    CodeBlock.configure({
      lowlight,
    }),
  ],
});

Custom Language Support

This feature allows you to add support for custom languages in your code blocks. The code sample shows how to register a custom language (JavaScript in this case) with the 'lowlight' library and configure the CodeBlock extension to use it.

import { CodeBlock } from '@tiptap/extension-code-block';
import { lowlight } from 'lowlight';
import javascript from 'highlight.js/lib/languages/javascript';

lowlight.registerLanguage('javascript', javascript);

const editor = new Editor({
  extensions: [
    CodeBlock.configure({
      lowlight,
    }),
  ],
});

Other packages similar to @tiptap/extension-code-block

Keywords

FAQs

Package last updated on 14 Jul 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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc