Skip to content

Store newlines as <br /> tag in new posted Notes#1148

Open
mnd wants to merge 1 commit into
nextcloud:masterfrom
mnd:create-post-with-newlines
Open

Store newlines as <br /> tag in new posted Notes#1148
mnd wants to merge 1 commit into
nextcloud:masterfrom
mnd:create-post-with-newlines

Conversation

@mnd

@mnd mnd commented Nov 28, 2020

Copy link
Copy Markdown
Contributor

ActivityStream assumes that content is HTML message: https://www.w3.org/TR/2017/REC-activitystreams-vocabulary-20170523/#dfn-content
To fullfill this assumption save newlines as <br /> during post creation

Signed-off-by: Nikolai Merinov nikolai.merinov@member.fsf.org

Summary

Suggested change should allow to store post in manner that allows to display it correctly on the web. Looks like other fediverse instances behave in similar manner. My only doubt is what better: use nl2br php function to have both newlines and <br \> tag, or use replace() call to have only <br \> tag

@mnd mnd force-pushed the create-post-with-newlines branch 2 times, most recently from e233158 to aa60d6f Compare December 4, 2020 11:46
@mnd

mnd commented Dec 4, 2020

Copy link
Copy Markdown
Contributor Author

Updated according to improvements from #1090

@mnd

mnd commented Dec 4, 2020

Copy link
Copy Markdown
Contributor Author

My only doubt is what better: use nl2br php function to have both newlines and <br > tag, or use replace() call to have only <br > tag

Replace is better because mastodon uses "white-space: pre-wrap" as default style and using <br \>\n will look ugly on mastodon web.

ActivityStream assumes that content is HTML message: https://www.w3.org/TR/2017/REC-activitystreams-vocabulary-20170523/#dfn-content
To fullfill this assumption save newlines as "<br />" during post creation
and do not sanitize this "<br>" tag when post returned to the WEB interface.
Additionally changed "strip_tags" call to format supported by php-7.3

Signed-off-by: Nikolai Merinov <nikolai.merinov@member.fsf.org>
@mnd mnd force-pushed the create-post-with-newlines branch from aa60d6f to dbdf09c Compare December 8, 2020 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve support for multiline notes

1 participant