CodeFoodPixels / eleventy-plugin-webmentions

An eleventy plugin to fetch webmentions and helper methods to display them
38 stars 1 forks source link

Allow for line breaks in comments #3

Closed rangermeier closed 1 year ago

rangermeier commented 1 year ago

I'd like to display webmention comments on my blog with line breaks as in the original post on mastodon/twitter/...

It appears that sanitize-html strips line feeds \n when processing HTML strings. I couldn't find any documentation on how sanitize-html treats white-space and line feeds.

Would it be possible to implement an additional option to eleventy-plugin-webmentions, i.e. htmlConvertNewLines or htmlNl2br (naming things is hard), that would replace any \n to <br> before passing the HTML strings to the sanitizer?

CodeFoodPixels commented 1 year ago

I've just realised that this impacts my site too! I'll have to have a dig into it and have a look

On Fri, 6 Jan 2023, 13:43 Rupert Angermeier, @.***> wrote:

I'd like to display webmention comments on my blog with line breaks as in the original post on mastodon/twitter/...

It appears that sanitize-html strips line feeds \n when processing HTML strings. I couldn't find any documentation on how sanitize-html treats white-space and line feeds.

Would it be possible to implement an additional option to eleventy-plugin-webmentions, i.e. htmlConvertNewLines or htmlNl2br (naming things is hard), that would replace any \n to
before passing the HTML strings to the sanitizer?

— Reply to this email directly, view it on GitHub https://github.com/CodeFoodPixels/eleventy-plugin-webmentions/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEPFVDV7CK5XKGTTZTBS23WRAORPANCNFSM6AAAAAATTDAN5A . You are receiving this because you are subscribed to this thread.Message ID: @.***>

CodeFoodPixels commented 1 year ago

Fixed in v2.0.0. If you specify that you want HTML, it will convert blocks of text separated by \n into paragraphs wrapped by the <p> tag