4

In Sublime Text, the extension MarkdownEditing has an option to Set Syntax: Markdown GFM. This causes the markdown code fences to have a different background than the main editor background, making them easy to spot.

VS Code does not support Github flavored markdown, but I am wondering if there is another way to achieve the slight difference in background color for the code fences / blocks as seen below:

code block background

(the background difference is more pronounced on my screen than it is in the image)

singularity
  • 573
  • 4
  • 15
  • This question is a bit too broad for Stack Overflow. I can give you some directions and once you run into a *specific* problem, that should be eligible for a question to ask. Just like Sublime Text, VScode can use TextMate syntax definitions (`*.tmLanguage`). You would need to create a VScode extension based on that definition. Otherwise VScode will not know about code blocks. Once that's been taken care of, you can apply styles on code blocks. – idleberg Aug 01 '19 at 21:09
  • (continued) To define styles, you need to create a VSCode color theme that includes the scope for code blocks, as defined in the `tmLanguage` file. You can either use the built-in inspector (Help > Toggle Developer Tools) of place the cursor inside a code block, then run the VScode command *Developer: Inspect TM Scopes*. – idleberg Aug 01 '19 at 21:12
  • To sum it up: The rules for a language are defined in the syntax definitions (or grammar in VSCode speak), the styles for those rules are defined in the color theme. In your case, the grammar defines how to "detect" a code block, the theme applies a style to it. – idleberg Aug 01 '19 at 21:19

1 Answers1

0

You can use Markdown Color Plus extension for VS Code: https://marketplace.visualstudio.com/items?itemName=baincd.markdown-color-plus

Denis Stepanov
  • 90
  • 1
  • 10