---
title: "newlineInCode command"
description: "Use the newlineInCode command in Tiptap to insert a new line in the current code block. Learn more in our docs!"
canonical_url: "https://tiptap.dev/docs/editor/api/commands/nodes-and-marks/newline-in-code"
---

# newlineInCode command

Use the newlineInCode command in Tiptap to insert a new line in the current code block. Learn more in our docs!

`newlineInCode` inserts a new line in the current code block. If a selection is set, the selection will be replaced with a newline character.

## Use the newlineInCode command

```js
editor.commands.newlineInCode()
```
