microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.79k stars 29.12k forks source link

When a Markdown file contains a YAML block in a bullet point, comments do not have the right syntax highlighting #182458

Open mtkennerly opened 1 year ago

mtkennerly commented 1 year ago

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

Steps to Reproduce:

  1. Create a Markdown file with this content:
# Baseline
```yaml
# foo
```

# Indented
  ```yaml
  # foo
  ```

# Bullet point
* ```yaml
  # foo
  ```
  1. Notice that the comment in the bullet point is not highlighted like the others:

    image
mjbvz commented 10 months ago

@alexr00 I believe the root cause is that the yaml grammar uses ^ for most of it's rules. To handle cases where it is embedded, we should use (^|\G) instead