question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option for HTML templates to automatically replace line-breaks with <br>

See original GitHub issue

It would be nice to have an option that would make it unnecessary to define line breaks with <br>, <p> or <div>. If line breaks would be automatically converted to <br> tags when inserting, then an HTML template would be much clearer, because you would only use tags for the required formatting.

This option could be a checkbox together with the other options at the bottom of the template dialog: [ ] Replace line breaks automatically with <br>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
SamuelPlentzcommented, Feb 18, 2020

For the original request one could use a script HTMLBreaks like this:

let text = mVariables[0];
text = text.replace(/\n/g, "<br>");
return text;

Use it inline like this:

[[SCRIPT=HTMLBreaks|Hi,

This is <b>very</b> important.

Bye]]

or by converting another template named Templatename in a folder named Foldername:

[[SCRIPT=HTMLBreaks|[[TEXT=Foldername|Templatename]]]]
0reactions
jobisoftcommented, Jun 3, 2021

I still oppose tempering with html. Either you have an HTML template or not. Once the template is inserted, you do not see the br tags, so this is only affecting the composition of the template itself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Option for HTML templates to automatically replace line ...
It would be nice to have an option that would make it unnecessary to define line breaks with <br> , <p> or <div>...
Read more >
How do I replace all line breaks in a string with <br / ...
This will turn all returns into HTML ... Then replace it with 2 br. Second line: Search for all single \r\n or \n...
Read more >
The Dos and Don'ts of Adding an HTML Line Break
To do a line break in HTML, use the <br> tag. Simply place the tag wherever you want to force a line break....
Read more >
HTML Line Break – How to Break a Line with the HTML <br ...
In this tutorial, I'm going to show you how to insert line breaks in your HTML code with some "with and without" examples,...
Read more >
HTML br tag
The <br> tag inserts a single line break. The <br> tag is useful for writing addresses or poems. The <br> tag is an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found