gpt4 book ai didi

html - 如何防止由于 HTML 代码中的换行而在输出中出现空格?

转载 作者:技术小花猫 更新时间:2023-10-29 12:07:48 25 4
gpt4 key购买 nike

我在这里看到了这个问题,有些人正在通过评论标签或像这样打破标签来解决它:

 <i><!--
-->t does not work on the first level with tabspace = 2
beside it looks horrible.
<a
>nnoying<
/a> is it not?

我记得好像见过什么把戏似的

<a>&dont_put_here_space_please;
tricky ampersand code.

有这样的东西吗?

我现在正在使用 jinja2 python 模板引擎。它有一些空间防止技巧吗?

更新:

有了 jinja2,多亏了 dav1d,我能想出的最短方法是:

<a>{% if true -%}
No space in the output before this text.
</a>{% endif -%}
Nor after.

有没有更短的方法来做到这一点?

最佳答案

Jinja2 WhiteSpace Control 是您所需要的(根据您对我评论的回复):http://jinja.pocoo.org/docs/templates/#whitespace-control

关于html - 如何防止由于 HTML 代码中的换行而在输出中出现空格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16403330/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com