Description
GitHub and VS Code both render math within dollar signs, but GitHub has some known bugs when rendering math like this, such as omitting curly braces. One workaround is to double up on backslashes, but VS Code interprets these as line breaks. A more general solution is to use GitHub's alternative syntax which nests backticks inside of the dollar signs, but VS Code does not support that syntax, resulting in extraneous apostrophes.
Markdown code | GitHub render | VS Code render |
---|---|---|
$A = \{4, 2, 1, 3\}$ |
![]() |
![]() |
$A = \\{4, 2, 1, 3\\}$ |
![]() |
![]() |
$`A = \{4, 2, 1, 3\}`$ |
![]() |
![]() |
Thus, as far as I'm aware there is currently no way to author Markdown math in VS Code such that the preview shows what GitHub will eventually render. It would be nice if VS Code supported the same backtick math syntax that GitHub supports, especially since it is already also supported by other platforms like GitLab.