How to reduce the space between the lines in Jupyter Visual Studio Code Output?

Question:

I want to reduce the space between the lines when I print something in Jupyter visual studio code output.

Current output

Screenshot

I would like an output like Jupyter when I use it in a browser
Screenshot

Asked By: nikuragi

||

Answers:

I’m not sure if VSCode-Settings has allowed users to customise the line height in Notebooks, but in case it hasn’t, you may do so by adjusting the item line-height in the file index.js in the directory ...Microsoft VS Coderesourcesappextensionsnotebook-renderersrenderer-out

Answered By: Kirin_Guess

It looks like a new setting is being added to vscode v1.67:

notebook.outputLineHeight

See https://github.com/microsoft/vscode/commit/9a87fe7eaf2bcf29de4f5ec7c02044c410c95c0f

Answered By: Mark

The current name of the setting to use is notebook.output.lineHeight. Quoting from defaultSettings.json:

// Line height of the output text within notebook cells.
//  - When set to 0, editor line height is used.
//  - Values between 0 and 8 will be used as a multiplier with the font size.
//  - Values greater than or equal to 8 will be used as effective values.
"notebook.output.lineHeight": 0,

For values between 0 and 8, fractional values are accepted and can be used to reduce line spacing.

In older versions of VS Code, the setting was named notebook.outputLineHeight (see https://github.com/microsoft/vscode/issues/123149).

Note that in outputs with MathJax, the spacing may be styled differently. See Jupyter notebook markdown output puts extra vertical padding on lines with inline MathJax expressions.

Answered By: starball