microsoft / vscode

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

Markdown: Syntax highlighting not displaying correctly #3692

Closed DaveyD closed 8 years ago

DaveyD commented 8 years ago

I've been writing markdown files in VScode recently, and I'm enjoying very much. I'm having an issue with the preview display: I can't get get syntax highlighting for code to work. In markdown view, the syntax highlighting does work, but in preview it just shows up as plain text in a gray box. (I am currently specifically looking for VB)


Here is a screenshot of what I am seeing. You can see that on the left side, I am getting syntax highlighting for Python, but not for VBnet, and on the right side, I am not getting any syntax highlighting.

mjbvz commented 8 years ago

Just looking into this bug a little, it looks like some languages (css, php, html) are correctly syntax highlighted in the preview, while most others are not:

screen shot 2016-03-07 at 3 13 57 pm

Syntax highlighting in the preview and the editor also do not always match. For example, php gets highlighted in the preview but not the editor, and python gets highlighted in the editor but not the preview (this may be expected behavior).

bpasero commented 8 years ago

Yes, we have some inconsistency. Plan to fix this when markdown gets moved to its own extension.

mattacosta commented 8 years ago

One of those inconsistencies is PHP only working when there is an open tag. It's not required for markdown highlighting:

// Does not have "<?php" tag.
if (1 + 2) {
  $x = 3;
}
nchammas commented 8 years ago

I'm having this issue as well with Python inside Markdown code blocks. It highlights correctly in the editor, but in the preview it doesn't highlight at all.

bpasero commented 8 years ago

Please reopen if you still see this with our new markdown extension we ship in June.

dbaeumer commented 8 years ago

Verified using simple python and php examples.

colhountech commented 8 years ago

Is there something different I have to do to "switch-on" for c#. Seems to work for Java but not c#

vscode-insider

Running 1.3.0-insider with the c# extension 1.0.3-rc2

I have .NET Core RC2 Preview1 and .NET Core 1.0.0 RTM Preview 2 installed if that helps.

jods4 commented 8 years ago

Works for me after upgrade to 1.3 (tested on Typescript and Html)! 👍

One question, though: is there a way to change the default color scheme? As can be seen above, the theme is not the same in MD editor (or VS Code generally) and in the preview and honestly... the default theme in preview is too much Skittles for me 😒