gpoore / codebraid

Live code in Pandoc Markdown

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inline expr w/kernel and images wo/kernel

memeplex opened this issue · comments

Hi, this is not a report but just two questions. Sorry if this is not the place to ask, I didn't find any better place.

  1. Is it possible to achieve the effect of cb-expr when running through a kernel? cb-nb with inlines does almost the same but the output is formatted verbatim, I would like to get it as is instead.

  2. For simple cases, I prefer to avoid the kernel, but I'm not sure about how to produce a figure as output. I could write it to a file and then print the path as a markdown image link, but that would be dependant on the output format (or perhaps not? will markdown output at this stage still be converted to the output format?). Is it a way of making codebraid interpret the output as an image path?

Thanks in advance.

  1. At the moment, something like show=rich_output:plain:raw should work. I probably should look into enabling cb-expr for Jupyter kernels, using show=rich_output:plain:raw, but I think there still may be a few edge cases.

  2. You have the right idea. Save the image to file, then print the Markdown code to create an image/figure/etc. This will need to be in a code block or other context where show includes stdout:raw. The Markdown will be interpreted and converted into the output format to the extent that Pandoc supports this for the output format.

    I've gradually been working toward adding support for rich output to the built-in code execution system to provide capabilities closer to a Jupyter kernel. So someday I hope it will be possible to have images appear automatically, or create figures with something like codebraid.add_figure(<image_path>, <caption>).