docsify icon indicating copy to clipboard operation
docsify copied to clipboard

`routeRewrite` / `redirect` support like `alias`

Open meghprkh opened this issue 1 year ago • 0 comments

Feature request

redirect / routeRewrite like alias

What problem does this feature solve?

The problem is when docs are stored in a subdirectory in the repo and served from there. If we use relative urls with relativePath true in docsify then everything works well, but if we want to use absolute paths, then it becomes a problem. This is because rendered markdown in Github viewer or otherwise would assume say /docs/mydir/a.md to be the link and not /mydir/a.md

Adding a routeRewrite would solve this, and also solve the sidebar issue too. #1761 #1891

What does the proposed API look like?

window.$docsify = {
  routeRedirect: {
      '/.*/_sidebar.md': '/_sidebar.md',
      '/docs/.*/': '/$1',
   }
}

How should this be implemented in your opinion?

Any link that points to any of these routes shall be rewritten. Note we must also do this for image links too and not just docsify hash/history router redirects.

Are you willing to work on this yourself?

Yes, but I would need help :)

meghprkh avatar Jan 31 '23 18:01 meghprkh