-
Notifications
You must be signed in to change notification settings - Fork 22
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
fix: link overflow truncate #463
Conversation
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.
awesome thanks vy!
couple issues:
- If the viewport is too small, a 50 char URL will still overflow the content area. We need to add a CSS rules to break words if necessary. See the screenshot below. I think this is the CSS rule that resolves it: https://tailwindcss.com/docs/word-break#break-words
-
lets consolidate this logic to render url strings to html links outside of the Praise component. We should be able to keep all the relevant logic in either
components/MarkdownText.tsx
orutils/parser.ts
(we might want to consolidate them too). -
We have some redundant duplication of logic: in
components/MarkdownText.tsx
we use thelinkifyHtml()
function to convet url strings to html links. In this PR we're converting them twice (again in inparser.tsx
), and then we're truncating any urls inPraise.tsx
. Can we consolidate this into one implementation? -
If we want to keep using
linkifyHtml()
, it has a built-in option for handling truncation. See the option "format" on https://linkify.js.org/docs/options.html - might be simpler code but I don't have a strong preference. -
While looking at this I noticed another bug that it probably makes sense to address in the same PR, since they related to the same code. The bug is that if a url contains any markdown symbols, the html link rendering is broken. See Praise reasons containing URLs that including certain symbols are not rendered properly #465
Nice job.. for some reason |
Fixes #457
Fixes #465
this truncates long URLs to 50-character long hyperlinks.
and takes care of symbols inside hyperlinks.