SyntaxHighlighter 表现得很有趣

发布于 2025-01-07 07:54:53 字数 353 浏览 4 评论 0 原文

我在我的 SyntaxHighlighter .php" rel="nofollow">网站,它的行为非常奇怪。我将代码放在

 中并使用 SyntaxHighlighter.all(),我得到的是在每一个代码中,它插入了 1~2 行额外的行。

问题出在哪里?我检查了一切,一切都很好。请帮忙。

I am using SyntaxHighlighter on my website and it is acting very strange. I put my codes in <pre>s and used SyntaxHighlighter.all(), and what I got are in every single codes, it inserted 1~2 extra lines.

Where's the problem? I checked everything and everything is fine. Please help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

飞烟轻若梦 2025-01-14 07:54:53

我不知道 SyntaxHighlighter,但一般来说,

 标签立即生效,LF 和 CR 一切都有效。当语法荧光笔进行转换时,它也可能会考虑这些换行符。例如:

<pre>
  There will be a line before and after this
</pre>

vs.

<pre>There will be no lines</pre>

我们习惯于编写格式良好且缩进良好的代码,但使用 pre 标记时,您必须例外。看看你的源代码,我认为你正在以最好的方式做这件事。

I don't know about SyntaxHighlighter, but in general, the <pre> tag works effective immediately, LF and CR everything. When Syntax Highlighter does its conversion, it might be respecting these line feeds as well. For example:

<pre>
  There will be a line before and after this
</pre>

vs.

<pre>There will be no lines</pre>

We're used to writing well-formatted and well-indented code, but with pre tags you have to make an exception. Looking at your source code, I think you're doing it the top way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文