learn.svelte.dev icon indicating copy to clipboard operation
learn.svelte.dev copied to clipboard

links between tutorials and reference docs

Open Rich-Harris opened this issue 2 years ago • 3 comments

good point from @FractalHQ, we don't do a good job of connecting the different parts of the docs

Rich-Harris avatar Jun 02 '22 18:06 Rich-Harris

I could tackle this one with some <a href="link/to#docs" target="_blank"> wrappers (unless there's a better way to open in new tab w. md) like:

Screenshot 2022-06-02 at 4 23 40 PM

braebo avatar Jun 02 '22 20:06 braebo

We actually have the ability to render <a> elements however we like — we can basically add a new link method here alongside code...

https://github.com/sveltejs/learn.svelte.dev/blob/4114ff1d174de67596c5769c308d67e1e6fb2a78/src/lib/server/markdown.js#L32-L34

...and e.g. add _target="blank" to any external links, or even use aliases like [motion]($docs/whatever). That way we can keep the authored markdown neat and tidy. The marked API is a bit chaotic but the details are here: https://marked.js.org/using_pro#renderer

Rich-Harris avatar Jun 03 '22 03:06 Rich-Harris

So I've added doc-links to the Svelte and Advanced Svelte sections. Should I hold off on the Kit sections for now and open a PR for what's here?

I added the marked anchor tag bit here:

https://github.com/sveltejs/learn.svelte.dev/blob/6c1ecddc92fb835af76c1c9dce87f8930e32f515/src/lib/server/markdown.js#L117-L128

braebo avatar Jun 15 '22 19:06 braebo