After that there is not much trouble implementing multiple repos.
Changes
There are couple of things that I changed during the course.
rewrote getSideBarByToc function at lib/getSideBar.js
I basically rewrote this function because the old one has bug and it's hard to fix the bug within the old code.
The old function has a problem recognizing a node's position in the tree. If the depth of previous node is greater than current node by more than 1, its position will be messed up.
take this doc's sidebar for example: https://www.yuque.com/zhoufan-jaod3/cd1bqa/zwcaqw
the original sidebar from yuque should be like this:
the pic below shows the generated sidebar of the old and the new function side by side
the left one is using the old function which is incorrect
the right one is the result of the new function
I'm considering adding more unit tests for the new function.
parse the body as markdown when format is lake
I came across some docs where the format is lake, and it would parse data.body_html instead of data.body. In this case the build command will emit compile error and fail , so I have to treat lake format as markdown to get around it. I don't know the initial motive of this design, so I think I need some opinion on whether this change would break anything.
portal to that line: https://github.com/ulivz/vuepress-plugin-yuque/pull/14/files#r303388389
Usage
As title suggested, this PR is aimed to add new capability to extract and display multiple doc repos at the same time.
To Achieve that, I added new options for multiple repos supports:
multiRepoUrls
example:So for each repo, you have to assign a unique
repoRoute
, which will be added into router.Design
So one of the obstacles is to resolve multiple sidebar.
Luckily vuepress supports multiple sidebar: https://v1.vuepress.vuejs.org/theme/default-theme-config.html#multiple-sidebars
which is why the new option requires
repoRoute
as an input.After that there is not much trouble implementing multiple repos.
Changes
There are couple of things that I changed during the course.
rewrote
getSideBarByToc
function atlib/getSideBar.js
I basically rewrote this function because the old one has bug and it's hard to fix the bug within the old code.![origin](https://user-images.githubusercontent.com/5846753/61204870-03bd2e80-a721-11e9-9ef3-e51f82162aff.jpg)
The old function has a problem recognizing a node's position in the tree. If the depth of previous node is greater than current node by more than 1, its position will be messed up. take this doc's sidebar for example: https://www.yuque.com/zhoufan-jaod3/cd1bqa/zwcaqw the original sidebar from yuque should be like this:
the pic below shows the generated sidebar of the old and the new function side by side
the left one is using the old function which is incorrect
the right one is the result of the new function
I'm considering adding more unit tests for the new function.
parse the body as
markdown
when format islake
I came across some docs where the format is
lake
, and it would parsedata.body_html
instead ofdata.body
. In this case the build command will emit compile error and fail , so I have to treatlake
format asmarkdown
to get around it. I don't know the initial motive of this design, so I think I need some opinion on whether this change would break anything. portal to that line: https://github.com/ulivz/vuepress-plugin-yuque/pull/14/files#r303388389