[Bug?] Posts from Misskey display weird #155

Open
opened 2022-09-04 06:13:36 +00:00 by Mergan · 10 comments
Member

Akkoma
image

Source
image

Is this Akkoma or them?

Akkoma ![image](/attachments/91c91183-d930-434d-816a-1d60526589bb) Source ![image](/attachments/54429836-a69e-4515-844a-384c8518aff5) Is this Akkoma or them?
Author
Member

image
Post from a few days ago before I upgraded to latest dev

![image](/attachments/f851407f-dfa5-4b6b-b781-d41b8032ce6a) Post from a few days ago before I upgraded to latest dev

this is technically them - the send "markdown", but consider \n to be a newline, where in markdown \n\n should be a newline

this is technically them - the send "markdown", but consider `\n` to be a newline, where in markdown `\n\n` should be a newline

By newline do you mean a paragraph break? In every Markdown spec we've heard of, \n\n is a paragraph break, not a line break, whereas

  \n

(two spaces followed by a line feed) is a line break. There are definitely specs that consider a single \n to be a line break, though.

Does MFM consider a single \n to be a line break? (I'm just clarifying the reply above this one. We've tried to find an English-language version of the official MFM spec to no avail, so we don't have a good way to figure this out ourselves.) If that's the case, would a PR for the Akkoma-MFMParser be useful? We'd be happy to contribute one if that's useful.

By newline do you mean a paragraph break? In every Markdown spec we've heard of, `\n\n` is a paragraph break, not a line break, whereas ``` \n ``` (two spaces followed by a line feed) is a line break. There are definitely specs that consider a single `\n` to be a line break, though. Does MFM consider a single `\n` to be a line break? (I'm just clarifying the reply above this one. We've tried to find an English-language version of the official MFM spec to no avail, so we don't have a good way to figure this out ourselves.) If that's the case, would a PR for the Akkoma-MFMParser be useful? We'd be happy to contribute one if that's useful.

yep your interpretation above is correct - MFM considers \n to be a paragraph break, no spaces needed

the above discrepancy can be created by that

yep your interpretation above is correct - MFM considers `\n` to be a paragraph break, no spaces needed the above discrepancy can be created by that

Thanks for confirming! Would a PR for Akkoma-MFMParser be welcomed to account for that discrepancy in the MFM Markdown spec?

Thanks for confirming! Would a PR for Akkoma-MFMParser be welcomed to account for that discrepancy in the MFM Markdown spec?

hm, i'm unsure - akkoma uses its generic markdown processor after preprocessing MFM tags - you might be able to add an option to the markdown parser which will accept single \n being a paragraph break

if you can manage that, then go right ahead

the MFM is processed here -> https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/web/common_api/utils.ex#L290

which in turn calls Earmark here -> https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/formatter.ex#L128

you might have to fiddle with preprocessing the input, good luck though, this stuff is incredibly fiddly

hm, i'm unsure - akkoma uses its generic markdown processor after preprocessing MFM tags - you might be able to add an option to the markdown parser which will accept single `\n` being a paragraph break if you can manage that, then go right ahead the MFM is processed here -> https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/web/common_api/utils.ex#L290 which in turn calls Earmark here -> https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/formatter.ex#L128 you might have to fiddle with preprocessing the input, good luck though, this stuff is incredibly fiddly

We had some stuff come up the last few weeks that kept us busy, but we're taking a look at this now. We'll submit a PR when we have something working (hopefully by the end of this weekend) and/or let folks if it doesn't seem feasible.

We had some stuff come up the last few weeks that kept us busy, but we're taking a look at this now. We'll submit a PR when we have something working (hopefully by the end of this weekend) and/or let folks if it doesn't seem feasible.
Mergan added the
Bug
label 2022-11-17 23:20:36 +00:00

If someone wants to test it, I'm pretty sure you could fix this by changing this line to "<br>" https://akkoma.dev/AkkomaGang/mfm-parser/src/branch/akkoma/lib/encoder.ex#L47 (And ofc also fix corresponding tests)

The parser already reads newlines, but doesn't do anything with them, it just puts it back.

So if we change the newline to <br>, then the markdown parser should leave that tag alone, et voila, we have the newline.

If someone wants to test it, I'm pretty sure you could fix this by changing this line to `"<br>"` https://akkoma.dev/AkkomaGang/mfm-parser/src/branch/akkoma/lib/encoder.ex#L47 (And ofc also fix corresponding tests) The parser already reads newlines, but doesn't do anything with them, it just puts it back. So if we change the newline to `<br>`, then the markdown parser should leave that tag alone, et voila, we have the newline.

I meant to write back sooner, but in short, my health has been less than great lately, and most of my energy is spent on recovering. I alluded to the same issue back in October, but unfortunately things are still nowhere near back to baseline.

I apologize for never taking care of this and never replying. On top of ongoing health issues that are just things I have to deal with, my repetitive strain injuries have flared up again and don't seem to be dying back down. So I've been in the process of learning to type by voice on a daily basis. Which, as a software developer, is not always the easiest thing.

I meant to write back sooner, but in short, my health has been less than great lately, and most of my energy is spent on recovering. I alluded to the same issue back in October, but unfortunately things are still nowhere near back to baseline. I apologize for never taking care of this and never replying. On top of ongoing health issues that are just things I have to deal with, my repetitive strain injuries have flared up again and don't seem to be dying back down. So I've been in the process of learning to type by voice on a daily basis. Which, as a software developer, is not always the easiest thing.

@ArcanaOfSouls No worries. We're all volunteers here, please don't feel pressured. Take care of yourself. You're much more important than this little bug ;)

@ArcanaOfSouls No worries. We're all volunteers here, please don't feel pressured. Take care of yourself. You're much more important than this little bug ;)
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 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: AkkomaGang/akkoma-fe#155
No description provided.