Skip to content

Commit

Permalink
Cleanup: remove now-redundant cleaning code
Browse files Browse the repository at this point in the history
With the new version of docusaurus OpenAPI plugin, sidebar_labels and
titles are now quoted correctly, removing the need for this extra bit
of code.
  • Loading branch information
thomasheartman committed Nov 11, 2022
1 parent 4c268cf commit c7c2252
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions website/clean-generated-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,14 @@
// save us loooots of questions.
const replace = require('replace-in-file');

const escapeCharacters = (input) => {
unquotedInput =
input.charAt(0) === '"' ? input.substring(1, input.length - 1) : input;
const fixed = unquotedInput.replace(/(?<!\\)"/g, '\\"');
return `"${fixed}"`;
};

const options = {
files: 'docs/reference/api/**/*.api.mdx',
from: [
/\/ushosted/g,
/"https:\/\/us.app.unleash-hosted.com(\/ushosted)?"/g,
'"path":["ushosted",',
/^(sidebar_label|title): (.+)/gm, // escape potentially unescaped, single-line text fields
],
to: [
'',
'"<your-unleash-url>"',
'"path":[',
(_, key, description) => `${key}: ${escapeCharacters(description)}`,
],
to: ['', '"<your-unleash-url>"', '"path":['],
};

replace(options);

0 comments on commit c7c2252

Please sign in to comment.