Skip to content
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

Links to static files are broken #639

Open
mbostock opened this issue Jan 31, 2024 · 1 comment · May be fixed by #1354
Open

Links to static files are broken #639

mbostock opened this issue Jan 31, 2024 · 1 comment · May be fixed by #1354
Labels
bug Something isn’t working

Comments

@mbostock
Copy link
Member

Consider the following HTML:

<a href="test.png"><img src="test.png"></a>

The img[src] attribute is rewritten as expected, but the a[href] is not, so you get this:

<a href="test.png"><img src="./_file/test.png"></a>

We do rewrite a[href] attribute when there’s also a[download]:

https://github.com/observablehq/cli/blob/205d09b88907899a63fe9f4931715456d4055b6d/src/markdown.ts#L326

We don’t blanketly rewrite a[href] because it’s often used to link to another page, and pages don’t live in _file. But we should be able to tell whether a link is a link to a page or not (because we know how to resolve pages) — and for that matter, we want to normalize and rewrite links to pages anyway (to remove .md and to add .html for non-clean URLs).

@mbostock mbostock added the bug Something isn’t working label Jan 31, 2024
@Fil
Copy link
Contributor

Fil commented May 13, 2024

See #1328

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn’t working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants