Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/model/content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,9 @@ class _ZulipContentParser {

if (localName == 'a'
&& (className.isEmpty
|| (className == 'stream-topic' || className == 'stream'))) {
|| className == 'stream-topic'
|| className == 'stream'
|| className == 'message-link')) {
final href = element.attributes['href'];
if (href == null) return unimplemented();
final link = LinkNode(nodes: nodes(), url: href, debugHtmlNode: debugHtmlNode);
Expand Down
13 changes: 13 additions & 0 deletions test/model/content_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,17 @@ class ContentExample {
GlobalTimeNode(
datetime: DateTime.parse("2024-03-07T23:00:00Z")));

static final messageLink = ContentExample.inline(
'message link',
'#**api design>notation for near links@1972281**',
// https://chat.zulip.org/#narrow/channel/7-test-here/topic/Rajesh/near/1976383
'<p><a class="message-link" '
'href="/#narrow/channel/378-api-design/topic/notation.20for.20near.20links/near/1972281">'
'#api design &gt; notation for near links @ 💬</a></p>',
const LinkNode(
url: '/#narrow/channel/378-api-design/topic/notation.20for.20near.20links/near/1972281',
nodes: [TextNode('#api design > notation for near links @ 💬')]));

static const spoilerDefaultHeader = ContentExample(
'spoiler with default header',
'```spoiler\nhello world\n```',
Expand Down Expand Up @@ -973,6 +984,8 @@ void main() {
'#mobile-team &gt; zulip-flutter</a></p>',
const LinkNode(url: '/#narrow/stream/243-mobile-team/topic/zulip-flutter',
nodes: [TextNode('#mobile-team > zulip-flutter')]));

testParseExample(ContentExample.messageLink);
});

testParseInline('parse nested link, del, strong, em, code',
Expand Down
Loading