> For the complete documentation index, see [llms.txt](https://learn.mechanic.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.mechanic.dev/platform/liquid/keyword-literals/newline.md).

# newline

The `newline` keyword literal represents the [newline control character](https://en.wikipedia.org/wiki/Newline): `\n`. It's useful for navigating or assembling strings.

## Filter support

Besides its natural uses in building strings, `newline` has a special purpose within these string filters:

* [newline\_to\_br](/platform/liquid/filters.md#newline_to_br) – When used with `newline`, this filter will replace instances of `"\r\n"`, and then instances of `"\n"`.
* [replace](/platform/liquid/filters.md#replace-replace_first) – When used with `newline` as its first argument, this filter will replace instances of `"\r\n"`, and then instances of `"\n"`.
* [split](/platform/liquid/filters.md#split) – When used with `newline`, this filter will split by `"\r\n"` when present, and then by `"\n"`.

Under the hood, each of these scenarios uses the regular expression `/\r?\n/`.

## Example

```liquid
{% assign message = "Hello!" | append: newline | append: newline %}
{% assign message = message | append: "This is a new paragraph!" %}

{% capture lines %}
foo
bar
baz
{% endcapture %}

{% assign words = lines | split: newline %}
{% assign tags = lines | replace: newline, ", " %}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://learn.mechanic.dev/platform/liquid/keyword-literals/newline.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
