Skip to content

Commit

Permalink
fix(theme-common): code block magic comments should support SQL block…
Browse files Browse the repository at this point in the history
… comments (#10782)
  • Loading branch information
WillBlack403 authored Dec 20, 2024
1 parent 87a5ab9 commit 2565601
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/docusaurus-theme-common/src/utils/codeBlockUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
13 changes: 13 additions & 0 deletions website/_dogfooding/_pages tests/code-block-tests.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2565601

Please sign in to comment.