Closed gregkare closed 7 years ago
Cool. I think we should use <em>
for italic and <strong>
for bold instead. Those are the semantic HTML equivalents to the classes.
Thanks, changing it
I should have tried it, I used spans because I thought the <em>
and <strong>
tags would just be open and I'd have to close them manually :)
Adding the semantic tags and trying to close them using replacement didn't work at all, the results were super unpredictable. In a342c16 I have switched to an npm module to do the actual replacements, dealing with nesting and resetting properly. I couldn't find a way to use <strong>
and <em>
tags instead of <span>
(because Handlebars cannot do comparisons like equality without helpers, and I couldn't make any of the solutions work)
Now it supports bold, italic, underlined and proper nesting:
As discussed in AFK conversation yesterday, we don't actually want underlines to be used with something that's not a link, and we add our own underlines when turning URLs into actual links in the message component. Underlines really only make sense to style links in text-only IRC clients, where they're normally not underlined.
This worked almost with our own implementation that was extremely simple and didn't rely on a 3rd-party module (which will have to be included in the app code). I think we should go back to our solution, use spans instead of semantic elements for now, and remove underline support. No external dependencies, no additional code bloat and supports all the features we need.
Looks like @gregkare missed my last comment, but he's on vacation for a week from today on.
I'll check if I can revert to an earlier commit and just remove the underline.
@gregkare Wanna have a look at this again? Seems like we just need to pick a previous commit.
Ack, will do!
I have pushed the simplest change to support bold and italic and removed underlined support. It still has the issue of the style reset only resetting one tag, but I don't see a way to do this properly without using a real IRC style parser, so this is good enough
Great!
Connected to #12
I have used spans with classes, I'm open to other ways to do it though