prosekit/extensions/code-block
CodeBlockAttrs
The attributes for the codeBlock
node.
Properties
language
language:
string
CodeBlockHighlightOptions
CodeBlockHighlightOptions:
object
Type declaration
Name | Type |
---|---|
parser | HighlightParser |
HighlightParser
HighlightParser:
Parser
An alias for the Parser
type from the prosemirror-highlight
package.
defineCodeBlock()
defineCodeBlock():
CodeBlockExtension
Adds codeBlock
nodes to the editor. This includes the following extensions:
- defineCodeBlockSpec
- defineCodeBlockInputRule
- defineCodeBlockEnterRule
- defineCodeBlockKeymap
- defineCodeBlockCommands.
Returns
CodeBlockExtension
defineCodeBlockCommands()
defineCodeBlockCommands():
CodeBlockCommandsExtension
Adds commands for working with codeBlock
nodes.
Returns
CodeBlockCommandsExtension
defineCodeBlockEnterRule()
defineCodeBlockEnterRule():
PlainExtension
Adds enter rules for codeBlock
nodes.
Returns
PlainExtension
defineCodeBlockHighlight()
defineCodeBlockHighlight(
options
):Extension
Adds syntax highlighting to code blocks. This function requires a Parser
instance from the prosemirror-highlight
package. See the documentation for more information.
Parameters
• options: CodeBlockHighlightOptions
Returns
defineCodeBlockInputRule()
defineCodeBlockInputRule():
PlainExtension
Adds input rules for codeBlock
nodes.
Returns
PlainExtension
defineCodeBlockKeymap()
defineCodeBlockKeymap():
PlainExtension
Defines the keymap for code blocks.
Returns
PlainExtension
defineCodeBlockShiki()
defineCodeBlockShiki(
options
):Extension
Adds syntax highlighting to code blocks using the Shiki package.
Parameters
• options: CodeBlockShikiOptions
= {}
The options to configure the Shiki highlighter.
Returns
defineCodeBlockSpec()
defineCodeBlockSpec():
CodeBlockSpecExtension
Defines the codeBlock
node spec.
Returns
CodeBlockSpecExtension