Closed Marky-Gee closed 2 years ago
Actually I've found the file https://github.com/TryGhost/Ghost/blob/main/core/shared/html-to-plaintext.js which includes the wordwrap: 80 that was causing my issue.
So this isn't really a bug, just something I didn't think was done on purpose.
You can close this if you wish.
The original intention for the plaintext field was as the text version of the post in an email. It ended up being used for excerpts, and actually we generate the email text elsewhere.
This is one of many problems which can be summarised as "our automatic excerpts are rubbish" π¬ but it's not yet reached the point where anyone cares enough to come up with a smarter version... not least because changing this outside a major version would be unexpected IMO.
It's something we'll consider revisiting in the next major (it's on the list) but otherwise I'm going to close this as it only represents a tiny fraction of the problem! π π π
Issue Summary
When a post is created, the excerpt and plaintext fields in the content API and webhooks add extra newlines where they are not needed.
Typing the sentence "For creators and aspiring entrepreneurs looking to generate a sustainable recurring revenue stream from their creative work, Ghost has built-in payments allowing you to create a subscription commerce business." in the editor produces.
HTML Produces (Correct)
<p>For creators and aspiring entrepreneurs looking to generate a sustainable recurring revenue stream from their creative work, Ghost has built-in payments allowing you to create a subscription commerce business.</p>
Plaintext produces (new lines after "sustainable" & "payments" Incorrect)
Steps to Reproduce
Ut semper sit amet tortor non auctor. Praesent leo tellus, efficitur et tortor in, commodo lacinia eros. Morbi tincidunt enim ac sem ultricies, sit amet convallis nisl posuere. Aliquam imperdiet felis sit amet justo tincidunt, in dapibus odio laoreet. Phasellus vehicula nibh risus, vel viverra lacus gravida nec. Nam velit elit, efficitur at leo non, auctor feugiat arcu. Nulla volutpat in tellus vitae gravida. Fusce vehicula mi at dictum posuere. Vestibulum ac quam iaculis, luctus nisi et, volutpat dolor. Sed placerat sit amet magna nec lobortis. Maecenas ultricies, felis ut tincidunt sagittis, quam lorem iaculis tellus, in blandit arcu nulla a magna.