docsify icon indicating copy to clipboard operation
docsify copied to clipboard

[WIP] Better support for relative links (e.g. download links) for non-markdown files

Open MartenBE opened this issue 2 years ago • 4 comments

Summary

Currently, using relative links to non-markdown files are broken and give a 404. This PR addresses this and should fix cases such as described in https://github.com/docsifyjs/docsify/issues/1929 and others.

Related issue, if any:

https://github.com/docsifyjs/docsify/issues/1929

What kind of change does this PR introduce?

  • Bugfix
  • Refactor

For any code change,

  • [ ] Related documentation has been updated, if needed -> Not needed
  • [x] Related tests have been added or updated, if needed

Does this PR introduce a breaking change?

No, although there has been some refactoring.

Tested in the following browsers:

  • [ ] Chrome
  • [x] Firefox
  • [ ] Safari
  • [ ] Edge

Notes

Relative linked files without extension are still seen as markdown files: I don't know if this is intentional or not, but seems counterintuitive. Better would be to require to link to .md-files with an explicit mention of the .md-extension (e.g. [test](test.md) of [test](./test.md).

MartenBE avatar Nov 06 '23 14:11 MartenBE

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docsify-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 23, 2023 9:07pm

vercel[bot] avatar Nov 06 '23 14:11 vercel[bot]

@MartenBE Hey can you add some non-.md files to the Docsify site so that we can manually test as well? (We can view the deployment for the PR for manual test). Once the PR is ready then we can delete them.

trusktr avatar Nov 23 '23 04:11 trusktr

I've added some test files, but the latest commits feel "off". It is rather unstable and sometimes seems to cause reload loops and weird behavior. Unfortunately, I am out of my league here as my understanding of docsify is rather superficial. I think the original commit (https://github.com/docsifyjs/docsify/pull/2300/commits/e594e39e8f6b18b892473846bbefb0cc9cabe522) was (although not as architectal "proper" as we would like) more robust, and also uses the same workings as image links.

MartenBE avatar Nov 23 '23 21:11 MartenBE

In the previous months, we have decided to go with MkDocs instead of Docsify due to this bug and other reasons. So I'll probably won't work on this any further.

MartenBE avatar Apr 09 '24 14:04 MartenBE