# This function was added in version 1.0.0. By giving it the @added 1.0.0
# tag, it will only be included in pages with version 0.1.0 and later
@function myFunction
@added 0.1.0
@description
# Versioned content provides alternative versions of content for
# different versions. Between versions, the content does not change -
# for example, for version 0.1.1, the description will still be
# "Description 1"
@versioned
@version 0.1.0: Description 1
@version 0.2.0: Description 2
@arg x [Number]
@description
Some Description
# Only included in versions 0.2.0 and later, and gets removed after 0.4.0
@arg y [Number]
@added 0.2.0
@deprecated 0.3.0
@removed 0.4.0
@description
@versioned
@version 0.2.0: Description 1
@version 0.4.0: Description 2@added, @deprecated and @removed tags are used in @api sections, and have the following meanings: @added tag indicates that some content should only be included from the version specified onwards. @deprecated tag indicates that something is going to be removed (from an api), and should no longer be used. @removed tag indicates that the something was removed. The entity with this tag will remain on the page for the version given, but will not be included for versions greater than the version specified. require('quantum-version').
For information about different versions, see the Changelog target/api/index.html becomes target/api/0.1.0/index.html function filenameModifier (fileInfo, version) {
if (fileInfo.dest.endsWith('index.um')) {
return fileInfo.clone({
dest: fileInfo.dest.replace('index.um', version) + '/' + 'index.um'
})
} else {
return fileInfo.clone({
dest: fileInfo.dest.replace('.um', '') + '/' + version + '.um'
})
}
}target/api/1.0.0/index.html
target/api/1.1.0/index.html
target/api/1.2.0/index.html
target/api/index.html <- The same as target/api/1.2.0/index.htmltarget/api/1.0.0/index.html
target/api/1.1.0/index.html
target/api/1.2.0/index.htmltrue@versionedPage
@version 2.0.0
@api
@function myFunction
@added 2.0.0
@description
The content of the description block will be shown in the api
section.
@arg a [Number]
@arg b [number]
@return Numberdeprecated tag will sit before a @removed tag. @versionedPage
@version 2.0.0
@api
@function myFunction
@deprecated 2.0.0
@description
The content of the description block will be shown in the api
section.
@arg a [Number]
@arg b [number]
@return Number@versionedPage
@version 2.0.0
@api
@function myFunction
@removed 2.0.0
@description
The content of the description block will be shown in the api
section.
@arg a [Number]
@arg b [number]
@return Number@versionedPage
@version 2.0.0
@api
@function myFunction
@updated 2.0.0
@description
The content of the description block will be shown in the api
section.
@arg a [Number]
@arg b [number]
@return Number@versionedPage
@version 1.0.0
@version 1.1.0
@version 2.0.0
@versionList@versionList
@version 1.0.0
@version 1.1.0
@version 2.0.0
@current 1.0.0@versionList
@version 1.0.0
@version 1.1.0
@version 2.0.0
@current 1.1.0@versionList
@version 1.0.0
@version 1.1.0
@version 2.0.0
@current 2.0.0@versionedPage
@version 1.0.0
@version 1.1.0
@version 2.0.0
@versioned
@version 1.0.0: Description 1
@version 2.0.0: Description 2Description 1Description 1Description 2fileTransform. Any pages without this entity will pass through the version file transform untouched. version.fileTransform() in the quantum.config.json.
@versionedPage@versionedPage
@version 1.0.0
@version 1.1.0
@version 1.2.0
@version 1.2.1
@version 1.3.0
@version 2.0.0@versionedPage
@inline ./versions.um@version 1.0.0
@version 1.1.0
@version 1.2.0
@version 1.2.1
@version 1.3.0
@version 2.0.0@added and @removed tags for the version specified. @updated and @deprecated tags are removed if they do not apply to the version passed in. @versionList entities in the entity passed in (recursively), and populates them with the full list of versions for the page, as well as the current version. @versionedPage
@version 1.0.0
@version 1.1.0
@version 2.0.0
@versionList@versionList
@version 1.0.0
@version 1.1.0
@version 2.0.0
@current 1.0.0@versionList
@version 1.0.0
@version 1.1.0
@version 2.0.0
@current 1.1.0@versionList
@version 1.0.0
@version 1.1.0
@version 2.0.0
@current 2.0.0@versioned sections in the entity passed in. This removes all @versioned sections from the entity (recursively) and replaces then with the correct content for the version given. const version = require('quantum-version')
const entity = {
params: [],
content: [
{
type: 'versioned',
params: [],
content: [
{
type: 'version',
params: ['0.1.0'],
content: [
"Content1"
]
},
{
type: 'version',
params: ['0.3.0'],
content: [
"Content2"
]
}
]
}
]
}
const versions = ['0.1.0', '0.2.0', '0.3.0']
version.processVersioned(entity, '0.1.0', versions)
console.log(entity)
// { params: [], content: ['Content1'] }
version.processVersioned(entity, '0.2.0', versions)
console.log(entity)
// { params: [], content: ['Content1'] }
version.processVersioned(entity, '0.3.0', versions)
console.log(entity)
// { params: [], content: ['Content2'] }