Vscode .net interactive notebooks hide code when exporting to HTML - visual-studio-code

How do I hide the code cell when exporting .net interactive notebooks in visual studio code?
For instance,
I'd like to export the output, which is the latex display part of the example above,
while excluding the actual code cell from being exported.
I found this question for Jupyter notebook but I can't seem to make it work for vscode.
My best option, for now, is to export the whole file to HTML and then manually exclude the elements that are not needed.

Related

Program Beckhoff PLC in VS Code

Since Beckhoffs TwinCAT3 Shell is missing basic function that are considered standard in other IDEs im trying to switch to VS Code to do the job.
There is an extension that enables syntax highlighting for ST (Structured Text) which is great.
But im not satisfied how the TcPOU files (xml formatted) are displayed.
I'm used to the window layout of TwinCAT3 and am wondering if it is somehow possible to have a similar layout with VS Code.
In Beckhoffs TwinCAT3 Shell, which is based on Visual Studio, the decleration of variables and the code are seperated by a horizontal bar. Furthermore the header of the xml file is not displayed in TwinCAT3.
So basically what im asking is if i can make VS Code display
<Declaration><![CDATA[
]]></Declaration>
as a horizontal line and hide the xml header.
VS Code Beckhoff TwinCAT3

How to keep the wrapped code cells when exporting Jupyter Notebooks to HTML in Visual Studio Code?

I'd like to export the content of a Jupyter Notebook from Visual Studio Code to HTML with the wrapped cells I see in VS Code. Is there any way to keep that view?

Why does Visual Studio Code jupyter notebook outline (the table of content) show every single markdown block and how can I change it?

Below is a screenshot of what I mean. I'd like it to show only the headers of the notebook, not each and every single markdown block. Is there a similar way to changing this, like in JupyterLab, where you can toggle different outline options?

Is there a way to open any file as text in VS Code?

VS Code is currently my favourite text editor, except for Jupyter notebooks, which are opened as interactive python environments (let's call this 'rendered').
By itself it is nice that this is possible, but not I can live with opening them in a browser if VS Code would not render them.
There used to be a setting to avoid this behaviour ("jupyter.useNotebookEditor": false) but currently my installation does not recognise this setting anymore.
Since there are more file types that can be opened as text/source, or rendered form (e.g. html, md, svg, uncompressed pdf, etc.) and both forms can be usefull, I would be very excited to learn how to switch between rendered and source, preferably without switching global settings.
Is there a way to do this? I would hope for:
a mechanism that does not depend on (or can be overwritten by) the current jupyter extension
a mechanism that works for any file type (nice-to-have)
Are you just looking for a way to view/edit the raw json?
You can right click the file in the Explorer -> open with... -> text editor.
Or use "Reopen editor with text editor" from the command Palette (ctrl+shift+p)

How to Format Jupyter notebook in VSCode?

We can format python code in the jupyter notebook in the browser. After I change to VSCode and use the Microsoft extension, I find I can not format Jupyter notebook any more. Does anyone know how to solve this?
As Kyle Carow stated in their answer to Ian Huff: Formatting of notebooks is available by now.
MacOS: Option+Shift+F
Windows: Alt+Shift+F
Pressing these keys will either trigger a formatting of the active cell or the notebook as a whole if no cell is active.
Windows: Shift+Alt+F
Is what worked for me with Black formatter set up on VS Code Version: 1.64.2
Or right click "Format Notebook" to format entire notebook.
Format Notebook
I do not think VS Code support formatting of code cells, but if you use the black code formatter, then you can use the blackcellmagic %%black to format the code in a cell.
You need to have pip install black and blackcellmagic, details here: https://github.com/csurfer/blackcellmagic
I'm not exactly sure what is being asked here. But currently in VS Code the notebook editor and interactive window do not support formatting python code.
However we are moving to a new UI for those features which will support all the formatting features of VS Code in .py files. If you try out VS Code - Insiders now you should see this support and can try it out. This new UI will eventually be rolling out to VS Code stable.
Edit: The new UI which supports formatting in cells is now out by default for stable users.
If you have a Jupyter notebook open in VS Code with the Jupyter notebook extension, it should be possible to format code cells with Ctrl+ Shift+ I.
I'm not sure if this shortcut differs between operating systems, you can check what the shortcut is yourself by hitting Ctrl+ Shift+ P and then searching for "Format cell". The shortcut should be displayed then.