i-m-mll348 downloadsRedirect pasted text into a separate note, and embed it.
When pasting text into a note, check the text against regexp patterns. When it matches, create a new note containing the text, and embed that note into the active note.
Define rules in the plugin settings pane, that determine when and how to create and embed a note, depending on the text being pasted.
Here are the settings I use for embedding Plotly figures made in Python, using the output from fig.to_json():

And here's an example of it in action.

Note:
clean-embeds CSS snippet, so the embed is seamless with the rest of the note.When text is pasted from the clipboard, it is checked against a list of user-defined rules:
true against the pasted text.When a rule is engaged:
If no rule is engaged, pasting proceeds as it normally would.
Note the following limitations of this early version of the plugin:
I like using the obsidian-plotly plugin to render interactive figures in my notes. The Plotly figure is represented as JSON and placed in a code block, which is replaced with the rendered figure in the editor.
However, when editing the note or interacting with the plot, the code block sometimes collapses back into its unrendered, editable form. This sometimes causes the editor to lag to the point of unusability.
Thankfully:
However, it's effortful to manually create and embed such notes. Acknowledging that similar use cases may benefit from automation, and wanting to try writing an Obsidian plugin for the first time, I therefore wrote this one.
Parts of this plugin are directly derived (see source comments) from parts of the following plugins:
Additionally, I took inspiration from obsidian-custom-attachment-location concerning the customization of note and folder naming.
path