Bladeren bron

Update our nbformat typings to understand source_hidden and outputs_hidden.

Jason Grout 6 jaren geleden
bovenliggende
commit
a70313650f
1 gewijzigde bestanden met toevoegingen van 31 en 1 verwijderingen
  1. 31 1
      packages/coreutils/src/nbformat.ts

+ 31 - 1
packages/coreutils/src/nbformat.ts

@@ -19,7 +19,7 @@ export namespace nbformat {
   /**
    * The minor version of the notebook format.
    */
-  export const MINOR_VERSION: number = 2;
+  export const MINOR_VERSION: number = 4;
 
   /**
    * The kernelspec metadata.
@@ -143,6 +143,16 @@ export namespace nbformat {
    */
   export type CellType = 'code' | 'markdown' | 'raw';
 
+  /**
+   * The Jupyter metadata namespace.
+   */
+  export interface IBaseCellJupyterMetadata extends JSONObject {
+    /**
+     * Whether the source is hidden.
+     */
+    source_hidden: boolean;
+  }
+
   /**
    * Cell-level metadata.
    */
@@ -163,6 +173,11 @@ export namespace nbformat {
      */
     name: string;
 
+    /**
+     * The Jupyter metadata namespace
+     */
+    jupyter: Partial<IBaseCellJupyterMetadata>;
+
     /**
      * The cell's tags. Tags must be unique, and must not contain commas.
      */
@@ -234,6 +249,16 @@ export namespace nbformat {
     attachments?: IAttachments;
   }
 
+  /**
+   * The Jupyter metadata namespace for code cells.
+   */
+  export interface ICodeCellJupyterMetadata extends IBaseCellJupyterMetadata {
+    /**
+     * Whether the outputs are hidden. See https://github.com/jupyter/nbformat/issues/137.
+     */
+    outputs_hidden: boolean;
+  }
+
   /**
    * Metadata for a code cell.
    */
@@ -243,6 +268,11 @@ export namespace nbformat {
      */
     collapsed: boolean;
 
+    /**
+     * The Jupyter metadata namespace
+     */
+    jupyter: Partial<ICodeCellJupyterMetadata>;
+
     /**
      * Whether the cell's output is scrolled, unscrolled, or autoscrolled.
      */