/comment-formula

A VSCode Extensions to preview LaTex formulas within the line of your editor.

Primary LanguageTypeScriptMIT LicenseMIT


Comment Formula

Introduction

A VSCode Extensions to preview LaTex formulas within the line of your editor.

This project is based on vscode-iconify and uses markdown-it and markdown-it-mathjax3 to render formula.

Feature and Usage

You are supposed to write formula between $$ and $$ by default.

Fonts in the image are from monaspace.

  • The formula will be rendered in the message box when it is too large in partial inline mode, exceeding the line-height of your editor, similar to the second formula shown above
  • Note that multi-line formula won't be rendered in inline mode due to its height, you can simply hover it for a preview in the message box.

Configuration

  • comment-formula.inlineColor: The color of the rendered formula inline the editor. Default is auto.
  • comment-formula.messageColor: The color of the rendered formula in the message box. Default is auto.
  • comment-formula.inline: The inline mode of the rendered formula. Default is partial.
    • all: Render all formula in inline mode.
    • none: You can just hover on the formula to preview it.
    • partial: Render formula in inline mode if the formula isn't too large.
  • comment-formula.symbol: The symbol to wrap formula. Default is \\$.
    • \\$: $$x^2$$
    • @: @@x^2@@
    • #: ##x^2##
  • comment-formula.style: Style of formula code inline the editor. Options are underline, bold, italic, line-through and none. Default is bold.
  • comment-formula.enableLanguages: Enable comment-formula in these languages. LanguageId Reference. Default is ["c", "cpp", "python", "java"].

For example:

{
  "comment-formula.inlineColor": "#667466",
  "comment-formula.messageColor": "auto",  
  "comment-formula.inline": "partial",  
}

Known Issues

  • When you install or enable this extension, you may find that ms-python's connection to server got closed. Just restart VSCode and it will be fine.
  • Install this extension in VSCode may takes a long time, please be patient or try install it again. Installing it using .vsix file also works.