Customisable "too long" post truncation length, based on number of lines AND number of characters
Pitch
Currently some long posts truncate, due to https://github.com/mastodon/mastodon/pull/8205
The example posted at that MR (https://share.elouworld.org/@Exagone313/195324 - 1042 chars, one per line) is truncated to 12 lines. However, there are some long-ish posts (e.g. https://mstdn.social/@Mirella_PhD/109310858624901226, which has a 21 lines and then a long image), which do not get truncated, I guess because they are under 500 characters total.
It would be good to have a user-customisable truncation length, for example:
- Truncate any post longer than 8 new lines.
- Truncate any post longer than 300 characters
- Don't show media on truncated posts
Motivation
These options would help prevent user's timelines from getting clogged up with large posts.
Truncation should ideally be based on max height, not character count
Yes, but I think that's not possible unless you assume a text width. Although I guess it would be reasonable to assume a fairly narrow text width, like 300px.
Not really, you can do it based on ex units or aspect ratio
For reference, I this post:

is 659 characters, 116 words, and 23 lines at about 650px. So about 28 characters per line (it's ~50 characters for the full width lines)
I think my ideal truncation strategy for something like this would be
- Estimate number of lines, maybe something like
nchars / 35? This doesn't need to be too precise - If num lines is more than
10(customisable), truncate to6lines (customisable), with a "read more" link.
It shouldn't be based on character count at all, because you can do things
l
i
k
e
t
h
i
s
The optimal strategy is to limit the max-height based on ex or aspect ratio
OK, but it needs to be both, because of line wrapping. In your example, you get 9 lines with 9 characters, but I can also get 9 lines just by writing 400ish characters, and some instances allow 1000+ characters, which can easily get you up to 30+ lines with only a few line breaks.
Yes, so you apply a max-height using ex units or otherwise calculating an aspect ratio using Javascript. What matters is line height -- that's why I'm suggesting ex.
Giving the user the control on line-clamp could be also a solution to manage the content height:
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
Also compare with #20188 "Option to disable external link previews". Perhaps the collapsed version of he post could show the link without the preview.