Docs
Basic Elements
Basic Elements
Enhance your editor with essential formatting elements.
Block Quote ElementCode Block ElementCode Line ElementCode Syntax LeafHeading ElementParagraph Element
🌳 Blocks
Easily create headings of various levels, from H1 to H6, to structure your content and make it more organized.
Create blockquotes to emphasize important information or highlight quotes from external sources.
// Use code blocks to showcase code snippetsfunction greet() { console.info('Hello World!');}
🌱 Marks
Add style and emphasis to your text using the mark plugins, which offers a variety of formatting options.
Make text bold, italic, underlined, or apply a combination of these styles for a visually striking effect.
Add strikethrough to indicate deleted or outdated content.
Write code snippets with inline
code
formatting for easy readability.Plugins:
createBlockquotePlugin()
forblockquote
elementcreateCodeBlockPlugin()
forcode_block
elementcreateHeadingPlugin()
forh1
,h2
,... elementscreateParagraphPlugin()
forp
element
Installation
npm install @udecode/plate-basic-elements
# or
npm install @udecode/plate-block-quote @udecode/plate-code-block @udecode/plate-heading @udecode/plate-paragraph
Usage
import { createBasicElementsPlugin } from '@udecode/plate-basic-elements';
const plugins = [
// ...otherPlugins,
createBasicElementsPlugin(),
];
API
createBasicElementsPlugin
API Block Quote
createBlockquotePlugin
API Heading
createHeadingPlugin
Attributes
Collapse all
Specifies the heading levels supported, ranging from 1 to the specified levels.
API Paragraph
createParagraphPlugin
API Code Block
createCodeBlockPlugin
Attributes
Collapse all
Options.
Determines if syntax highlighting is enabled.
Determines if popular syntax should be displayed first.
Defines deserializers for the code block plugin.
Hotkeys to trigger a code block action.
isCodeBlockEmpty
isSelectionAtCodeBlockStart
indentCodeLine
insertCodeBlock
insertCodeLine
outdentCodeLine
toggleCodeBlock
unwrapCodeBlock
useCodeBlockCombobox
useCodeBlockComboboxState
useCodeBlockElement
useCodeBlockElementState
useCodeSyntaxLeaf
Keyboard Interactions
Key | Description |
---|---|
Cmd + Opt + 0 | Toggle paragraph block. |
Cmd + Opt + 1 | Toggle heading 1 block. |
Cmd + Opt + 2 | Toggle heading 2 block. |
Cmd + Opt + 3 | Toggle heading 3 block. |
Cmd + Shift + . | Toggle the blockquote formatting for selected text. |
Cmd + A | Select all text in the code block. |