docs: def add_sec_label(cell: NotebookNode, nbname) -> Sequence[NotebookNode]:
      """Adds a Latex \\label{} under the chapter heading.
  
      This takes the first cell of a notebook, and expects it to be a Markdown
      cell starting with a level 1 heading. It inserts a label with the notebook
      name just underneath this heading.
      """
      assert cell.cell_type == 'markdown', cell.cell_type
      lines = cell.source.splitlines()
      if lines[0].startswith('# '):
          header_lines = 1
      elif len(lines) > 1 and lines[1].startswith('==='):
          header_lines = 2
      else:
          raise NoHeader
  
      header = '\n'.join(lines[:header_lines])
      intro_remainder = '\n'.join(lines[header_lines:]).strip()
      res = [
          new_markdown_cell(header),
          new_latex_cell('\label{sec:%s}' % nbname)
      ]
      res[0].metadata = cell.metadata
      if intro_remainder:
          res.append(new_markdown_cell(intro_remainder))
      return res