简体   繁体   English

如何支持docusaurus维护的旧版本文档中的更改

[英]How to support changes in older versions of docs maintained by docusaurus

I'm trying out Docusaurus tool for creating a documentation site. 我正在尝试使用Docusaurus工具来创建文档站点。 So far everything is okay until I came to Versioning . 到目前为止,一切正常,直到我来到Versioning为止。

My understanding is that: 我的理解是:

  1. Whatever is in your /docs/**/*.md is your latest docs for next release /docs/**/*.md是您下一版本的最新文档
  2. Previous versions of your docs are available in /website/versioned-docs/version-${version-number} directory 您的文档的先前版本可在/website/versioned-docs/version-${version-number}目录中找到

What is not clear to me is that how do I maintain/publish changes to previous versions? 我不清楚我该如何维护/发布对先前版本的更改? My changes in /docs/** directory is not ready for publishing yet. 我在/docs/**目录中/docs/**更改尚未准备好发布。 So, what is the mechanism for maintaining changes to older version of docs? 那么,维护对旧版本文档所做更改的机制是什么?

Also, the documentation of Docusaurus says following: 另外,Docusaurus的文档还说明以下内容:

Fallback Functionality 后备功能

Only files in the docs directory and sidebar files that differ from those of the latest version will get copied each time a new version is specified. 每次指定新版本时,只会复制docs目录中的文件和侧边栏文件中与最新版本不同的文件。 If there is no change across versions, Docusaurus will use the file from the latest version with that file. 如果版本之间没有变化,Docusaurus将使用该文件的最新版本。

For example, a document with the original id doc1 exists for the latest version, 1.0.0, and has the same content as the document with the id doc1 in the docs directory. 例如,对于最新版本1.0.0,存在原始ID为doc1的文档,并且其内容与docs目录中具有ID doc1的文档相同。 When a new version 2.0.0 is created, the file for doc1 will not be copied into versioned_docs/version-2.0.0/. 创建新版本2.0.0时,不会将doc1的文件复制到versioned_docs / version-2.0.0 /中。 There will still be a page for docs/2.0.0/doc1.html, but it will use the file from version 1.0.0. 仍然会有docs / 2.0.0 / doc1.html的页面,但是它将使用版本1.0.0的文件。

https://docusaurus.io/docs/en/versioning#fallback-functionality https://docusaurus.io/docs/zh-CN/versioning#fallback-functionality

So, let's say I now need to maintain/update a doc of a previous version but that file was not duplicated because at the time the new version was created, there wasn't any changes to this particular file. 因此,假设我现在需要维护/更新先前版本的文档,但是该文件没有重复,因为在创建新版本时,对该特定文件没有任何更改。 Now, what is the process? 现在,过程如何? Do I manually copy the necessary file into /website/versioned-docs/version-${version-number} directory and then make my changes? 是否手动将必要的文件复制到/website/versioned-docs/version-${version-number}目录中,然后进行更改?

Docusaurus maintainer here. Docusaurus的维护者在这里。 Due to the way versioning is implemented, there's no easy way of updating previous versions in V1. 由于版本控制的实现方式,在V1中没有简单的方法来更新以前的版本。 You might not want to update previous versions as a version should be frozen when published and updates should be made to new versions. 您可能不希望更新以前的版本,因为发布时应冻结一个版本,而应对新版本进行更新。

But if you insist, you can always edit the generated files under the versioned_docs/version-XXX directories. 但是,如果您坚持要求,则始终可以在versioned_docs/version-XXX目录下编辑生成的文件。 However, I would recommend making changes to the latest version and encouraging your users to upgrade to the latest version. 但是,我建议您对最新版本进行更改,并鼓励您的用户升级到最新版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM