How to add html code with formatting #1307

Closed
adviner opened this Issue Mar 15, 2013 · 4 comments

Projects

None yet

3 participants

@adviner
adviner commented Mar 15, 2013

Ive searched but cant seem to find the answer:
I have the following html:

var html = "< div >< a >1</ a >< a >2</ a > < a >3</ a >< a >4</ a >< a >5</ a >< div >"

when I use editor.setValue(html) it shows as one line. Now if I add \r\n at the end of each line then it properly line formats it but doesnt have tab indent. Is adding \r\n even the correct way.

@nightwing
Member

I can't understand your question, probably github have changed formatting of your comment, please use

```js
  - code here -
```

to preserve formatting of your code.

var html = "< div >< a >1</ a >< a >2</ a > < a >3</ a >< a >4</ a >< a >5</ a >< div >"

is just one line.

Here is a string with multiple lines and tabs

var html = "many\nlines\n\t\t\t\tand even tabs"
@varemenos
var html = "<div>\r\n\t<a>1</a>\r\n\t<a>2</a>\r\n\t<a>3</a>\r\n\t<a>4</a>\r\n\t<a>5</a>\r\n<div>";
@adviner
adviner commented Mar 22, 2013

Thanks. I thought that ace automatically formatted the code when added.

@varemenos

@adviner if the answers fulfill your question, i'd suggest you to close the issue.

@adviner adviner closed this Mar 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment