From d6e1aab7d097e04830a605d0bc57d8106fdd7563 Mon Sep 17 00:00:00 2001 From: "William.Black" Date: Thu, 19 Dec 2024 11:51:32 -0700 Subject: [PATCH 1/2] fix(theme-common): SQL magic block comments. Add jsBlock comment style to sql code block. --- packages/docusaurus-theme-common/src/utils/codeBlockUtils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/docusaurus-theme-common/src/utils/codeBlockUtils.ts b/packages/docusaurus-theme-common/src/utils/codeBlockUtils.ts index 3d545655f673..f93ef96be7c9 100644 --- a/packages/docusaurus-theme-common/src/utils/codeBlockUtils.ts +++ b/packages/docusaurus-theme-common/src/utils/codeBlockUtils.ts @@ -107,9 +107,11 @@ function getAllMagicCommentDirectiveStyles( case 'lua': case 'haskell': - case 'sql': return getCommentPattern(['lua'], magicCommentDirectives); + case 'sql': + return getCommentPattern(['lua', 'jsBlock'], magicCommentDirectives); + case 'wasm': return getCommentPattern(['wasm'], magicCommentDirectives); From 30a7f463fa0399e1b7de4ce7b7e4357b5c7e481f Mon Sep 17 00:00:00 2001 From: "William.Black" Date: Fri, 20 Dec 2024 08:53:06 -0700 Subject: [PATCH 2/2] fix(theme-common): SQL magic block comments. Added test in https://docusaurus.io/tests/pages/code-block-tests#magic-comments-tests Using block comment style. --- .../_dogfooding/_pages tests/code-block-tests.mdx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/website/_dogfooding/_pages tests/code-block-tests.mdx b/website/_dogfooding/_pages tests/code-block-tests.mdx index 6c294b11c38a..83454500f7b2 100644 --- a/website/_dogfooding/_pages tests/code-block-tests.mdx +++ b/website/_dogfooding/_pages tests/code-block-tests.mdx @@ -358,6 +358,19 @@ WHERE customer_id IN ( ) ``` +```sql title="sql_query_block.sql" +/* highlight-start */ +SELECT * +FROM orders +/* highlight-end */ +WHERE customer_id IN ( + SELECT customer_id + /* highlight-next-line */ + FROM customers + WHERE country = 'USA' +) +``` + ```matlab title="matlab.m" % highlight-start function result = times2(n)