jlewi/foyle

CodeBlocks nested in lists aren't turned into runnable blocks

Closed this issue · 3 comments

Reported in discord thread

image

This looks like code blocks nested inside a list. I suspect the text language id is coming from OpenAI. I think the issue is MarkdownToBlocks won't parse out code blocks nested in a list.

Our unittest doesn't cover nested blocks so we should try to reproduce that error in the unittests

func MarkdownToBlocks(mdText string) ([]*v1alpha1.Block, error) {

RunMe has already solved this problem. They have a [Deserialize method] (https://github.com/stateful/runme/blob/61fc8785ab8adb4cec5f1135d278a9e8895f327c/internal/document/editor/editor.go#L20)
https://github.com/stateful/runme/blob/61fc8785ab8adb4cec5f1135d278a9e8895f327c/internal/document/editor/editor.go#L20

That takes as input

  • The bytes of a markdown document
  • Returns a notebook proto

In principle we could reuse that method. Unfortunately; we can't just import it because its in the internal package.

I think we should consider refactoring so we can just reuse it.
We already have a dependency on the RunMe code base because we are using their protos.

Duplicate of #55