-
Notifications
You must be signed in to change notification settings - Fork 50.4k
Description
Bug Description
When using the expression editor ({{ }}) inside a Set node to build Markdown text with multiple line breaks and lists (e.g., using map().join('\n')), the result panel on the right (“Result”) does not display the formatted text properly.
The content is generated correctly internally, but the visual preview is misaligned, with inconsistent line breaks and indentation — as if the Markdown was partially converted to plain text.
In the attached image, you can see that the right-hand side output loses its original structure (lines overlap, indentation is off, and there are inconsistencies between text blocks and lists).
To Reproduce
-
Create a new workflow in n8n.
-
Add a Set node.
-
Create a field, for example named
contexto_empresa. -
Enable “Use Expression” and insert the following code:
You work for {{ $json.company_name }}, and your research should use the following company context: **Niche:** {{ $json.niche }} **Ideal Client Profile:** {{ $json.icp }} **Offer:** {{ $json.offer }} **Company Description:** {{ $json.description_business }} **Titles of articles published in the last 12 months:** {{ $json.articles_last_12_months.map(article => `- ${article.title}`).join('\n') }}
-
Provide a simple JSON input, like:
{ "company_name": "Digital OTT", "niche": "Real estate market. Agencies, developers, and construction companies", "icp": "- Real estate agents\n- Real estate company owners\n- Developers", "offer": "Digital marketing strategy to scale qualified leads and sell more properties", "description_business": "We are a digital marketing agency specialized in the real estate market.", "articles_last_12_months": [ {"title": "Local SEO for Real Estate Agencies and Developers"}, {"title": "Real Estate Lead Generation: 7 Proven Strategies"} ] } -
Execute the workflow.
-
Observe the “Result” panel on the right: the rendered text does not preserve line breaks and lists correctly.
Expected behavior
The Expression Editor result panel should render the output exactly as it will appear in the final node output — preserving line breaks, lists, and indentation in a faithful Markdown or plain text representation.
Expected:
-
Line breaks (
\n) should be respected and shown as new lines -
Lists using
-should be correctly displayed -
Proper separation between text sections
Debug Info
-
Environment: n8n self-hosted
-
Version: 1.117.3
-
Operating System: Ubuntu 22.04 LTS
-
Affected Node: Set → Expression Editor → Result Preview
-
Actual Result: Text rendered with incorrect spacing and line breaks
-
Expected Result: Properly formatted text with preserved line breaks and Markdown structure
Operating System
Ubuntu Linux 22.04 LTS
n8n Version
1.117.3
Node.js Version
v20.19.5
Database
PostgreSQL
Execution mode
main (default)
Hosting
self hosted