seflless / diagrams

Generate Flowcharts, Network Sequence Diagrams, GraphViz Dot Diagrams, and Railroad Diagrams
MIT License
764 stars 112 forks source link

Adding option to load json file for style with flowchart #16

Open MrJordison opened 6 years ago

MrJordison commented 6 years ago

Hi, today with others persons we start to use your tool to generate automatically svg files with flowchart.js lib but unfortunately, it is actually not possible to add style (color, etc...) or passing it in command line parameter . For that reason, we've forked your work and adding possibility to load a JSON file containing style definition as a third argument like this: diagrams flowchart [inputFile] [outputFile.svg] [styleSVGFilePath.json]

If you are interested by this enhancement : https://github.com/MrJordison/diagrams/commit/8ba38f9548c131fb391e306ad524a9242db9449a I could make a merge request from our fork

Francois-Laberge-Bose commented 6 years ago

For now I'd prefer not to merge, but I agree this is needed. I'm just too busy to evaluate forks at the moment. My thought on this is I was hoping that styling information is included in the .flowchart and other source files instead. This way all information is stored in the top most file. This way I could make the real time visualization supported in the Atom plugin (francoislaberge/atom-diagrams) to see things including the related styling.

realtime-diagrams

Potentially it would be something like the first line if a comment with a certain convention for specifying stylesheets.

Francois-Laberge-Bose commented 6 years ago

Also, I was hoping to standardize potentially on a nicer syntax than css, but then again css makes the most sense. Potentially I could add explicit or optional support for css preprocessors like sass, less, stylus, etc.

Relequestual commented 5 years ago

@Francois-Laberge-Bose Have you had any further thoughts on this?

I know CSS might not feel like the best way, but given this is a downstream tool, wouldn't it make sense to support what's upstream already? It would be super frustrating for someone who wants to use an existing theme, having to re-encode it in JSON (or whatever) from the provided CSS.

Francois-Laberge-Bose commented 5 years ago

I'm just too busy to think about any of my open source projects at the moment. I originally set out to bootstrap this project with other projects, and then was going to redo the syntax and make my own implementation of each type of graph generator using a consistent syntax across all of them. I'm now thinking I may not get back to this, so yeah, pragmatically adding support for css would be high value, and the right thing for now.

If you create a PR and have a good description of the work, I'll take a look and maybe merge. Just so long as it's optional to use the css, and acts the same as before when you don't provide it, then I'm happy to review if it's not too complicated.

I'm a new dad and have an awesome job, so I tend to have no time for my open source projects lately.

Relequestual commented 5 years ago

Totally understand! Congratulations on both accounts! It's tough, but hopefully you'll find it rewarding as so many of us do! =D

I think I've decided to draw my diagrams up by hand, as I otherwise won't be able to meet my deadline. Plus I'm having doubts over the automated approach in terms of if being accessible for others to modify. Appreciate your previous work on this though! Obviously the licence means anyone is welcome to fork and publish under another name on npm.

Francois-Laberge-Bose commented 5 years ago

Thanks! Exactly, fork away.

Have you seen my https://github.com/francoislaberge/atom-diagrams plugin? Makes it easier to have people contribute. Though, I don't support flow diagrams at the moment I believe

Relequestual commented 5 years ago

I have, but I don't use Atom. (ST, but expect to be moving to Code some time.)

My main barrier to usage is there's no way to tell if there's been a syntax error or not. There's no error reporting in the case of a syntax error. I assume there's some console error if the library can't digest the passed data.

Francois-Laberge-Bose commented 5 years ago

In my atom package it shows the line a syntax error was on. I never did get to making plugins for Code as it only blew up after I had moved on from serious work on diagrams. ST?

Get Outlook for Androidhttps://aka.ms/ghei36


From: Ben Hutton notifications@github.com Sent: Friday, February 8, 2019 6:17:45 AM To: francoislaberge/diagrams Cc: Laberge, Francois; Mention Subject: Re: [francoislaberge/diagrams] Adding option to load json file for style with flowchart (#16)

I have, but I don't use Atom. (ST, but expect to be moving to Code some time.)

My main barrier to usage is there's no way to tell if there's been a syntax error or not. There's no error reporting in the case of a syntax error. I assume there's some console error if the library can't digest the passed data.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/francoislaberge/diagrams/issues/16#issuecomment-461771291, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AgdpWyYugGpUwBlWQBJNY3aVIanacLtGks5vLVzZgaJpZM4SW1mJ.

Relequestual commented 5 years ago

Sublime Text =] One of the few viable options before Atom and after Notepad++

seflless commented 5 years ago

Sublime is great, being very experienced in Javascript, made me want to be able to easily hack my tool. Even when Atom would suddenly freeze or get slow. My computer is beefy enough to handle it. It's become much more optimized since then..

On Fri, Feb 8, 2019 at 7:00 AM Ben Hutton notifications@github.com wrote:

Sublime Text =] One of the few viable options before Atom and after Notepad++

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/francoislaberge/diagrams/issues/16#issuecomment-461781204, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAHNf6kjub-SUzWAG4iPfoPsdCLUUhiks5vLWbGgaJpZM4SW1mJ .

--

Francois Laberge Applied Research at Bose

+1 919-259-3004

seflless commented 5 years ago

My thought, was at least give Atom a try with my diagrams package, and just use it for that, if you want the benefits of textual version control and auto layout.

On Fri, Feb 8, 2019 at 10:58 AM Francois Laberge francoislaberge@gmail.com wrote:

Sublime is great, being very experienced in Javascript, made me want to be able to easily hack my tool. Even when Atom would suddenly freeze or get slow. My computer is beefy enough to handle it. It's become much more optimized since then..

On Fri, Feb 8, 2019 at 7:00 AM Ben Hutton notifications@github.com wrote:

Sublime Text =] One of the few viable options before Atom and after Notepad++

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/francoislaberge/diagrams/issues/16#issuecomment-461781204, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAHNf6kjub-SUzWAG4iPfoPsdCLUUhiks5vLWbGgaJpZM4SW1mJ .

--

Francois Laberge Applied Research at Bose

+1 919-259-3004

--

Francois Laberge Applied Research at Bose

+1 919-259-3004

Relequestual commented 5 years ago

Not a bad idea, but then it wouldn't give me the benefit I was using a cli for... useability by others. I don't want to require others to download atom and a plugin to update an image. npm install however, as in run a script, is probably OK.

Manual approach is going OK though, and most people have office.