diff --git a/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs b/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs index b75885d89..15ff98b50 100644 --- a/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs +++ b/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs @@ -119,7 +119,7 @@ private bool ValidateBasicUrl(LinkInline link, InlineProcessor processor, string { if (string.IsNullOrEmpty(url)) { - processor.EmitWarning(link, "Found empty url"); + processor.EmitError(link, "Found empty url"); return false; } diff --git a/tests/authoring/Inline/InlineLinks.fs b/tests/authoring/Inline/InlineLinks.fs index 10a9d6285..4792dcbd5 100644 --- a/tests/authoring/Inline/InlineLinks.fs +++ b/tests/authoring/Inline/InlineLinks.fs @@ -46,3 +46,15 @@ type ``inline link with mailto not allowed external host`` () = [] let ``has warning`` () = markdown |> hasWarning "External URI 'mailto:fake-email@somehost.co' is not allowed." + +type ``empty link should result in an error`` () = + + static let markdown = Setup.Markdown """ +[email me]() +""" + + [] + let ``has no errors`` () = markdown |> hasError "Found empty url" + + [] + let ``has warning`` () = markdown |> hasNoWarnings