Too much space between HTML elements in Markdown-statuses #1375

Closed
opened 2019-11-04 07:18:08 +00:00 by tastytea · 15 comments
Member

Pleroma version: 1.1.3
Pleroma-FE version: pleroma-fe@bcfdd68e7068e0385b56bcb88090b925f0a5a703

There is a huge amount of vertical space between HTML elements when I write Markdown posts.

screenshot_2019-11-04T08-02-36

Masto-FE for comparison:

screenshot_2019-11-04T08-03-00

I put borders around <p> and <blockquote> tags for this screenshot:

screenshot_2019-11-04T08-07-28

It looks better if I disable white-space: pre-wrap;.

screenshot_2019-11-04T08-16-08

Pleroma version: 1.1.3 Pleroma-FE version: pleroma-fe@bcfdd68e7068e0385b56bcb88090b925f0a5a703 There is a huge amount of vertical space between HTML elements when I write Markdown posts. ![screenshot_2019-11-04T08-02-36](/attachments/f8000e49-fedb-4f69-ac65-c50c46d8b055) Masto-FE for comparison: ![screenshot_2019-11-04T08-03-00](/attachments/f5917ba7-074d-42cf-9a97-6af8ac6a26d0) I put borders around `<p>` and `<blockquote>` tags for this screenshot: ![screenshot_2019-11-04T08-07-28](/attachments/97041a28-f976-42d7-ae82-9ce701186a52) It looks better if I disable `white-space: pre-wrap;`. ![screenshot_2019-11-04T08-16-08](/attachments/2254a532-1ec7-4495-a673-3a1366bc153a)

Related to #1374.

@hj what's to do here, change our markdown output?

Related to #1374. @hj what's to do here, change our markdown output?
Owner

@lambadalambda practically same issue as #1074

output isn't consistent between plain text and markdown/bbcode, markdown/bbcode adds extra newlines on top of

blocks

@lambadalambda practically same issue as https://git.pleroma.social/pleroma/pleroma/issues/1074 output isn't consistent between plain text and markdown/bbcode, markdown/bbcode adds extra newlines on top of <p> blocks
Member

it's a known issue, i'll look into trying to find a solution for both.

but newlines shouldn't effect rendering (although i think we send \r as well as \n which may be the problem...)

it's a known issue, i'll look into trying to find a solution for both. but newlines shouldn't effect rendering (although i think we send `\r` as well as `\n` which may be the problem...)
Owner

@kaniini as far as I remember, newlines do matter since pleroma-fe uses white-space: pre-wrap for compatibility i believe (iirc some very old PleromaBE didn't <br>s into plaintext and just rendered \ns as is).

Problem is, as far as I understand, Markdown/BBCode (and probably html too) also prettifies(?) html while plaintext does not.

For instance, input

lain 1
lain 2

in bbcode gives:

lain 1<br>
lain 2

while in plaintext it gives you

lain 1<br>lain 2

I want consistency - either you don't prettify code or you do. Either you put <br>s in plaintext or rely on \ns.

@kaniini as far as I remember, newlines do matter since pleroma-fe uses `white-space: pre-wrap` for compatibility i believe (iirc some very old PleromaBE didn't `<br>`s into plaintext and just rendered `\n`s as is). Problem is, as far as I understand, Markdown/BBCode (and probably html too) also prettifies(?) html while plaintext does not. For instance, input ``` lain 1 lain 2 ``` in bbcode gives: ``` lain 1<br> lain 2 ``` while in plaintext it gives you ``` lain 1<br>lain 2 ``` I want consistency - either you don't prettify code or you do. Either you put `<br>`s in plaintext or rely on `\n`s.
Owner

I think we should disable this pre-wrap and not rely on \n, it makes no sense to rely on that, the web has <br/> for a reason. I'll look into the backend code and tests to get a more correct behaviour while trying to not break things.

I think we should disable this `pre-wrap` and not rely on `\n`, it makes no sense to rely on that, the web has `<br/>` for a reason. I'll look into the backend code and tests to get a more correct behaviour while trying to not break things.
Owner

no. i've seen some statuses recently that did not have <br> but only had \ns for linebreaks

no. i've seen some statuses recently that did not have `<br>` but only had `\n`s for linebreaks
Owner

Statuses from pleroma or from other implementations? Also pleroma might be messing with formatting of others…

Statuses from pleroma or from other implementations? Also pleroma might be messing with formatting of others…
Owner

most likely other implementations, did not check at the time.

most likely other implementations, did not check at the time.
Owner

But well if they do not have <br> it would be broken in MastoFE and probably a bunch of other clients/frontends.

But well if they do not have `<br>` it would be broken in MastoFE and probably a bunch of other clients/frontends.
Owner

that makes PleromaFE the best frontend because it doesn't break status display no matter the implementation.

broken newlines < extra vertical space

that makes PleromaFE the best frontend because it doesn't break status display no matter the implementation. broken newlines < extra vertical space
Owner

Yeah, I'd rather have a bit of extra newlines than everything ending up on one line. But there is still consistency and interoperability issue. PleromaBE formatters should basically not use \n as <br/> should basically always work.

Update: One exception can be inside the pre element I guess as \n should just work into it and I think are de-facto preferred.

Yeah, I'd rather have a bit of extra newlines than everything ending up on one line. But there is still consistency and interoperability issue. PleromaBE formatters should basically not use `\n` as `<br/>` should basically always work. Update: One exception can be inside the `pre` element I guess as `\n` should just work into it and I think are de-facto preferred.
Member

Even when #5582 is merged, I think pre-wrap should be disabled. There are people who post HTML and they expect newlines to not matter. Both ActivityPub and MastoAPI say that the post content should be HTML and it's clearly other implementation's fault if they expect \n to produce a line break.

Even when #5582 is merged, I think `pre-wrap` should be disabled. There are people who post HTML and they expect newlines to not matter. Both ActivityPub and MastoAPI say that the post content should be HTML and it's clearly other implementation's fault if they expect `\n` to produce a line break.
Owner

Yeah… not sure how it could be detected to warn other implementations though. (other than just noticing a different rendering between pleroma-fe and others)

Yeah… not sure how it could be detected to warn other implementations though. (other than just noticing a different rendering between pleroma-fe and others)
Owner

again i would prefer ignoring "the spec" and prefer to do the thing that actually works/looks better or breaks less often.

at very least pleromafe could engage/disengage pre-wrap depending if /n is present or not, but it could break with <pre> blocks unless we parse that.

again i would prefer ignoring "the spec" and prefer to do the thing that actually works/looks better or breaks less often. at very least pleromafe could engage/disengage `pre-wrap` depending if `/n` is present or not, but it could break with `<pre>` blocks unless we parse that.
Member

Disabling pre-wrap does look better in most cases right now though, even if we remove \ns from new posts there is still a lot of old posts with it. I've checked and the only AP implementation I know of that uses \n instead of <br> is Peertube, filed an issue on their tracker.

Contradicted myself without noticing it, please disregard.

~~Disabling `pre-wrap` does look better in most cases right now though, even if we remove `\n`s from new posts there is still a lot of old posts with it. I've checked and the only AP implementation I know of that uses `\n` instead of `<br>` is Peertube, filed an issue on their tracker.~~ Contradicted myself without noticing it, please disregard.
Sign in to join this conversation.
No milestone
No project
No assignees
6 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pleroma/pleroma#1375
No description provided.