Skip to content

Commit b5a052d

Browse files
authored
Empty url in markdown links should result in an error not warning (#515)
1 parent 4ee6d2a commit b5a052d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private bool ValidateBasicUrl(LinkInline link, InlineProcessor processor, string
119119
{
120120
if (string.IsNullOrEmpty(url))
121121
{
122-
processor.EmitWarning(link, "Found empty url");
122+
processor.EmitError(link, "Found empty url");
123123
return false;
124124
}
125125

tests/authoring/Inline/InlineLinks.fs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,15 @@ type ``inline link with mailto not allowed external host`` () =
4646

4747
[<Fact>]
4848
let ``has warning`` () = markdown |> hasWarning "External URI 'mailto:[email protected]' is not allowed."
49+
50+
type ``empty link should result in an error`` () =
51+
52+
static let markdown = Setup.Markdown """
53+
[email me]()
54+
"""
55+
56+
[<Fact>]
57+
let ``has no errors`` () = markdown |> hasError "Found empty url"
58+
59+
[<Fact>]
60+
let ``has warning`` () = markdown |> hasNoWarnings

0 commit comments

Comments
 (0)