I'm not clear on what you mean by "rendering". Could you say more?
Sure, I got so used to referring to it this way in the code that I forgot it's actually pretty vague. It sounds more sophisticated than it actually is.
The plugin basically just changes the display of the beginning and end code fences (```python & ```) to make them unselectable. This makes it easier to edit and select the code inside. It does this using the built-in widget replacement functions of CodeMirror (the note editor). The fences still remain inside the note. You can copy the note text and they'll still be there. CodeMirror just lets the plugin change the HTML of that portion of the note.
I currently added two "layouts" for this. One hides the fences completely and moves the python part below the code block. The other makes it look like the fences are unchanged, but they've actually been replaced by different HTML elements and have been made unselectable.
For brevity, I starter referring to this as "rendering", similar to how the preview pane shows the rendered HTML.
The end result of all this is that code blocks act more like discrete cells/widgets which hopefully makes the code easier to manipulate.
Personally, I'd rather have the copy button visible. With it hidden you kind of have to fish around for it. I think the copy button is such a standard element of code blocks that it makes sense just to have it visible.
That's interesting. The reason I hid it was to make it less intrusive when editing, but that definitely a personal preference. I was also thinking about having an option to remove it altogether.
Would you want it to show up all the time or only when hovering over the code block with the cursor? I've seen both patterns used in the wild. Making it appear only when hovering is tricky I think, since I really only have control over individual lines in the note rather than a "wrapper" for each code block. That's just the way CodeMirror renders documents. Code fences are just normal lines.
Also, I see a bunch of flashing when a note is opened for the first time. Is that expected? It is the fencing area that flashes.
It is unfortunately expected. I noticed this happening in other similar plugins that mess with the HTML of the notes (e.g. Enhancement, Rich Markdown ), so I was thinking it was inevitable. But I should definitely take another look at it. No doubt it has something to do with re-rendering before/after the plugin is applied. Might be able to add a delay or something.