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
4
Versions
182
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tiptap/extension-code-block - npm Package Compare versions

Comparing version 2.3.2 to 2.4.0

10

dist/index.js
import { Node, mergeAttributes, textblockTypeInputRule } from '@tiptap/core';
import { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state';
/**
* Matches a code block with backticks.
*/
const backtickInputRegex = /^```([a-z]+)?[\s\n]$/;
/**
* Matches a code block with tildes.
*/
const tildeInputRegex = /^~~~([a-z]+)?[\s\n]$/;
/**
* This extension allows you to create code blocks.
* @see https://tiptap.dev/api/nodes/code-block
*/
const CodeBlock = Node.create({

@@ -7,0 +17,0 @@ name: 'codeBlock',

@@ -7,4 +7,14 @@ (function (global, factory) {

/**
* Matches a code block with backticks.
*/
const backtickInputRegex = /^```([a-z]+)?[\s\n]$/;
/**
* Matches a code block with tildes.
*/
const tildeInputRegex = /^~~~([a-z]+)?[\s\n]$/;
/**
* This extension allows you to create code blocks.
* @see https://tiptap.dev/api/nodes/code-block
*/
const CodeBlock = core.Node.create({

@@ -11,0 +21,0 @@ name: 'codeBlock',

22

dist/packages/extension-code-block/src/code-block.d.ts

@@ -5,3 +5,3 @@ import { Node } from '@tiptap/core';

* Adds a prefix to language classes that are applied to code tags.
* Defaults to `'language-'`.
* @default 'language-'
*/

@@ -11,3 +11,3 @@ languageClassPrefix: string;

* Define whether the node should be exited on triple enter.
* Defaults to `true`.
* @default true
*/

@@ -17,3 +17,3 @@ exitOnTripleEnter: boolean;

* Define whether the node should be exited on arrow down if there is no node after it.
* Defaults to `true`.
* @default true
*/

@@ -23,2 +23,4 @@ exitOnArrowDown: boolean;

* Custom HTML attributes that should be added to the rendered HTML tag.
* @default {}
* @example { class: 'foo' }
*/

@@ -32,2 +34,4 @@ HTMLAttributes: Record<string, any>;

* Set a code block
* @param attributes Code block attributes
* @example editor.commands.setCodeBlock({ language: 'javascript' })
*/

@@ -39,2 +43,4 @@ setCodeBlock: (attributes?: {

* Toggle a code block
* @param attributes Code block attributes
* @example editor.commands.toggleCodeBlock({ language: 'javascript' })
*/

@@ -47,4 +53,14 @@ toggleCodeBlock: (attributes?: {

}
/**
* Matches a code block with backticks.
*/
export declare const backtickInputRegex: RegExp;
/**
* Matches a code block with tildes.
*/
export declare const tildeInputRegex: RegExp;
/**
* This extension allows you to create code blocks.
* @see https://tiptap.dev/api/nodes/code-block
*/
export declare const CodeBlock: Node<CodeBlockOptions, any>;

6

package.json
{
"name": "@tiptap/extension-code-block",
"description": "code block extension for tiptap",
"version": "2.3.2",
"version": "2.4.0",
"homepage": "https://tiptap.dev",

@@ -32,4 +32,4 @@ "keywords": [

"devDependencies": {
"@tiptap/core": "^2.3.2",
"@tiptap/pm": "^2.3.2"
"@tiptap/core": "^2.4.0",
"@tiptap/pm": "^2.4.0"
},

@@ -36,0 +36,0 @@ "peerDependencies": {

@@ -7,3 +7,3 @@ import { mergeAttributes, Node, textblockTypeInputRule } from '@tiptap/core'

* Adds a prefix to language classes that are applied to code tags.
* Defaults to `'language-'`.
* @default 'language-'
*/

@@ -13,3 +13,3 @@ languageClassPrefix: string

* Define whether the node should be exited on triple enter.
* Defaults to `true`.
* @default true
*/

@@ -19,3 +19,3 @@ exitOnTripleEnter: boolean

* Define whether the node should be exited on arrow down if there is no node after it.
* Defaults to `true`.
* @default true
*/

@@ -25,2 +25,4 @@ exitOnArrowDown: boolean

* Custom HTML attributes that should be added to the rendered HTML tag.
* @default {}
* @example { class: 'foo' }
*/

@@ -35,2 +37,4 @@ HTMLAttributes: Record<string, any>

* Set a code block
* @param attributes Code block attributes
* @example editor.commands.setCodeBlock({ language: 'javascript' })
*/

@@ -40,2 +44,4 @@ setCodeBlock: (attributes?: { language: string }) => ReturnType

* Toggle a code block
* @param attributes Code block attributes
* @example editor.commands.toggleCodeBlock({ language: 'javascript' })
*/

@@ -47,5 +53,16 @@ toggleCodeBlock: (attributes?: { language: string }) => ReturnType

/**
* Matches a code block with backticks.
*/
export const backtickInputRegex = /^```([a-z]+)?[\s\n]$/
/**
* Matches a code block with tildes.
*/
export const tildeInputRegex = /^~~~([a-z]+)?[\s\n]$/
/**
* This extension allows you to create code blocks.
* @see https://tiptap.dev/api/nodes/code-block
*/
export const CodeBlock = Node.create<CodeBlockOptions>({

@@ -52,0 +69,0 @@ name: 'codeBlock',

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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