邮件中的代码块有空新行

Code blocks appear to be formatted with an empty newline between each line ONLY in the HTML portion of emails. They appear correctly on both the forum itself, and in the plain text portion of the email. This is not an email formatting / CSS problem - there is an actual newline inserted in the source ONLY in the email case.

An example: [iFFT Freeze/Scrub - #25 by toneburst - Questions - scsynth]

The original source text of the post looks like:

The formatted post on the website looks like:

The HTML email received, however, looks like:

In the source for the email, you can see that all newlines have been doubled:

4 个赞

I agree, this is tends to look quite off.

@techAPJ can you investigate?

3 个赞

I am unable to repro this on latest Discourse version.

HTML:

Text:

This might be an issue with your email client.

我仍然看到 2.9.0.beta1 发送的电子邮件存在问题 - 如果在此之后已修复,请忽略此消息 :slight_smile:

这与特定的电子邮件客户端无关 - 我发布的第二个截图是为电子邮件生成的原始 HTML。但实际上,查看实际电子邮件内容(摘录…)更有启发性:

<pre style="word-wrap: break-word; max-width: 694px;"><code style="display: block; background-color: #f9f9f9; overflow: auto; padding: 5px;; background-color: #f9f9f9; padding: 2px 5px;">
(
// This expects two keys to be defined: ~history (the list) and ~recordKey (which key to record)
Pdef(\keyRecorder, Pbind(
	\callback, Pfunc({
		|event|
		event[\callback].addFunc({ // combine your record func with any previous callback that was there (it's okay if its nil)
			~history.add(currentEnvironment[~recordKey])
		}).postln;
	})
));

很明显,存在 (a) 实际的换行符,其中代码中应该有换行符,以及 (b) 每行末尾的 =0D 字符(回车符)。据我所知,<pre> 中的所有换行符都应被视为字面量,这解释了双换行符。

我可以在 Gmail 中重现此问题,并且可以通过直接在浏览器中打开电子邮件消息的 HTML 部分来重现(在替换了 =0D 等引用的可打印字符之后)。这让我很好奇:

  • 当您查看您发布的电子邮件的原始版本时,是否也看到了相同的(换行符加上 =0D)?
  • 如果是这样,您发布的“正确”视图的 HTML 源代码是什么样的?您的电子邮件客户端是否以某种方式剥离了 =0D(或换行符)?

无论如何,即使这是 Gmail 的特定问题,也可能值得研究一下,因为 Gmail 是迄今为止最常见的电子邮件客户端。