Dong-gyun Kim
Dong-gyun Kim

Reputation: 431

VS code opens Jupyter notebook in weird form

I'm using VS code with Jupyter notebook extension for python version 3.8.

When I open the any file with .ipynb by double clicking it, vs code shows the file in weird form like below.

{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# import functions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {

However, I open same files with File>Open File... then it shows normal form of Jupyter notebook, which has separate cells.

Does anyone know how to solve this issue?

enter image description here

Upvotes: 1

Views: 1686

Answers (1)

Molly Wang-MSFT
Molly Wang-MSFT

Reputation: 9461

From Jupyter in VS Code:

When a Notebook is Not Trusted, VS Code will not render Markdown cells or display the output of code cells within the Notebook. Instead, just the source of Markdown and code cells will be shown.

Open the .ipynb file from File--> Open File to check if its status is Not Trusted:

enter image description here

You can relaunch the trust notification prompt after reviewing the Notebook by clicking on the Not Trusted status, then choose Trust.

[UPDATE]

Change the "cell_type" from markdown to code.

Upvotes: 1

Related Questions