tiptap/docs/api/nodes/paragraph.md
2022-11-07 21:41:00 +01:00

53 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
description: Mom, look! I wrote a paragraph on the Internet.
icon: paragraph
---
# Paragraph
[![Version](https://img.shields.io/npm/v/@tiptap/extension-paragraph.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-paragraph)
[![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-paragraph.svg)](https://npmcharts.com/compare/@tiptap/extension-paragraph?minimal=true)
Yes, the schema is very strict. Without this extension you wont even be able to use paragraphs in the editor.
:::warning Breaking Change from 1.x → 2.x
Tiptap 1 tried to hide that node from you, but it has always been there. You have to explicitly import it from now on (or use `StarterKit`).
:::
## Installation
```bash
npm install @tiptap/extension-paragraph
```
## Settings
### HTMLAttributes
Custom HTML attributes that should be added to the rendered HTML tag.
```js
Paragraph.configure({
HTMLAttributes: {
class: 'my-custom-class',
},
})
```
## Commands
### setParagraph()
Transforms all selected nodes to paragraphs.
```js
editor.commands.setParagraph()
```
## Keyboard shortcuts
| Command | Windows/Linux | macOS |
| -------------- | ----------------------------- | ------------------------- |
| setParagraph() | `Control` `Alt` `0` | `Cmd` `Alt` `0` |
## Source code
[packages/extension-paragraph/](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-paragraph/)
## Usage
https://embed.tiptap.dev/preview/Nodes/Paragraph