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

docs: fix <code> in header ids #15159

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions scripts/website.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ function moveDocsToTemp() {
}
}

/**
/**
* Array of array of semver numbers, sorted with highest number first
* @example
* [[1,2,3], [0,1,2]]
* @type {number[][]}
* @type {number[][]}
*/
let filteredTags = [];

Expand Down Expand Up @@ -238,16 +238,16 @@ function getVersions() {
* Stringify a semver number array
* @param {number[]} arr The array to stringify
* @param {boolean} dotX If "true", return "5.X" instead of "5.5.5"
* @returns
* @returns
*/
function stringifySemverNumber(arr, dotX) {
if (dotX) {
return `${arr[0]}.x`;
return `${arr[0]}.x`;
}
return `${arr[0]}.${arr[1]}.${arr[2]}`;
}

/**
/**
* Get the latest version available
* @returns {Version}
*/
Expand Down Expand Up @@ -422,7 +422,7 @@ function mapURLs(block, currentUrl) {
* @param {String} filename The documentation file path to render
* @param {import("../docs/source/index").DocsOptions} options The options to use to render the file (api may be overwritten at reload)
* @param {Boolean} isReload Indicate this is a reload of the file
* @returns
* @returns
*/
async function pugify(filename, options, isReload = false) {
/** Path for the output file */
Expand Down Expand Up @@ -502,7 +502,7 @@ async function pugify(filename, options, isReload = false) {
}

str = mapURLs(str, '/' + path.relative(cwd, docsPath))

await fs.promises.writeFile(newfile, str).catch((err) => {
console.error('could not write', err.stack);
}).then(() => {
Expand Down Expand Up @@ -624,5 +624,5 @@ function createSlug(value) {
return '';
}
value = value.toLowerCase();
return value.replace(/[^a-z0-9-_\s]/, '').replace(/ /g, '-');
}
return value.replace(/<\/?code>/g, '').replace(/[^a-z0-9-_\s]/g, '').replace(/ /g, '-');
}