microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.29k stars 292 forks source link

Not render LaTeX in notebook markdown cells #9105

Closed Beau-xu closed 2 years ago

Beau-xu commented 2 years ago

Applies To

What happened?

It does not render LaTeX in notebook markdown cells

image

VS Code Version

Version: 1.64.2 (user setup) Commit: f80445acd5a3dadef24aa209168452a3d97cc326 Date: 2022-02-09T22:02:28.252Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.19042

Jupyter Extension Version

v2022.1.1301854968

Jupyter logs

No response

Coding Language and Runtime Version

Python 3.8.8

Language Extension Version (if applicable)

v2022.0.1814523869

Anaconda Version (if applicable)

conda 4.10.3

Running Jupyter locally or remotely?

Local

IanMatthewHuff commented 2 years ago

@Beau-xu Hmm, I'm peeking at this right now and I'm not reproing the same. For the same cell as you I get this result:

image

Escape edit mode to render:

image

The rendering that you have looks a bit odd, like it's trying to render that as a code cell (with input an output) as opposed to a markdown cell. Do you repro this issue with just the Jupyter extension active? Wondering if there is another extension trying to handle the markdown language type.

Beau-xu commented 2 years ago

@IanMatthewHuff Sorry, I didn't make it clear.

Actually, they are two markdown cells:

Snipaste_2022-02-25_08-20-03

Snipaste_2022-02-25_08-21-00

And it doesn't work with just the Jupyter extension.

The following is my settings:

{
    "editor.fontSize": 20,
    "editor.fontFamily": "Consolas, 'TsangerYuYangT', monospace",
    // "editor.inlineHints.fontFamily": "Consolas, 'TsangerYuYangT', monospace",
    "editor.acceptSuggestionOnEnter": "off", //回车是换行,只有 TAB 会接受 suggestion
    "editor.fontLigatures": true, // 连体字
    "editor.formatOnType": true,
    "editor.formatOnSave": true,
    "editor.detectIndentation": true, //自动检测文件的缩进
    "editor.insertSpaces": true,
    "editor.tabSize": 4, // 默认缩进为 4 空格
    "editor.wordWrap": "on",
    "editor.cursorSmoothCaretAnimation": true, // 移动光标时变得平滑
    "files.trimTrailingWhitespace": true, // 保存时,删除每一行末尾的空格
    "files.insertFinalNewline": true, //保存后文件最末尾加一整行空行
    "terminal.integrated.cursorStyle": "line",
    "terminal.integrated.cursorBlinking": true,
    "terminal.integrated.fontSize": 18,
    "terminal.integrated.lineHeight": 1.2,
    "explorer.confirmDragAndDrop": false,
    "hediet.vscode-drawio.codeLinkActivated": true,
    "hediet.vscode-drawio.theme": "Kennedy",
    "security.workspace.trust.untrustedFiles": "open",
    "workbench.editorAssociations": {
        "*.pdf": "pdf.preview"
    },
    "explorer.confirmDelete": false,
    "notebook.cellToolbarLocation": {
        "default": "right",
        "jupyter-notebook": "left"
    },
    "editor.renderWhitespace": "none",
    "latex-workshop.view.pdf.viewer": "tab",
    "editor.autoClosingBrackets": "always",
    "editor.quickSuggestions": true,
    "[markdown]": {
        "editor.formatOnSave": true,
        "editor.quickSuggestions": true,
        "editor.wordWrap": "on"
    },
    "notebook.consolidatedRunButton": true,
    "jupyter.experimental.debugging": true,
    "git.confirmSync": false,
    "git.autofetch": true,
    "workbench.editor.enablePreview": false,
    "security.workspace.trust.enabled": false,
    "workbench.iconTheme": "vscode-icons",
    "vsicons.dontShowNewVersionMessage": true,
    "files.autoSave": "onFocusChange",
    "plantuml.exportOutDir": ".",
    "markdown-preview-enhanced.previewTheme": "github-light.css",
    "git.enableSmartCommit": true,
    "editor.minimap.enabled": false,
    "update.mode": "manual",
    "python.formatting.provider": "yapf",
    "python.formatting.yapfArgs": [
        "--style={column_limit=100, BLANK_LINES_AROUND_TOP_LEVEL_DEFINITION=1}"
    ],
    "latex-workshop.latex.autoBuild.run": "never",
    "latex-workshop.chktex.run": "onType",
    "markdown-preview-enhanced.pandocPath": "C:\\Program Files\\Pandoc\\pandoc.exe", // Disable update notification
    "markdown-preview-enhanced.pandocArguments": [
        "--to",
        "latex"
    ],
    "python.dataScience.useNotebookEditor": true,
    "jupyter.askForKernelRestart": false,
    "remote.SSH.configFile": "C:\\Users\\Public\\.ssh\\config",
    "remote.SSH.remotePlatform": {
        "login0.coral.um.edu.mo": "linux",
        "HPCC-Shua": "linux",
        "Transformer": "linux",
        "GLAT": "linux"
    },
    "plantuml.exportSubFolder": false,
    "window.restoreWindows": "none",
    "remote.SSH.connectTimeout": 20,
    "spellright.notificationClass": "information",
    "spellright.language": [
        "en"
    ],
    "spellright.documentTypes": [
        "latex",
        "plaintext"
    ],
    "notebook.markup.fontSize": 16,
    "markdown.preview.fontSize": 16,
    "editor.bracketPairColorization.enabled": true,
    "editor.guides.bracketPairs": true,
    "pythonPreview.codAndNavWidth": 400,
    "pythonPreview.code.fontSize": "18",
    "pythonPreview.code.lineHeight": 1,
    "pythonPreview.code.fontFamily": "Consolas",
    "pythonPreview.maxExecutedLines": 10000,
}

Workspace settings:

{
    "folders": [
        {
            "path": "..\\Python"
        },
        {
            "path": "..\\..\\books\\Codes_for_problem_solving_with_algorithms_and_data_structures_using_python"
        }
    ],
    "settings": {
        "files.defaultLanguage": "py",
        "cSpell.enableFiletypes": [
            "!python"
        ],
        "git.enabled": false,
        "jupyter.jupyterServerType": "local"
    }
}
IanMatthewHuff commented 2 years ago

Thanks for the settings info. That's quite odd, but I'm still not able to repro. Question. Does this render if you just put in in a markdown .md file and then do a Markdown: Render Preview command?

Beau-xu commented 2 years ago

I solved the problem. Thank you @IanMatthewHuff

You remind me that I have disabled the built-in extension "Markdown Math" for it has conflict with "Markdown All in One". So it can render the code in .md file but doesn't work in notebook.

Thank you~

IanMatthewHuff commented 2 years ago

@Beau-xu Glad that the issue was resolved. That makes sense to me since given your repro it seems like something else must have been getting in the way of the Notebook markdown loading.