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

Ability to render documentation versions from git branch or tag #341

Open
alek13 opened this issue Jan 5, 2018 · 11 comments
Open

Ability to render documentation versions from git branch or tag #341

alek13 opened this issue Jan 5, 2018 · 11 comments
Milestone

Comments

@alek13
Copy link
Contributor

alek13 commented Jan 5, 2018

It would be awesome to have options to:

  • render from only specified branches/tags
  • specify url prefix for document version
  • render some switcher (like for translations in _navbar.md)

something like this:

window.$docsify = {
    // ...
    versions: {
        'master': 'latest', // <-- branch 'master' will render by accessing url '/en/latest'
        '1.5.1': '1.0',     // <-- its just the tag '1.5.1' in git & no branch created (url '/en/1.0')
        '2.0': '2.0'        // <-- this is created branch (url '/en/2.0')
    }
    // ...
}
@jsmedmar
Copy link

@QingWei-Li thanks for such a great tool. I was wondering you have think about providing this support and even whether or not its possible. I was looking at git worktree or git submodules as ways around it, but i think support needs to come from core docsify library. Anyways, just checking and thank you again!

@sagnihotri-cohesity
Copy link

This would be a very valuable feature.

@jsmedmar
Copy link

Btw, this could be solved by github itself. I created this ticket:
isaacs/github#1348. If many people like it or we email github it could happen.

@timaschew
Copy link
Member

This can work theoretically:

  • if the repository is public available
  • if the source files can be served with proper MIME type (using raw.githubusercontent.com)
  • but you need to provide the map (version -> branch) manually

@IAmNatch
Copy link

Given that there hasn't been much movement on this, perhaps there's an easier way to handle versioning? I think versioning is very important for any full featured documentation set.

Docusaurus has a very reasonable versioning system.

Here the file layout would read:

.
└── docs
     └──1.0.1
         ├── README.md
         ├── guide.md
    └── 1.0.0
        ├── README.md
        └── guide.md

It is a breaking change, but I think it could prove quite manageable.

@anikethsaha
Copy link
Member

This is something I really want for our next version.
I will add this in our roadmap as a discussion. It involves the cli as well.

@IAmNatch
Copy link

@anikethsaha Amazing. Please let me know the best way to contribute! I'd be happy to help along the way with a little direction from someone closer to the project.

@anikethsaha
Copy link
Member

@anikethsaha Amazing. Please let me know the best way to contribute! I'd be happy to help along the way with a little direction from someone closer to the project.

Glad to hear 💯

Currently I have very rough approach for this but I am open to new approaches. So it would be great if you can comment your approach if you have in the roadmap issue.

And also, there will be many ways to contribute in this. just keep an eye in it. Everything will be discussed in issues and then it will be implemented

@arthurfiorette
Copy link

@anikethsaha It's been a while, does docsify still have plans to this?

@trusktr
Copy link
Member

trusktr commented Jan 12, 2022

The sentiment is that this would be nice, but it has not been implemented yet. Also, we need a plan. How do you imagine it could work?

Perhaps a new option configures alternate versions of the docs? For example:

window.$docsify = {
  versions: {
    "v1": "path/to/v1",
    "v2": "path/to/v2",
    "rc": "path/to/rc",
    "nightly": "path/to/nightly",
  },
}

then these effectively become base paths that switch which folders file are read from. The upside is this is easy, and works without any version control system. The downside is that there will be duplication from version to version across the folders, and with this option there is no automation (but we need something that can be done manually before we automate it with a CLI). So people with version control will have a growing repo for every version they publish.

Another idea could be to make a plugin that loads content from GitHub based on the given tag:

window.$docsify = {
  repo: "https://github.com/docsifyjs/docsify",
  basePath: "https://raw.githubusercontent.com/docsifyjs/docsify/main/README.md"
  plugins: [GitHubVersionsPlugin(['v4.0.0', 'v4.1.1'])],
}

then the plugin would take your repo URL and look for the tags v4.0.0 and v4.1.0 using URLs like https://raw.githubusercontent.com/docsifyjs/docsify/v4.0.0/README.md, https://raw.githubusercontent.com/docsifyjs/docsify/v4.1.0/README.md, etc.

There can also be an option to have it automatically fetch the list of versions. This way people can customize which version to show, or automatically show all.

Maybe we provide both types of options, because some people may not use a git or GitHub, and may not even use version control, but would still like to make versions by hand like v1, v2, etc.

@keiyin-wong
Copy link

The sentiment is that this would be nice, but it has not been implemented yet. Also, we need a plan. How do you imagine it could work?

Perhaps a new option configures alternate versions of the docs? For example:

window.$docsify = {
  versions: {
    "v1": "path/to/v1",
    "v2": "path/to/v2",
    "rc": "path/to/rc",
    "nightly": "path/to/nightly",
  },
}

then these effectively become base paths that switch which folders file are read from. The upside is this is easy, and works without any version control system. The downside is that there will be duplication from version to version across the folders, and with this option there is no automation (but we need something that can be done manually before we automate it with a CLI). So people with version control will have a growing repo for every version they publish.

Another idea could be to make a plugin that loads content from GitHub based on the given tag:

window.$docsify = {
  repo: "https://github.com/docsifyjs/docsify",
  basePath: "https://raw.githubusercontent.com/docsifyjs/docsify/main/README.md"
  plugins: [GitHubVersionsPlugin(['v4.0.0', 'v4.1.1'])],
}

then the plugin would take your repo URL and look for the tags v4.0.0 and v4.1.0 using URLs like https://raw.githubusercontent.com/docsifyjs/docsify/v4.0.0/README.md, https://raw.githubusercontent.com/docsifyjs/docsify/v4.1.0/README.md, etc.

There can also be an option to have it automatically fetch the list of versions. This way people can customize which version to show, or automatically show all.

Maybe we provide both types of options, because some people may not use a git or GitHub, and may not even use version control, but would still like to make versions by hand like v1, v2, etc.

Is it something like this?

The source sode -> https://github.com/keiyin-wong/docsify-version-plugin

The example website -> https://keiyin-wong.github.io/docsify-version-plugin-doc-example/docs/#/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests