From d7ed88fd9989233b68cc635c5faf1faab4c9b917 Mon Sep 17 00:00:00 2001 From: Rachael Sewell Date: Fri, 17 Mar 2023 12:01:46 -0700 Subject: [PATCH] feedback on CodeQL docs formatting (#35668) --- src/codeql-cli/lib/config.json | 11 +++++------ src/codeql-cli/scripts/sync.js | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/codeql-cli/lib/config.json b/src/codeql-cli/lib/config.json index 7ddf64bad8..f5ad763ce1 100644 --- a/src/codeql-cli/lib/config.json +++ b/src/codeql-cli/lib/config.json @@ -12,12 +12,11 @@ "CodeQL" ], "type": "reference", - "product": "{% data reusables.gated-features.code-scanning %}", - "autogenerated": "codeql-cli", - "allowTitleToDifferFromFilename": true + "product": "{% data reusables.gated-features.codeql %}", + "autogenerated": "codeql-cli" }, - "targetDirectory": "content/code-security/code-scanning/codeql-cli-manual", + "targetDirectory": "content/code-security/codeql-cli/codeql-cli-manual", "sourceDirectory": "semmle-code/documentation/restructuredtext/codeql-cli/manual", - "removeKeywords": ["[Plumbing]"], - "linterIgnore": ["content/code-security/code-scanning/codeql-cli-manual"] + "removeKeywords": [], + "linterIgnore": ["content/code-security/codeql-cli/codeql-cli-manual"] } diff --git a/src/codeql-cli/scripts/sync.js b/src/codeql-cli/scripts/sync.js index 0a79081304..84c3f0ad7f 100755 --- a/src/codeql-cli/scripts/sync.js +++ b/src/codeql-cli/scripts/sync.js @@ -96,6 +96,11 @@ async function main() { frontmatter.title = node.children[0].value } + // The level 2 heading "Options" should be displayed as "Primary options" + if (node.depth === 2 && node.children[0].value === 'Options') { + node.children[0].value = 'Primary options' + } + // There are some headings that include a title followed by // some markup that looks like // {#options-to-configure-the-package-manager.} @@ -254,9 +259,18 @@ async function main() { await writeFile(targetFilename, matter.stringify(markdownContent, frontmatter)) } - // update index.md file + // create or update the index.md file const indexFilepath = `${targetDirectory}/index.md` - const { data, content } = matter(await readFile(indexFilepath, 'utf-8')) + const { data, content } = existsSync(indexFilepath) + ? matter(await readFile(indexFilepath, 'utf-8')) + : { + data: { + title: 'placeholder', + ...frontmatterDefaults, + children: [], + }, + content: '', + } data.children = markdownFiles.map((file) => `/${path.basename(file, '.md')}`).sort() await writeFile(indexFilepath, matter.stringify(content, data)) }