From 44516785355a55918f166ed930d7192ad77ff917 Mon Sep 17 00:00:00 2001 From: Rachael Sewell Date: Fri, 21 Jul 2023 09:32:40 -0700 Subject: [PATCH] Use Markdown styles in CodeQL pipeline (#39408) --- src/codeql-cli/scripts/convert-markdown-for-docs.js | 3 ++- .../lib/helpers/unified-formatter-options.js | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/content-linter/lib/helpers/unified-formatter-options.js diff --git a/src/codeql-cli/scripts/convert-markdown-for-docs.js b/src/codeql-cli/scripts/convert-markdown-for-docs.js index 4a5272065a..51783a253f 100644 --- a/src/codeql-cli/scripts/convert-markdown-for-docs.js +++ b/src/codeql-cli/scripts/convert-markdown-for-docs.js @@ -8,6 +8,7 @@ import { visit, SKIP } from 'unist-util-visit' import { remove } from 'unist-util-remove' import { languageKeys } from '../../../lib/languages.js' +import { MARKDOWN_OPTIONS } from '../../content-linter/lib/helpers/unified-formatter-options.js' const { targetDirectory, removeKeywords } = JSON.parse( await readFile(path.join('src/codeql-cli/lib/config.json'), 'utf-8'), @@ -217,7 +218,7 @@ export async function convertContentToDocs(content, frontmatterDefaults = {}) { // remove the first heading from the AST because that becomes frontmatter remove(ast, (node) => node.type === 'heading' && node.depth === 1) - return { content: toMarkdown(ast), data: frontmatter } + return { content: toMarkdown(ast, MARKDOWN_OPTIONS), data: frontmatter } } // performs a get request for a aka.ms url and returns the redirect url diff --git a/src/content-linter/lib/helpers/unified-formatter-options.js b/src/content-linter/lib/helpers/unified-formatter-options.js new file mode 100644 index 0000000000..ecbd2d60b3 --- /dev/null +++ b/src/content-linter/lib/helpers/unified-formatter-options.js @@ -0,0 +1,9 @@ +export const MARKDOWN_OPTIONS = { + bullet: '-', + emphasis: '_', + closeAtx: false, + fence: '`', + fences: true, + incrementListMarker: false, + strong: '*', +}