Skip to content

Commit cc8fdf5

Browse files
authored
Add a sentence on how to fix the external URI warning (#142)
Closes #140 ## Changes Add a sentence on how to fix the warning, explaining where to add the base domain. ```shell Warning: External URI 'https://docs.elastic.dev/migration/site-level/content#asciidoctor-conf-yml' is not allowed. Add 'elastic.dev' to the 'external_hosts' list in /Users/jcal/Projects/docs-builder/docs/source/docset.yml to allow links to this domain. ┌─[/Users/jcal/Projects/docs-builder/docs/source/testing/index.md] │ │ └─ ``` ## Notes The warning is missing the actual markdown line where the error is happening. (See example from #140) I saw the same behavior with @Mpdreamz when he demoed the app to me.
1 parent 260bac3 commit cc8fdf5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,15 @@ public override bool Match(InlineProcessor processor, ref StringSlice slice)
6262
{
6363
var baseDomain = string.Join('.', uri.Host.Split('.')[^2..]);
6464
if (!context.Configuration.ExternalLinkHosts.Contains(baseDomain))
65-
processor.EmitWarning(line, column, length, $"external URI: {uri} ");
65+
{
66+
processor.EmitWarning(
67+
line,
68+
column,
69+
length,
70+
$"External URI '{uri}' is not allowed. Add '{baseDomain}' to the " +
71+
$"'external_hosts' list in {context.Configuration.SourceFile} to " +
72+
"allow links to this domain.");
73+
}
6674
return match;
6775
}
6876

0 commit comments

Comments
 (0)