-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Improve linebreak logic for html messages #2022
base: main
Are you sure you want to change the base?
Conversation
3abfc9b
to
552881d
Compare
lib/src/utils/markdown.dart
Outdated
text = text | ||
.trim() | ||
.split('\n') | ||
.map((line) => line.isEmpty ? '\u200C' : line) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can not used this symbol as workaround because it used in Persian alphabet
https://en.wikipedia.org/wiki/Zero-width_non-joiner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the zero width space character U+200B then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to marking it with a newly defined /newline
marker. This gets ignored in markdown itself. The only side effect would be, that the user could type /newline
everywhere which would be converted to a normal linebreak
552881d
to
d255b8b
Compare
d255b8b
to
c75c1cd
Compare
c75c1cd
to
2446740
Compare
// in all empty lines to keep the lines as the user added them and workaround | ||
// the markdown rules for multiple empty lines. | ||
text = text | ||
.replaceAll('/newline', '\n') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels very hacky, what if people send /newline/newline/newline
or so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then they will have three new lines. I thought as we support commands with /anything anyway this is the best compromise. We already wasted countless hours to find a non hacky solution and havent found one
Closes #1691
Tested in FluffyChat: