@tiptap/extension-code-block
Advanced tools
+26
-0
@@ -97,2 +97,28 @@ "use strict"; | ||
| }, | ||
| markdownTokenName: "code", | ||
| parseMarkdown: (token, helpers) => { | ||
| var _a; | ||
| if (((_a = token.raw) == null ? void 0 : _a.startsWith("```")) === false && token.codeBlockStyle !== "indented") { | ||
| return []; | ||
| } | ||
| return helpers.createNode( | ||
| "codeBlock", | ||
| { language: token.lang || null }, | ||
| token.text ? [helpers.createTextNode(token.text)] : [] | ||
| ); | ||
| }, | ||
| renderMarkdown: (node, h) => { | ||
| var _a; | ||
| let output = ""; | ||
| const language = ((_a = node.attrs) == null ? void 0 : _a.language) || ""; | ||
| if (!node.content) { | ||
| output = `\`\`\`${language} | ||
| \`\`\``; | ||
| } else { | ||
| const lines = [`\`\`\`${language}`, h.renderChildren(node.content), "```"]; | ||
| output = lines.join("\n"); | ||
| } | ||
| return output; | ||
| }, | ||
| addCommands() { | ||
@@ -99,0 +125,0 @@ return { |
+26
-0
@@ -68,2 +68,28 @@ // src/code-block.ts | ||
| }, | ||
| markdownTokenName: "code", | ||
| parseMarkdown: (token, helpers) => { | ||
| var _a; | ||
| if (((_a = token.raw) == null ? void 0 : _a.startsWith("```")) === false && token.codeBlockStyle !== "indented") { | ||
| return []; | ||
| } | ||
| return helpers.createNode( | ||
| "codeBlock", | ||
| { language: token.lang || null }, | ||
| token.text ? [helpers.createTextNode(token.text)] : [] | ||
| ); | ||
| }, | ||
| renderMarkdown: (node, h) => { | ||
| var _a; | ||
| let output = ""; | ||
| const language = ((_a = node.attrs) == null ? void 0 : _a.language) || ""; | ||
| if (!node.content) { | ||
| output = `\`\`\`${language} | ||
| \`\`\``; | ||
| } else { | ||
| const lines = [`\`\`\`${language}`, h.renderChildren(node.content), "```"]; | ||
| output = lines.join("\n"); | ||
| } | ||
| return output; | ||
| }, | ||
| addCommands() { | ||
@@ -70,0 +96,0 @@ return { |
+5
-5
| { | ||
| "name": "@tiptap/extension-code-block", | ||
| "description": "code block extension for tiptap", | ||
| "version": "3.6.7", | ||
| "version": "3.7.0", | ||
| "homepage": "https://tiptap.dev", | ||
@@ -34,8 +34,8 @@ "keywords": [ | ||
| "devDependencies": { | ||
| "@tiptap/core": "^3.6.7", | ||
| "@tiptap/pm": "^3.6.7" | ||
| "@tiptap/core": "^3.7.0", | ||
| "@tiptap/pm": "^3.7.0" | ||
| }, | ||
| "peerDependencies": { | ||
| "@tiptap/core": "^3.6.7", | ||
| "@tiptap/pm": "^3.6.7" | ||
| "@tiptap/core": "^3.7.0", | ||
| "@tiptap/pm": "^3.7.0" | ||
| }, | ||
@@ -42,0 +42,0 @@ "repository": { |
+28
-0
@@ -155,2 +155,30 @@ import { mergeAttributes, Node, textblockTypeInputRule } from '@tiptap/core' | ||
| markdownTokenName: 'code', | ||
| parseMarkdown: (token, helpers) => { | ||
| if (token.raw?.startsWith('```') === false && token.codeBlockStyle !== 'indented') { | ||
| return [] | ||
| } | ||
| return helpers.createNode( | ||
| 'codeBlock', | ||
| { language: token.lang || null }, | ||
| token.text ? [helpers.createTextNode(token.text)] : [], | ||
| ) | ||
| }, | ||
| renderMarkdown: (node, h) => { | ||
| let output = '' | ||
| const language = node.attrs?.language || '' | ||
| if (!node.content) { | ||
| output = `\`\`\`${language}\n\n\`\`\`` | ||
| } else { | ||
| const lines = [`\`\`\`${language}`, h.renderChildren(node.content), '```'] | ||
| output = lines.join('\n') | ||
| } | ||
| return output | ||
| }, | ||
| addCommands() { | ||
@@ -157,0 +185,0 @@ return { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
84714
5.94%1135
6.77%4
Infinity%