Skip to content

Feature request: split Markdown into separate cells at headings #4

@ngirard

Description

@ngirard

I'm really enjoying using mdlab to create runnable markdown files. I've noticed that when parsing a markdown file, the extension groups all consecutive markdown content between two code blocks into a single, large markdown cell.

Current behavior

If I have a document like this:

# Main Title

This is the introduction to my notebook.

## Section 1: Setup

Here are some details about the setup.

### Subsection 1.1

More details here.

```python
print("Hello, World!")
```

The entire block of text from # Main Title down to More details here. becomes one single markdown cell in the notebook view.

Proposed solution

It would make the notebook experience much more organized and granular if the parser could treat each markdown heading (#, ##, ###, etc.) as the beginning of a new markdown cell.

With this change, the example above would be parsed into three distinct markdown cells:

  1. A cell containing # Main Title and its introduction paragraph.
  2. A cell containing ## Section 1: Setup and its paragraph.
  3. A cell containing ### Subsection 1.1 and its paragraph.

This would align mdlab more closely with the user experience of other notebook interfaces (like Jupyter) and would make it much easier to read, edit, collapse, and reorder sections of a large document.

Thank you for considering this improvement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions