Skip to content

Commit b409db3

Browse files
committed
trim path separator on imageUrl
1 parent 0f4a85f commit b409db3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Elastic.Markdown/Myst/Directives/DirectiveHtmlRenderer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected override void Write(HtmlRenderer renderer, DirectiveBlock directiveBlo
9292
private void WriteImage(HtmlRenderer renderer, ImageBlock block)
9393
{
9494
var imageUrl = block.ImageUrl.StartsWith("/_static") || block.ImageUrl.StartsWith("_static")
95-
? $"{block.Build.UrlPathPrefix}/{block.ImageUrl}"
95+
? $"{block.Build.UrlPathPrefix}/{block.ImageUrl.TrimStart('/')}"
9696
: block.ImageUrl;
9797
var slice = Image.Create(new ImageViewModel
9898
{
@@ -112,7 +112,7 @@ private void WriteImage(HtmlRenderer renderer, ImageBlock block)
112112
private void WriteFigure(HtmlRenderer renderer, ImageBlock block)
113113
{
114114
var imageUrl = block.ImageUrl.StartsWith("/_static") || block.ImageUrl.StartsWith("_static")
115-
? $"{block.Build.UrlPathPrefix}/{block.ImageUrl}"
115+
? $"{block.Build.UrlPathPrefix}/{block.ImageUrl.TrimStart('/')}"
116116
: block.ImageUrl;
117117
var slice = Slices.Directives.Figure.Create(new ImageViewModel
118118
{

0 commit comments

Comments
 (0)