---
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!"
---

> This page is for Tiptap 2.x. [See the latest version of this page.](https://tiptap.dev/docs/editor/api/commands/nodes-and-marks/newline-in-code.md)

# 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()
```
