Code snippet personal database creation

What I’m trying to do:
I would like to build my personal code snippet database.
I would like to be able to insert code blocks component, but this is not available, so I think I need to take a text area, but I need to be sure that the text is an unformatted text, to be able to copy and use the snippets.

Does somebody have a better idea?

If they’re code snippets, you might want to integrate a Javascript editor oriented toward code, like Code Mirror. Here’s one post about using that in an Anvil app: CodeMirror integration

Thank you very much. I downloaded your example and will give it a try.
It should be a good idea to integrate it as a component, or may be the people from Anvil Extra can do it. :wink: :wink:

But I need just a text area to paste a code snippet of different languages, mostly Python, sometimes other like JS etc…
A area where I can paste unformatted text, but that keeps the original indentation.
In fact just a component “code block” to insert code, just like I can in Evernote, Obsidian,…. (if possible with a small button to copy code to clipboard, but not necessary, because this can also be done with an external button)

Anvil Extras already has a component based on the quill editor:

https://anvil-extras.readthedocs.io/en/latest/guides/components/quill.html

and quill has code syntax highlighting support:

1 Like

Ok than you very much. I will take a look. This seems to be the component that I am looking for. :+1: