-
Notifications
You must be signed in to change notification settings - Fork 32
Fix image URLs #2193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix image URLs #2193
Conversation
reakaleek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would testing help verify this?
Mpdreamz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can simplify this a bit using:
if (context.Build.AssemblerBuild && context.TryFindDocument(fi) is MarkdownFile currentMarkdown)
{
// Acquire navigation-aware path
if (context.PositionalNavigation.MarkdownNavigationLookup.TryGetValue(currentMarkdown, out var currentNavigation))
{
var uri = new Uri(new UriBuilder("http", "localhost", 80, currentNavigation.Url).Uri, url);
newUrl = uri.AbsolutePath;
}
else
context.EmitError($"Failed to acquire navigation for current markdown file '{currentMarkdown.FileName}' while resolving relative url '{url}'.");
}Co-authored-by: Martijn Laarman <Mpdreamz@gmail.com>
I took a stab at creating a appropriate test for this: I was able to verify, that the test succeeds with your changes and fails without your changes. |
Fixes #2190
On assembler builds, image URLs were not being adjusted to their final paths. We can access this information through the context's PositionalNavigation.