Skip to content

add_new doesn't handle markdown for nested blocks #53

@JustinKolnick

Description

@JustinKolnick

Description

The readme mentions that the add_new method handles markdown formatting (and it does for some markdown elements like bold and italics) but it doesn't handle markdown for other "nested" blocks

page.children.add_new(TextBlock, title='Testing 1, 2, 3...\n - Testing \n - Another \n * [ ] Heres one more')

Results in 1 block of text:

Testing 1, 2, 3...

Testing

Another
[ ] Heres one more

Ideally it should result in 4 blocks like this:

Testing 1, 2, 3...

  • Testing
  • Another
  • Heres one more

I've done some testing and these are the supported/unsupported markdown lists that I can gather:

Supported Markdown

  • Bold
  • Italics
  • Links
  • Inline code (code)

Unsupported Markdown

  • Todos
  • Lists (bullets, ordered lists, etc.)
  • Headers
  • Multi-line code blocks
  • Horizontal rules

Since TextBlock is explicitly text, the current behavior makes sense, however maybe a new Block class is a better approach to handle the unique markdown parsing. Something like:

page.children.add_new(MarkdownBlock, title='Testing 1, 2, 3...\n - Testing \n - Another \n * [ ] Heres one more')

Metadata

Metadata

Assignees

No one assigned

    Labels

    left open for discussionIssue is resolved, but is being left open for visibility for discussion

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions