Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question : working with overrides, sourcePath and their default behavior #272

Open
sebinbenjamin opened this issue Nov 18, 2019 · 1 comment
Open
Labels

Comments

@sebinbenjamin
Copy link

@sebinbenjamin sebinbenjamin commented Nov 18, 2019

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

  1. sourcePath is NOT getting overridden for versions v1 as well as v2.
  2. /v1/, /v2/ is getting appended to the common sourcePath, 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 #244, #237 and #245. I could not understand any solution mentioned in those.

Any feedback on this is highly appreciated!


Update

const result = sourcePath + path
I guess the code says that the sourcePath will always be appended. So the question remaining is why the overides are not working.

@issue-label-bot

This comment has been minimized.

Copy link

@issue-label-bot issue-label-bot bot commented Nov 18, 2019

Issue-Label Bot is automatically applying the label question to this issue, with a confidence of 0.95. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@issue-label-bot issue-label-bot bot added the question label Nov 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.