Example plugin for new upload type?


(David) #1

Are there any instructions or examples to look at for writing a plugin that allows users to upload a new type of file? Specifically, I’m hoping to write a plugin that lets users upload small-ish 3D files in obj/ply/vtk formats and add lightbox-like capabilities through vtk-js so they can be viewed inline.


(Jay Pfaffman) #2

Unless I’m missing something, there’s a site setting for that. Just add the file type there.


(cpradio) #3

I think it is the secondary part, which would simply requiring a markdown-it style plugin to interpret links with .obj/ply/vtk to make it show inline.


(David) #4

@pfaffman Thanks! I’ve been able to add the file types.

@cpradio Would following the example of your discourse-plugin-checklist plugin (but replacing “a.attachment” elements with a vtk-js canvas instead of replacing “.chcklst-box” elements with clickable font-awesome icons) be what you had in mind? Searching for the markdown-it plugin was a little confusing… is markdown-it the name of a plugin or is it something that other extensions use? Thanks!


(cpradio) #5

That could be a good start, there is a Gallery related plugin somewhere too that may be a good fit as well.