Alternative of triple quoted string in Javascript as Python has

This question already has an answer here:

  • Creating multiline strings in JavaScript 34 answers

  • When python stores the string like that, it's strictly a list of characters and the triple quotes tell it not to modify anything.

    For your html, if I understand right you probably have the slightly different problem that you want to automatically add all the html tags like <p>...</p> in and around your paragraphs? Perhaps a more suitable way to think about doing this would be using a simpler markup language like markdown that you can then convert to fully formed html. Actually, this is how (for instance) stackoverflow posts work - you use the simple markup syntax to write the paragraphs and then they are transformed to html with all the tags in place. This has the advantage that it does more than just the paragraph tags, you can also denote italic text, links, images etc.

    I'm not sure what the best way would be for your particular purpose, but here is a javascript markdown library that might be useful. Or if you just want to convert static text you could just use a service like this online converter.

    链接地址: http://www.djcxy.com/p/30440.html

    上一篇: 在JavaScript中多行连接字符串

    下一篇: Python中使用三重引号字符串的替代方法