Organize cells hierarchically using markdown headings
Tissue grouping is Ganimede’s system for organizing cells into hierarchical structures. By using markdown cells with headings, you create “tissues” that group related cells together, forming a tree structure that mirrors your notebook’s logical organization.
A tissue is a markdown cell with a heading (lines starting with #). Any cells positioned after a heading cell become its children until the next heading of equal or higher level appears.Think of tissues like sections in a document:
# Data LoadingLoad and prepare the dataset## Import Librariesimport pandas as pdimport numpy as np## Read Datadf = pd.read_csv('data.csv')# AnalysisAnalyze the loaded data## Summary Statisticsdf.describe()
The algorithm handles deeply nested structures by recursively finding the last child:
# While last_child is a heading and has children,# follow the chain to find the true last descendantwhile ( cells[last_child_idx]["is_heading"] and len(self.pc_graph[cells[last_child_idx]["id"]]) > 0): last_child_id = self.pc_graph[cells[last_child_idx]["id"]][-1] last_child_idx = [ i for i, cell in enumerate(cells) if cell["id"] == last_child_id ][0]
This ensures that cells after a nested hierarchy are correctly assigned to the next appropriate parent.
@propertydef is_heading(self): if self.type == "markdown": if any(line.lstrip().startswith("#") for line in self.source): return True return False@propertydef heading_level(self): if self.is_heading: for line in self.source: if line.lstrip().startswith("#"): return line.count("#") return None
This ensures your organizational structure persists between sessions.
Use tissue grouping to create a table of contents structure for your notebook. Top-level headings become your main sections, and nested headings create subsections.