先进的HTML多行格式-在新行中不需要空格

问题描述:

问题很简单,但是我还没有找到解决方案-可能因为它很琐碎而不可能或很难找到.

Question is very simple but I am not found solution yet - probably it is not possible or very hard to find since it is very trivial.

问题是如何避免在换行后的格式HTML中添加空格-特别是在值列表中.

Question is how to avoid adding spaces in formatted HTML after new line - especially in list of values.

第一个示例,请参见示例:

First example see example:

1, 2

它会生成所需的HTML,如下所示:

It produces required HTML like this:

1, 2

现在另一个不起作用的示例:

Now another example which not works:

1
, 
2

它会生成无效的HTML,如下所示:

It produces invalid HTML like this:

1 , 2 required is 1, 2

如何获得与第一个示例相同的结果,但使用多行文本布局-我知道我们可以在一行中做到这一点,但希望在多行中完成以简化程序代码(而不是HTML).

How to achieve same result as in first example but using multiline text layout - I know that we could do it in one line but want to do in many lines to simplify program code (not HTML).

它按定义工作:在常规内容中,换行符等效于空格.无法在HTML中更改此原理.只需将您的内容分成几行,以使该原则对您有用,而不是不利于您.也就是说,仅在空格可以的地方断开一行.

It works as defined: in normal content, a newline is equivalent to a space. There is no way to change this principle in HTML. Just divide you content into lines so that the principle works for you, not against you. That is, break a line only at a point where a space is OK.