Do you want to work on this issue?
You can request for a bounty in order to promote it!
Question : working with overrides, sourcePath and their default behavior #272
sebinbenjamin posted onGitHub
How do I setup docute to work with git version tags?
Against intuition, the default behaviour seems to be that the version link is appended to the sourcePaths
. For example, selecting v1
in the following code would resolve to https://raw.githubusercontent.com/sebinbenjamin/docute-demo/v1/README.md.
sourcePath: 'https://raw.githubusercontent.com/sebinbenjamin/docute-demo/',
versions: {
'v2': {
link: '/',
},
'v1': {
link: '/v1/',
}
...
}
sidebar: [
{
title: 'Home',
link: '/'
},
...
]
}
However, the default case (latest/stable or master branch) would give a 400/404 error (https://raw.githubusercontent.com/sebinbenjamin/docute-demo/README.md). Thus I believe we cannot use it as above (without overrides
).
So I am thinking of using overrides
on sourcePath
to solve this issue, but I do not understand how to proceed.
sourcePath: 'https://raw.githubusercontent.com/sebinbenjamin/docute-demo/master',
overrides : {
{
'/v2/': {
sourcePath: 'https://raw.githubusercontent.com/sebinbenjamin/docute-demo/v2/',
},
'/v1/': {
sourcePath: 'https://raw.githubusercontent.com/sebinbenjamin/docute-demo/v1/',
},
},
versions: {
'v3 (latest)': {
link: '/',
},
'v2': {
link: '/v2/',
},
'v1': {
link: '/v1/',
}
...
},
sidebar: [
{
title: 'Home',
link: '/'
},
...
]
}
In the above code, for some reason, I observe that
- sourcePath is NOT getting overridden for versions
v1
as well asv2
. /v1/
,/v2/
is getting appended to the commonsourcePath
, resulting in https://raw.githubusercontent.com/sebinbenjamin/docute-demo/master/v1/README.md which doesn't exist.
Thus only the default version v3 (latest)
works using the default sourcePath
.
How can I get this to work? Here my example code, hosted on netlify.
I could not figure out my mistake from the docs and other issues. I'm guessing this issue is related to https://github.com/egoist/docute/issues/244, https://github.com/egoist/docute/issues/237 and https://github.com/egoist/docute/issues/245. I could not understand any solution mentioned in those.
Any feedback on this is highly appreciated!
Update
https://github.com/egoist/docute/blob/c4d2bf9881d6a8fecf275395c0c0e5e88eeb49ca/src/utils/index.js#L24 I guess the code says that the sourcePath will always be appended. So the question remaining is why the overides
are not working.