Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeBlocks nested in lists aren't turned into runnable blocks #114

Closed
jlewi opened this issue May 23, 2024 · 3 comments
Closed

CodeBlocks nested in lists aren't turned into runnable blocks #114

jlewi opened this issue May 23, 2024 · 3 comments

Comments

@jlewi
Copy link
Owner

jlewi commented May 23, 2024

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) {

@jlewi
Copy link
Owner Author

jlewi commented May 24, 2024

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.

@jlewi
Copy link
Owner Author

jlewi commented May 24, 2024

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.

sourishkrout pushed a commit to stateful/runme that referenced this issue May 24, 2024
The purpose of this PR is to make it possible to reuse runme's Markdown
-> Notebook code.
In particular I'd like to use it to parse ChatGPT output into a notebook
so that code blocks can be rendered in RunMe notebooks.

In Foyle, there is currently a bug with parsing out code blocks nested
inside lists jlewi/foyle#114. Runme's code properly handles this use
case. This will allow us to reuse RunMe's code to fix this problem.
@jlewi
Copy link
Owner Author

jlewi commented May 24, 2024

Duplicate of #55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant