Closed Koooooo-7 closed 7 months ago
Hi @L-super , I can not find the A-Programmers-Guide-to-English
in the sidebar. there is what I did:
docsify serve docs
on the root.I didn't see any path similar as you mentioned:
http://localhost:3000/#/A-Programmers-Guide-to-English/essence/make-a-program/README
But I found the /CPP-Concurrency-in-Action-2nd-Edition/content/
seems has issue as well when I clicked its sidebar different titles more times.
So, I try to work on it directly to make it works, it is similar to rewrite the path ( include File path). Hope it helps as a sample.
Change the path in /CPP-Concurrency-in-Action-2nd-Edition/guide.md
--- removing all the rest of /
before content.
(BTW, so does the English-level-up-tips
section)
Create alias
to replace routes (rewrite to the right md doc path
).
window.$docsify = {
alias:{
'\/CPP-Concurrency-in-Action-2nd-Edition.*(?:.*\/content\/(.*))': '/CPP-Concurrency-in-Action-2nd-Edition/content/$1'
}
}
Besides, correct the hash url in browser as well.
window.$docsify = {
plugins: [
function(hook, vm){
hook.beforeEach(content=>{
const cpp = "\/CPP-Concurrency-in-Action-2nd-Edition.*(?:.*\/content\/(.*))"
const regex = new RegExp(`^${cpp}$`)
let path = window.location.hash && window.location.hash.substring(1)
if(regex.test(path)){
path = '/CPP-Concurrency-in-Action-2nd-Edition/content/'+path.match(regex)[1]
history.replaceState(null, null, `#${path}`);
}
})
}
]
}
TBH, It works but so cumbersome... I suppose that restructure your project should be more practicable.
Hi @L-super , I can not find the
A-Programmers-Guide-to-English
in the sidebar. there is what I did:
- Folk the repo you provide.
- Run
docsify serve docs
on the root.- Go to the on live site and click the sidebar jump into different sections.
- Check each of the sidebar generated routes on the sidebar.
- Check the contents and url.
I didn't see any path similar as you mentioned:
http://localhost:3000/#/A-Programmers-Guide-to-English/essence/make-a-program/README
But I found the
/CPP-Concurrency-in-Action-2nd-Edition/content/
seems has issue as well when I clicked its sidebar different titles more times.So, I try to work on it directly to make it works, it is similar to rewrite the path ( include File path). Hope it helps as a sample.
What I did:
Change the path in
/CPP-Concurrency-in-Action-2nd-Edition/guide.md
--- removing all the rest of/
beforecontent.
(BTW, so does theEnglish-level-up-tips
section)Create
alias
to replace routes (rewrite to the right md doc path
).window.$docsify = { alias:{ '\/CPP-Concurrency-in-Action-2nd-Edition.*(?:.*\/content\/(.*))': '/CPP-Concurrency-in-Action-2nd-Edition/content/$1' } }
Besides, correct the hash url in browser as well.
window.$docsify = { plugins: [ function(hook, vm){ hook.beforeEach(content=>{ const cpp = "\/CPP-Concurrency-in-Action-2nd-Edition.*(?:.*\/content\/(.*))" const regex = new RegExp(`^${cpp}$`) let path = window.location.hash && window.location.hash.substring(1) if(regex.test(path)){ path = '/CPP-Concurrency-in-Action-2nd-Edition/content/'+path.match(regex)[1] history.replaceState(null, null, `#${path}`); } }) } ] }
TBH, It works but so cumbersome... I suppose that restructure your project should be more practicable.
A-Programmers-Guide-to-English
is in the navbar. Both the navbar and the sidebar have the same issue. I believe that the problem is that docsify does not support multi-level directories. It would be great if it could directly support multi-level directories without requiring users to modify the file structure.Finally, thank you very much for your patient answer.
Hi @L-Super , I already raise the issue you mentioned with team members. This issue is on the roadmap ( the #1891 ), but it wouldn't be fixed very quickly since the compatibility and breaking release considerations in team. Sorry for the inconvenient.
Bug acknowledged. Tracking with #1891.
I placed this repo under the docs folder and renamed SUMMARY.md to guide.md, while my directory structure for docs is as follows:
index.html:
root guide.md:
Directory structure:
When I switch between different sections from the left side, the URL shows an incorrect path.
Current behaviour:
Expected behaviour:
Originally posted by @L-Super in https://github.com/docsifyjs/docsify/issues/1891#issuecomment-1936955686