> 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
