Add Markdown support by markdown-it-texmath#56
Open
PaulEibensteiner wants to merge 3 commits intomattbierner:masterfrom
Open
Add Markdown support by markdown-it-texmath#56PaulEibensteiner wants to merge 3 commits intomattbierner:masterfrom
PaulEibensteiner wants to merge 3 commits intomattbierner:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


TLDR: Adds latex math support to the preview using markdown-it, markdown-it-texmath and katex (using katex css).
The default preview does not support math because of latency issues that the visual studio code team does not want on hover windows. Since this docs-view is not a hover, I think the latency is not an issue. One downside is, that we need to use a different markdown library than visual studio code uses for the preview, since marked does not support math. This may lead to unintentional differences between the hover view and the panel view.
Another unfortunate current state is that Pylance converts reST math (the standard for docstrings) to markdown code blocks. Therefore this will not be able to render reST math in the default state, because there is no way for this extension to differentiate between a normal code block and a code block that was converted from math. There are two workarounds: 1. Use the Jedi language server, which correctly returns reST math as markdown math. 2. Write your documentation in markdown, s.t. the language server does not alter the markup since it expects reST.
This is potentially a solution to this vscode issue, this reddit thread, this stackoverflow question and even potentially for some people currently using pycharm, so I think even with the caveats mentioned it is a valuable contribution for many scientific and mathematic programmers out there.
Example previewing
scipy.special.softmax