mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-30 13:07:49 +08:00
1.5 KiB
1.5 KiB
description | icon |
---|---|
Developers love to add some inline code to their texts. | code-view |
Code
The Code extensions enables you to use the <code>
HTML tag in the editor. If you paste in text with <code>
tags it will rendered accordingly.
Type something with `back-ticks around`
and it will magically transform to inline code
while you type.
Installation
npm install @tiptap/extension-code
Settings
HTMLAttributes
Custom HTML attributes that should be added to the rendered HTML tag.
Code.configure({
HTMLAttributes: {
class: 'my-custom-class',
},
})
Commands
setCode()
Mark text as inline code.
editor.commands.setCode()
toggleCode()
Toggle inline code mark.
editor.commands.toggleCode()
unsetCode()
Remove inline code mark.
editor.commands.unsetCode()
Keyboard shortcuts
Command | Windows/Linux | macOS |
---|---|---|
toggleCode() | Control E |
Cmd E |