plantuml / plantuml.js

PlantUML that runs completely on javascript without needing java/servers
https://plantuml.github.io/plantuml.js/
MIT License
239 stars 42 forks source link

VSCode Extension #10

Open sakirtemel opened 1 year ago

sakirtemel commented 1 year ago

https://github.com/plantuml/plantuml/issues/803#issuecomment-1404452441

sakirtemel commented 1 year ago

@fabiospampinato Do VSCode extensions require a single file? To be honest, I'm not sure yet, besides that this implementation still requires cheerpj to be loaded frorm the internet. There's an option to have it self hosted though.

I'd like to experiment with https://github.com/plantuml/plantuml-wasm/issues/9 , it seems like we may do it in there

fabiospampinato commented 1 year ago

Do VSCode extensions require a single file?

They don't, but if plantuml-wasm could be bundled it would be easier to use for scenarios like that I think.

sakirtemel commented 1 year ago

@fabiospampinato actually I've seen that the current implementation can work with a single js file https://github.com/plantuml/plantuml-wasm/blob/main/compiled-jars/plantuml-1.2023.0.jar.js .

But cheerpj loader is still needed https://github.com/plantuml/plantuml-wasm/blob/0a89ce97982e13c58648377a4ee838c89edfd94d/index.html#L7

we can self-host the cheerpj as plantuml is open source ( https://leaningtech.com/cheerpj-licensing/ ), but I don't think that we can distribute it

https://github.com/plantuml/plantuml/issues/803#issuecomment-1403673285

let's see what we're going to find out with #9

sakirtemel commented 1 year ago

A nice article to follow: https://dev.to/salesforceeng/how-to-build-a-vs-code-extension-for-markdown-preview-using-remark-processor-1169

sakirtemel commented 1 year ago

@fabiospampinato it can work without including the dependencies ( https://github.com/plantuml/plantuml-wasm/issues/5#issuecomment-1406043967 ), so I'm going to give it a try to make it even more compact with a single file, something like

import { PlantUML } from 'plantuml-wasm' // or directly from cdn

const content = "@startuml Alice --> Bob: Hi @enduml"

png_buffer = await PlantUML.render_png(content)

I'm going to prepare two examples, for nodejs and for web.

Still I'm wondering how to solve the things with requiring cheerpj and the jar files.

sakirtemel commented 1 year ago

@fabiospampinato fyi, I just made such a change and moved all the potentially necessary files under the https://github.com/plantuml/plantuml-wasm/tree/main/plantuml-wasm .

I'm going to write a guideline about that ( https://github.com/plantuml/plantuml-wasm/issues/16 ) and some example integrations, but you can see how it's used here ( https://github.com/plantuml/plantuml-wasm/blob/main/index.html#L127 , https://github.com/plantuml/plantuml-wasm/blob/main/index.html#L97 ). Considering https://github.com/plantuml/plantuml-wasm/blob/main/index.html#L8 as in the same directory, too. After that's figured out, I'm going to make a core bundle + extension bundles that can be easily used in any projects.