hedgedoc / react-client

The frontend of the upcoming version 2.0
https://hedgedoc.dev
GNU Affero General Public License v3.0
104 stars 13 forks source link

Vega-Lite Interactive Graphics #446

Closed tyuio1 closed 4 years ago

tyuio1 commented 5 years ago

Vega-Lite is a high-level grammar of interactive graphics. It provides a concise JSON syntax for rapidly generating visualizations to support analysis. https://vega.github.io/vega-lite/

Could this be supported in CodiMD? What do you think?

ccoenen commented 5 years ago

In theory, it should work very similar to things like our Mermaid integration. Can you give us a few examples what you would use it for? I am not familiar with Vega, but it sure looks interesting!

tyuio1 commented 5 years ago

It would be an alternative to exporting PNG graphics each time you want add, change or update a graph, which can become a drag.

Being interactive is also a very nice bonus.

ccoenen commented 5 years ago

I've seen their examples, what I don't know is what you could actually achieve with it. As in:

"I am using mermaid to create a six month plan with my coworkers, it lets us add milestones and vacation days to a gantt chart".

But instead of mermaid with vega.

tyuio1 commented 5 years ago

I am using CodiMD for project documentation, and generate plots and charts with vega-lite in JupyterLab. Then I export and import them as image file. If vega-lite was integrated it would allow me to just copy paste JSON, which could be modified in the editor without import/export. Furthermore, it would allow my collaborators who don't have access to my JupyterLab to edit these charts too.

axgkl commented 4 years ago

They have vega support in hackmd/codimd - This does not look to complex to add: https://github.com/hackmdio/codimd/pull/1251/files/2613b63160cadf560880d156129d3edd7f58a2d6

But I'm not sure if simply copying this is allowed (?)

SISheogorath commented 4 years ago

It's allowed since all parts are under AGPL, you have to make sure that you keep the copyright information around, but otherwise it's fine.

Still I'm not sure we really want this. I would love to look for a more streamlined experience. When we go this way, we'll pump more and more dependencies into CodiMD and the app becomes bigger and bigger. It already has a size of ~7MB after minification, which is quite big for a webapp.

So let's get this straight: How much of an advantage is it?

axgkl commented 4 years ago

So let's get this straight: How much of an advantage is it?

That's asking for fights ;-)

Guess a more universal approach would be some plugin machinery, where people can choose their build ingredients, e.g. plantuml, vega, all that, which are than accessible like:

```foo
 <foo's DSL, producing markdown or HTML>
```

Could be pretty universal, with a dropdown after the ``` with all the plugins available.

Other example: In old hackmd days I did control a python client which was attached to a page via websocket, and the body of fenced blocks with a "```bot" header was executed on the client, producing html or markdown again. Was quite useful to create documentation of python code, with it's live results. But I had to hack that into the source, effectively producing a fork, which is now after years no fun to merge back. Now if such bots would produce just data, tagged as to be rendered by other such plugins, like vega or also mermaid (e.g. call flows) then things could get really interesting (live documents...)...

Anyway, getting distracted, actuallly trying to say I'd prefer some more machinery for stuff like that, instead of hardcoding in this and that - totally with you that this is bloat for the 95% of users, prbly.

ErikMichelson commented 4 years ago

Guess a more universal approach would be some plugin machinery, where people can choose their build ingredients, e.g. plantuml, vega, all that, which are than accessible like

That sounds very similar to codimd/server#20.

ErikMichelson commented 4 years ago

This idea was added to the 'requested' list in #257