Python 有三重引号字符串,可提供自由文本输入。不需要下一行字符来定义下一行。这是一个例子;
hello = """
This string is bounded by triple double quotes (3 times ").
Unescaped newlines in the string are retained, though \
it is still possible\nto use all normal escape sequences.
Whitespace at the beginning of a line is
significant. If you need to include three opening quotes
you have to escape at least one of them, e.g. \""".
This string ends in a newline.
"""
所以我有一个由段落组成的 HTML 文本。我可以在段落之间使用空格,但我认为如果 javascript 具有 Python 的三重引号字符串之类的功能,我可以使用它生成段落。
在 Javascript 中是否有像 Python 那样的替代自由文本用法,或者你能建议一个这样做的 Javascript 库吗?
谢谢你!