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

Link replacement #273

Open
Rich-Harris opened this issue Jan 10, 2024 · 0 comments
Open

Link replacement #273

Rich-Harris opened this issue Jan 10, 2024 · 0 comments

Comments

@Rich-Harris
Copy link
Member

JSDoc snippets often include links to https://kit.svelte.dev/docs/whatever, because we want the links to be valid inside editor tooltips. But these also get rendered as-is on the site itself. That's fine in production, but a (minor) nuisance for preview deployments.

It might be good if there was an option for replacing links — something like this:

import { VERCEL_URL } from '$env/static/private';

const base = 'https://kit.svelte.dev/';

renderContentMarkdown(filename, body, {
  ...stuff,
  transformLink: (href) => href.startsWith(base)
    ? href.replace(base, `https://${VERCEL_URL}/`)
    : href
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant