Skip to content

Commit 7147814

Browse files
committed
Add cell label in Quarto render status
1 parent c9c872e commit 7147814

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/resources/jupyter/notebook.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,16 @@ def notebook_execute(options, status):
159159
# progress
160160
progress = (not quiet) and cell.cell_type == 'code' and index > 0
161161
if progress:
162-
status(" Cell {0}/{1}...".format(
163-
current_code_cell- 1, total_code_cells - 1
164-
))
162+
# get label
163+
label = ''
164+
source_lines = cell.source.split('\n')
165+
label_line = next((line for line in source_lines if line.startswith('#| label:')), None)
166+
if label_line:
167+
label = label_line.replace('#| label:', '').strip()
168+
169+
status(" Cell '{0}' {1}/{2}...".format(
170+
label, current_code_cell- 1, total_code_cells - 1
171+
))
165172

166173
# clear cell output
167174
cell = cell_clear_output(cell)

0 commit comments

Comments
 (0)