Skip to content
Open
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: 2 additions & 2 deletions packages/message-parser/src/grammar.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ LinkTitle = (Whitespace / Emphasis) / anyTitle:$(!("](" .) .) { return plain(any

LinkTitle2 = $([\x20-\x3B\x3D\x3F-\x60\x61-\x7B\x7D-\xFF] / NonASCII)+

LinkRef = URL / FilePath / p:Phone { return 'tel:' + p.number; } // TODO: Accept parenthesis
LinkRef = URL / FilePath / p:Phone { return 'tel:' + p.number; }

FilePath = $(URLScheme URLBody+)

Expand All @@ -297,7 +297,7 @@ URLScheme = $([A-Za-z0-9+-] |1..32| ":")
URLBody
= (
!(Extra+ (Whitespace / EndOfLine) / Whitespace)
(AnyText / [*\[\/\]\^_`{}~(])
(AnyText / [*\[\/\]\^_`{}~()])
)+

URLAuthority = $("//" URLAuthorityUserInfo? URLAuthorityHost)
Expand Down
10 changes: 10 additions & 0 deletions packages/message-parser/tests/link.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ test.each([
]),
],
],
[
'[link](https://example.com/query?this=(is)&a=problem)',
[
paragraph([
link('https://example.com/query?this=(is)&a=problem', [
plain('link'),
]),
]),
],
],
['[](https://rocket.chat)', [paragraph([link('https://rocket.chat')])]],
[
'[ ](https://rocket.chat)',
Expand Down