varabyte / kobweb

A modern framework for full stack web apps in Kotlin, built upon Compose HTML
https://kobweb.varabyte.com
Apache License 2.0
1.51k stars 66 forks source link

Support linking to other .md documents #332

Closed bitspittle closed 10 months ago

bitspittle commented 11 months ago

If you try to do this: [link text](path/to/other/document.md), currently that generates a link that fails (because in the final site, document.md will have been converted into document.html by that time). It would be nice of a target .md link was detected and converted into a URL automatically.

Note that this is supported in GitHub pages - you can target an md document and the link will get automatically converted to an html url.

There are two reasons we should support this feature, besides the fact that GH is doing it...

  1. Kobweb markdown allows route overrides (see README), so it would be pretty cool to link to an md file knowing that whatever final URL it resolves to will be handled automatically.(*)

  2. When navigating markdown files in GitHub, it can follow links to other markdown files in the same project.


(*) Example of routeOverride:

# TargetPage.md
---
routeOverride: target-page
---

# SourcePage.md

Link to [target page][TargetPage.md]

should generate final Kotlin code that looks like

Text("Link to ")
Link("target-page", "target page")

[!NOTE] I set this bug to "good first issue" because it's relatively self contained, but there is a chance that the devil is in the details with solving the routeOverride stuff, so it may be harder than I'm expecting.

bitspittle commented 11 months ago

(Self-assigning this issue since MartinTheDragon is working on it and I couldn't find a way to assign the task to that user)

bitspittle commented 10 months ago

(This feature went out in 0.14.2)