Inconsistent internal onebox spacing

When two internal links are added to a topic the spacing between them is inconsistent. If no blank line is between the links the spacing is significantly greater than if a blank line is provided.

https://meta.discourse.org/t/discourse-2-0-0-beta4-release-notes/82446
https://meta.discourse.org/t/discourse-2-0-0-beta5-release-notes/83881
https://meta.discourse.org/t/discourse-2-0-0-beta4-release-notes/82446

https://meta.discourse.org/t/discourse-2-0-0-beta5-release-notes/83881

cc @awesomerobot

7 个赞

Oddly enough, when there’s no line between the two we add a <br> to the markup and when there is a line between the two we don’t.

4 个赞

Hmm, what do you recommend to fix?

Ah, I understand why this happens now (bear with me here)…

If I type:

word
word

…I intentionally put a single carriage return there, so it correctly renders as:

<p>
    word
    <br>
    word
</p>

When I type:

word

word

…this is two returns, so the markup is correctly output as two paragraphs:

<p>
    word
</p>
<p>
    word
</p>

But with oneboxes, we’re treating them as they’re input (two strings with a single carriage return) and not as they’re output (two separate HTML elements)…

For example, when I type:

https://meta.discourse.org/t/discourse-2-0-0-beta4-release-notes/82446
https://meta.discourse.org/t/discourse-2-0-0-beta5-release-notes/83881

…the output is:

<aside>
</aside>
<br>
<aside>
</aside>

This is technically correct for the input. I entered two lines with a carriage return between them… but I was required to put that carriage return there for the oneboxes to exist. We shouldn’t count that carriage return because it’s a prerequisite to generate oneboxes. I’m not doing it for the purpose of creating a new line of text (so there shouldn’t be a <br> there).

When I type:

https://meta.discourse.org/t/discourse-2-0-0-beta4-release-notes/82446

https://meta.discourse.org/t/discourse-2-0-0-beta5-release-notes/83881

…the output is:

<aside>
</aside>
<aside>
</aside>

This would be correct if they were two paragraphs, which is how the text is input, but not how it’s output. We should add a <br> here, because I’m adding a space that doesn’t need to be there (intentionally dividing the content).

10 个赞

Still an issue apparently :slight_smile:

3 个赞

抱歉再次提起这个话题,但我想借用这个话题(而不是开新话题……)

我确信这已经是众所周知的了,但是使用 onebox 内部链接时,如果展开它,看起来效果很好——但默认情况下,视图没有格式。

展开之前……

展开后看起来效果很好。

除非 OP 引用了文本,否则预览不应该保留格式——而不是试图将尽可能多的文本塞进框中?

或者是我错过了什么,这一切都是设计如此?

是的,展开前没有格式,否则文本就装不下了。

2 个赞

我明白了,我想这已经持续一段时间了。

恕我直言,从用户界面的角度来看,看到我正在进入的帖子而不是被挤压的版本,会不会更“干净”?

如果帖子的发布者想突出特定文本,他可以引用,这样看起来效果很好。

我觉得如果他们链接了帖子,他们可能希望我们点击帖子,或者至少展开并获得一些上下文。

从纯粹的数量来看,我认为更多人会点击或展开格式正确的帖子。看起来更方便。

别忘了,大多数 Discourse 用户都不是程序员。看到像那样挤在盒子里的文本不是他们习惯看到的。

对比

……再次声明,这只是一个观点。

1 个赞