tiptap/docs/src/docPages/api/extensions/code.md

33 lines
1.0 KiB
Markdown
Raw Normal View History

2020-08-19 03:39:41 +08:00
# Code
2020-09-02 21:26:46 +08:00
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.
2020-08-19 03:39:41 +08:00
2020-09-23 15:31:05 +08:00
Type something with <code>\`back-ticks around\`</code> and it will magically transform to `inline code` while you type.
## Installation
```bash
# With npm
npm install @tiptap/extension-code
# Or: With Yarn
yarn add @tiptap/extension-code
```
2020-09-23 18:03:03 +08:00
## Settings
2020-09-10 16:21:24 +08:00
| Option | Type | Default | Description |
| ------ | ------ | ------- | -------------------------------------------- |
| class | string | | Add a custom class to the rendered HTML tag. |
2020-08-19 03:39:41 +08:00
2020-08-20 21:33:16 +08:00
## Commands
2020-09-10 16:21:24 +08:00
| Command | Options | Description |
| ------- | ------- | ------------------------- |
| code | — | Mark text as inline code. |
2020-08-19 03:39:41 +08:00
## Keyboard shortcuts
* `Alt&nbsp;`&nbsp;<code>`</code>
2020-08-19 03:39:41 +08:00
2020-09-21 22:59:28 +08:00
## Source code
2020-09-02 21:26:46 +08:00
[packages/extension-code/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-code/)
2020-08-19 03:39:41 +08:00
2020-09-02 21:26:46 +08:00
## Usage
2020-09-24 23:27:26 +08:00
<demo name="Extensions/Code" highlight="3-5,17,36" />