Open vinayak-mehta opened 4 years ago
Hi, maybe I can help. I think we should create another class for ipynb and read it with nbcommand. I was just looking at a question, with the nbcat we read, how can we show it as a presentation? For example, with this method؟ (sorry for writing a little ugly)
I tried with your library but it didn't work. I think it is easier to read it manually.
The code I wrote for this:
import nbformat
from nbcommands import terminal
def cat(file, *args, **kwargs):
"""Concatenate Jupyter notebooks to standard output."""
# Source: https://github.com/jbn/nbmerge
merged, metadata = None, []
with open(file, "r") as file:
nb = nbformat.read(file, as_version=4)
metadata.append(nb.metadata)
if merged is None:
merged = nb
else:
merged.cells.extend(nb.cells)
merged_metadata = {}
for meta in reversed(metadata):
merged_metadata.update(meta)
merged.metadata = merged_metadata
return display(merged.cells)
Which unfortunately was None
output.
Can reuse nbcommands code here. Colors could be an issue.