Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL block does not support block magic comments #10748

Closed
5 of 7 tasks
babyfish-ct opened this issue Dec 7, 2024 · 7 comments · Fixed by #10782
Closed
5 of 7 tasks

SQL block does not support block magic comments #10748

babyfish-ct opened this issue Dec 7, 2024 · 7 comments · Fixed by #10782
Labels
bug An error in the Docusaurus core causing instability or issues with its execution difficulty: starter Issues that are starter difficulty level, e.g. minimal tweaking with a clear test plan. good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. status: accepting pr This issue has been accepted, and we are looking for community contributors to implement this

Comments

@babyfish-ct
Copy link

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

I write sql code block like this

insert into BOOK(
    ID, NAME, EDITION, PRICE, STORE_ID
) values(?, ?, ?, ?, ?)
/* batch-0: [100, SQL in Action, 1, 59.9, 2] */
/* highlight-next-line */
/* batch-1: [7, LINQ in Action, 3, 49.9, 2] */

I used /* highlight-next-line */ to highlight the last line, but it is actually not highlighted

This magic comment works normally for all languages except sql.

Reproducible demo

No response

Steps to reproduce

Just write a code block

  • Language is SQL
  • Use highlight-next-line

Expected behavior

The next lien should be highlighted

Actual behavior

The next line is not highlighted

This bug only appears when language is SQL

Your environment

OS: Mac-M1
Docusaurus: 3.6.3
Node version: 22.2.0

Self-service

  • I'd be willing to fix this bug myself.
@babyfish-ct babyfish-ct added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Dec 7, 2024
@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label Dec 10, 2024
@slorber
Copy link
Collaborator

slorber commented Dec 10, 2024

Looks like we don't support multi-line comments for SQL, only single-line -- syntax.

This works:

```sql
insert into BOOK(
    ID, NAME, EDITION, PRICE, STORE_ID
) values(?, ?, ?, ?, ?)
/* batch-0: [100, SQL in Action, 1, 59.9, 2] */
-- highlight-next-line
/* batch-1: [7, LINQ in Action, 3, 49.9, 2] */
```

CleanShot 2024-12-10 at 11 28 52

I think it should be pretty easy to add SQL multi-line comments, if anyone from the community want to contribute that in packages/docusaurus-theme-common/src/utils/codeBlockUtils.ts

@slorber slorber added good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. status: accepting pr This issue has been accepted, and we are looking for community contributors to implement this difficulty: starter Issues that are starter difficulty level, e.g. minimal tweaking with a clear test plan. labels Dec 10, 2024
@Rajvardhan222
Copy link

I want to contribute to this is it still open ?

@slorber
Copy link
Collaborator

slorber commented Dec 12, 2024

You can submit a PR directly

@Rajvardhan222
Copy link

Rajvardhan222 commented Dec 14, 2024

i made the changes but how i test those by viewing them,so that i can confirm

@Josh-Cena
Copy link
Collaborator

@Josh-Cena Josh-Cena changed the title SQL block does not support magic comment SQL block does not support block magic comments Dec 14, 2024
@Rajvardhan222
Copy link

i am not sure how to view it even after changes it looks it is not taking effect
here is what i tried
added a new comment pattern
sql:{start:'/*',end:'*/'},

created a seprate case for sql inside getAllMagicCommentDirectiveStyles function

 case 'sql':
      return getCommentPattern(['sql','lua'], magicCommentDirectives);

@slorber
Copy link
Collaborator

slorber commented Dec 19, 2024

We can't help you without seeing a PR including all your code and how it renders in the Netlify preview sorry. Please submit a draft PR and we'll review your attempt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution difficulty: starter Issues that are starter difficulty level, e.g. minimal tweaking with a clear test plan. good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. status: accepting pr This issue has been accepted, and we are looking for community contributors to implement this
Projects
None yet
4 participants