P5.js sketch in Obsidian

Hypothetically, if I were to try to learn how to build a plug-in for Obsidian that let you write a p5 sketch and have it automatically render to a canvas element, where would I start?

What resources would be helpful to know about?