Closed jmcudd closed 4 months ago
This is nice. Should add this to the anchor tag
target="_blank"
This is nice. Should add this to the anchor tag
target="_blank"
Done
And need to handle the querystrings better
input: https://example.com/dir/page.html?key=value&key2=value2
currently renders like this as the ampersand got encoded earlier
https://example.com/dir/page.html
?key=value&key2=value2`
How should they be handled? Should they be dropped all together or included in the link? I render then in the event that someone wants to use them. Perhaps I could have two links, one with no queries and one with the queries.
input: https://example.com/dir/page.html?key=value&key2=value2
output:
<a href="https://example.com/dir/page.html">https://example.com/dir/page.html</a><a href="https://example.com/dir/page.html?key=value&key2=value2">?key=value&key2=value2</a>
I think its better if one link is presented. And having the querystring parameters outside the link is a nice touch. Just want the encoding to support easier copying without needing to edit the encoding of ampersands dividing the parameters.
Here is the approach I'm suggesting. I'll merge it into this PR if you like it. https://github.com/jmcudd/cornychat/pull/1
That's actually better what you have in https://github.com/jmcudd/cornychat/pull/1
Links will look like this.
Be sure to test bold and italic in this PR, it is different.
Yeah, the bold and italics are good. Also gives me ideas that it may be feasible to integrate NIP-30 custom emojis eventually.
Lines 87-89 aren't necessary since escaping was already performed on line 69. This is also escaping HTML, and if anything, may need to URI encode.
However, that should already be done by someone copy/pasting in, and there's no harm in not performing further treatment. For example, if a user provided the following url
https://example.com/file?var=123&var2=78%&var3=w%w%
we wouldn't want to double encode the entire querystring as
https://example.com/file?var%3D123%26var2%3D78%25%26var3%3Dw%25w%25
nor would we want to do on just the values as
Looks good
Links now work. I intentionally do not link any query parameters because they often container trackers. If someone really wants to view the link with the full query parameters, they can copy paste the full url. Also I simplified the bold and italic logic to cut out the while loops.