mdmath icon indicating copy to clipboard operation
mdmath copied to clipboard

What is the best way to link local docs so that links that work both in `.md` and in `.html` formats?

Open nucflash opened this issue 6 months ago • 0 comments

What is the best way to create links to documents that work in both the Markdown Preview and the standalone HTML version?

Say that I'm typing fileB.md and I want to link to fileA.md that I wrote earlier. To make the link work in standalone HTML I write:

# fileB.md
[something related](fileA.html)

and after compilation it looks like this:

# fileB.html
<a href="fileA.html">something related</a>

This allows me to follow the link in the HTML version but it is broken in the Markdown version.

I'd like to refer to the file in it's Markdown source and have the compiler to convert it to .html so that the link works in HTML standalone mode too:

# fileB.md
[something related](fileA.md)

# fileB.html (after compilation)
<a href="fileA.html">something related</a>

Is there a way to achieve that? Thanks!

nucflash avatar Aug 04 '24 21:08 nucflash