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

Markdown: Shell fenced code block have incorrect synthax highlighting after indent #180246

Closed
adorade opened this issue Apr 18, 2023 · 4 comments
Closed
Assignees
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream

Comments

@adorade
Copy link

adorade commented Apr 18, 2023

I created a sh sample code with some comments inside a fenced code block, place it after an list item and then indent it.
If I indent the code block, the syntax highlighting loses its color.
The bug is in the markdown editor and preview.

Does this issue occur when all extensions are disabled?: YES

Basic Information

  • VS Code Version: 1.77.3 (user setup)
  • OS Version: Windows_NT x64 10.0.19045
  • Color Theme: Dark+ (default dark)

Steps to Reproduce:

  1. Open markdown file
  2. Create list
  3. Add a code block (see sample code below)
  4. See the result (see screenshots below)

Sample Code

1. List One

```sh
sudo apt-get purge --autoremove -y google-chrome-stable

# with alias
remove -y google-chrome-stable
```

1. List Two

    ```sh
    sudo apt-get purge --autoremove -y google-chrome-stable

    # with alias
    remove -y google-chrome-stable
    ```

1. List Three

    ```sh
        sudo apt-get purge --autoremove -y google-chrome-stable

        # with alias
        remove -y google-chrome-stable
    ```

Screenshots

Actual behavior

md-with-error

Expected behavior

md-with-good

@mjbvz mjbvz added the grammar Syntax highlighting grammar label Apr 18, 2023
@mjbvz
Copy link
Collaborator

mjbvz commented Apr 18, 2023

@alexr00 I suspect that the shell grammar may need to match not just on line start (^) but also on the last matching group (\G). We typically use (^|\\G) for this

@alexis-opolka
Copy link

Hi @mjbvz, would it be possible for me to work on this issue and submit a PR if I achieve to solve it?

@adorade
Copy link
Author

adorade commented Aug 30, 2023

@mjbvz @alexr00 any news on this?

@alexr00
Copy link
Member

alexr00 commented Aug 30, 2023

It looks like this is an issue with the markdown grammar. I've copied the issue to textmate/markdown.tmbundle#55, which is the repo that we get our markdown syntax highlighting grammar from.

@alexr00 alexr00 added the upstream-issue-linked This is an upstream issue that has been reported upstream label Aug 30, 2023
@alexr00 alexr00 closed this as completed Aug 30, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Oct 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream
Projects
None yet
Development

No branches or pull requests

4 participants