Version Extraction Algorithm
The Starlight Latest Version plugin fetches the latest release of your package as specified in the source configuration option.
Regex Pattern
Section titled “Regex Pattern”The Starlight Latest Version plugin uses a regex pattern to extract the version (and prerelease). The default pattern is:
/^(?:v|[^0-9\s]*@)?v?(?<version>[0-9]+\.[0-9]+\.[0-9]+)(?:-(?<prerelease>[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*))?(?![-.]|[^-\w.])$/;You can override the pattern using the regexPattern configuration option.
Supported tag_names
Section titled “Supported tag_names”The tag_name can be one of the following formats which will produce these badges:
1.2.3→ v1.2.310.20.30→ v10.20.30v1.2.3→ v1.2.3release@1.2.3→ v1.2.3name@v1.2.3→ v1.2.3package-name@1.2.3→ v1.2.3feature/branch@1.2.3→ v1.2.31.2.3-rc.1→ v1.2.3-rc.1name@1.2.3-beta.2→ v1.2.3-beta.2v1.2.3-alpha.34→ v1.2.3-alpha.34package-name@1.2.3-rc.1→ v1.2.3-rc.11.2.3-alpha→ v1.2.3-alpha1.2.3-beta→ v1.2.3-beta1.2.3-rc→ v1.2.3-rc1.2.3-feature.test→ v1.2.3-feature.test1.2.3-long.complex.prerelease.tag→ v1.2.3-long.complex.prerelease.tag
Invalid tag_names
Section titled “Invalid tag_names”Here are examples of tag_name formats which would not be supported by the default version extraction algorithm:
1.2→ no semantic versioning because it is missing the third numberv1.2→ no semantic versioning because it is missing the third number1.2.→ invalid version format, incompletev1.2.→ invalid version format, incomplete1.2.3.4→ too many version segments1.2.3.→ invalid version format, trailing dotv1.2.3.4→ too many version segments1.2.3-→ invalid prerelease format1.2.3-.rc→ invalid prerelease format1.2.3-rc.→ invalid prerelease format1.2.3--rc→ invalid prerelease formatrandom-text→ non-version string→ empty string123→ non-version stringv1.2.3-special!char→ invalid version format with special characters1.2.3-pre release→ invalid version format due to space