Is there a way to create a syntax
Is there a way to create a syntax highlighted code block that has copy-to-clipboard functionality with marimo?
7 Replies
I'm currently leaning towards building this using the anywidget (https://docs.marimo.io/api/inputs/anywidget.html#marimo.ui.anywidget) approach, is that the right way to go?
that would work.
using some existing stuff, you can do markdown (
mo.md
) with code-fences ("``` python ) and then make a button to copy the codeah, that sounds like an easier approach, thanks! any pointers on how I would make that button in marimo?
could I perhaps override / extend the current mo.md function for that? or is there a better way?
I'm currently looking at the source code for
mo.md
, and it looks like I could use a custom pymdownx
extension for thiswe don't have a copy-to-clipboard actually (maybe we should)
we can either add that to
mo.ui.code_editor
or mo.download
- if you submit a feature-requestOK, thanks, I'll look into that! where should I create that feature-request? should it be a GitHub issue, and would it be helpful if I had a stab at an initial implementation myself?
GitHub issue would be great. And we would really appreciate a contribution. I can always help out and point you in the right direction. The CodeEditor plugin is probably the easiest to contribute too to add a copy button
yep, I thought so as well... I'm looking into that now, thanks!