File tree 2 files changed +17
-2
lines changed
2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -84,8 +84,17 @@ function internalParseMarkdown(md, prevLinks) {
84
84
}
85
85
// Links:
86
86
else if ( token [ 10 ] ) {
87
- out = out . replace ( '<a>' , `<a href="${ encodeAttr ( token [ 11 ] || links [ prev . toLowerCase ( ) ] ) } ">` ) ;
88
- chunk = flush ( ) + '</a>' ;
87
+ // Get the URL from either direct URL or reference
88
+ const url = token [ 11 ] || links [ prev . toLowerCase ( ) ] ;
89
+ if ( url ) {
90
+ // Only create a link if there's actually a URL
91
+ out = out . replace ( '<a>' , `<a href="${ encodeAttr ( url ) } ">` ) ;
92
+ chunk = flush ( ) + '</a>' ;
93
+ } else {
94
+ // If no URL, replace the opening <a> tag with the original bracket text
95
+ out = out . replace ( '<a>' , '[' ) ;
96
+ chunk = flush ( ) + ']' ;
97
+ }
89
98
}
90
99
else if ( token [ 9 ] ) {
91
100
chunk = '<a>' ;
Original file line number Diff line number Diff line change @@ -2213,6 +2213,12 @@ document.addEventListener('click', (e) => {
2213
2213
// If we're clicking the emoji search, don't close it!
2214
2214
if ( e . target === emojiSearch ) return ;
2215
2215
2216
+ // If we're clicking an <a> link, handle it with our openUrl function
2217
+ if ( e . target . tagName === 'A' && e . target . href ) {
2218
+ e . preventDefault ( ) ;
2219
+ return openUrl ( e . target . href ) ;
2220
+ }
2221
+
2216
2222
// If we're clicking a Reply button, begin a reply
2217
2223
if ( e . target . classList . contains ( "reply-btn" ) ) return selectReplyingMessage ( e ) ;
2218
2224
You can’t perform that action at this time.
0 commit comments