Coder Social home page Coder Social logo

sublime_diagram_plugin's Introduction

Overview

This is a plugin that renders diagrams from your selection in Sublime Text 2 or 3.

By default, it binds the (Command / Alt)-M key and registers a command on the Command Palette. Simple select the text for your diagram and trigger the command. Multiselections are allowed. Each diagram will be generated in a uniquely named file.

If a diagram handler recognizes a diagram in the selection, it will render it and pop it up in a detected viewer. Files are rendered into the same directory as the source file as Portable Network Graphic files. They will be automatically overwritten, but not removed.

If you wish to override the viewer used, disable start-time sanity checks, or change the default character set for diagram files, create a user version of Diagram.sublime-settings file in the usual way.

Install

To install from scratch, it's necessary to have:

  • Java (download from java.sun.com) (brew cask install java)
  • Graphviz (I recommend "homebrew" on the Mac)
  • Sublime Text 2 or 3

To install, just put a checkout of this project into your Packages directory in Sublime Text.

Support

Operating Systems: MacOS X, Linux, Windows (with default system viewer) Diagram Types: PlantUML Viewers (in order of preference):

  • MacOS X Preview
  • MacOS X QuickLook
  • Eye of Gnome

Patches to support additional viewers or diagrams are welcome.

Install Instructions

Check out the source directory or download and uncompress the source tarball. Put this directoy in the Packages directory for your platform.

On Linux, it's sometimes "/.config/sublime-text-2/Packages/". On MacOS X, it's "/Library/Application Support/Sublime Text 2/Packages/".

Sublime Text should detect the plugin and automatically load it.

The source is available via git at:

https://github.com/jvantuyl/sublime_diagram_plugin.git

Or as a tarball at:

https://github.com/jvantuyl/sublime_diagram_plugin/tarball/master

Example Results

Component Diagram 1

component1

Component Diagram 2

component2

State Diagram

state1

Thanks

Special thanks to all of those who have contributed code and feedback, including:

  • Tobias Bielohlawek (Syntax Highlighting Support)
  • Julian Godesa (UX Feedback)
  • Seán Labastille (Preview Support, Multi-Diagram Support)
  • Kirk Strauser (Python 3 / SublimeText 3 Support)
  • Stanislav Vitko (PlantUML Updates)
  • Constantine ? (Windows Viewer, Charset Support, Image Size Tweaks, Output Selection Support, Various Other Fixes)
  • Marcelo Da Cruz Pinto (Windows Viewer)
  • Peter Ertel (PEP8 Cleanup, Windows Improvements)
  • Juan Cabrera (Version Updates)
  • Alexey Shashev (ST3 Plugin Loading Fixes)
  • Riley Wood (PlantUML Updates)
  • Ben Hardill (ST3 Native PNG Viewer)
  • Maksim Chartkou (File Naming Stability Improvements)
  • Timothy Zhang (File Include Support)
  • Way Wang (Python 3 Correctness Patch)

sublime_diagram_plugin's People

Contributors

hardillb avatar jaimejim avatar jmdacruz avatar juancabre avatar jvantuyl avatar kstrauser avatar lusitania avatar overlord avatar rjw245 avatar seanlabastille avatar vistrcm avatar wickiup avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sublime_diagram_plugin's Issues

Teoz Architecture

Hi, I am interested in using the "teoz" engine for "multicast" events in secuences. For instance I would like to do this:

@startuml
!pragma teoz true
Alice -> Bob : hello
& Bob -> Charlie : hi
@enduml

However this is giving me an error :) Is there a way to fix it?

cant understand how to use this

installed this plugin
Sublime 2 sees this plugin in packages list
Im trying to press cmd+m while selecting a script but nothing happens.
How to run script (plantuml)?

bug in syntax highlight

for instance Bob --> Alice is not properly done. it is something with the regular expresion

Support adding an include file via configuration

It would be great if we could add a configuration flag pointing to an include file and have the plugin include this file in the call to plantuml.jar. (-I command line flag).

The use case is that I have an include file to tune the look and feel of the diagrams and it would be very useful if I could have the plugin pick it up.

syntax highlighting triggers on apostrophe

if I have a lines like this:

:don't break the code!|
:you're coding all night|

the text between the apostrophe's is assumed to be a quote. In this example the highlighting stops on the second line, but in my specific case I only had one apostrophe and no more after for 10 lines or more... so the entire remainder of the document is highlighted yellow as a result.

Install an error under Windows

Tip: Currently only supported on MacOS

Package Control: Skipping automatic upgrade, last run at 2018-06-29 16:30:25, next run at 2018-06-29 17:30:25 or after
reloading settings Packages/User/Package Control.sublime-settings
ignored packages updated to: ["Diagram", "Vintage"]
reloading settings Packages/User/Package Control.sublime-settings
reloading settings Packages/User/Preferences.sublime-settings
reloading settings Packages/User/Package Control.sublime-settings
ignored packages updated to: ["Vintage"]
reloading plugin Diagram.diagram_plugin
Viewer Setting: Preview
Loading processor class: <class 'Diagram.diagram.plantuml.PlantUMLProcessor'>
Detected 'C:\Users\shaos\AppData\Roaming\Sublime Text 3\Packages\Diagram\diagram\plantuml.1.2018.1.jar'
Version Detection:
b'PlantUML version 1.2018.01 (Mon Jan 29 02:08:22 CST 2018)\r\n(GPL source distribution)\r\nJava Runtime: Java(TM) SE Runtime Environment\r\nJVM: Java HotSpot(TM) Client VM\r\nJava Version: 1.8.0_171-b11\r\nOperating System: Windows 10\r\nOS Version: 10.0\r\nDefault Encoding: GBK\r\nLanguage: zh\r\nCountry: CN\r\nMachine: SHAOSHIQIANG-WORK-COMPUTER\r\nPLANTUML_LIMIT_SIZE: 4096\r\nProcessors: 4\r\nMax Memory: 259,522,560\r\nTotal Memory: 16,252,928\r\nFree Memory: 12,267,504\r\nUsed Memory: 3,985,424\r\nThread Active Count: 1\r\n\r\nThe environment variable GRAPHVIZ_DOT has been set to D:\Program Files (x86)\Graphviz2.38\bin\dot.exe\r\nDot executable is D:\Program Files (x86)\Graphviz2.38\bin\dot.exe\r\nDot version: dot - graphviz version 2.38.0 (20140413.2041)\r\r\nInstallation seems OK. File generation OK\r\n'
PlantUML Smoke Check:
b'The environment variable GRAPHVIZ_DOT has been set to D:\Program Files (x86)\Graphviz2.38\bin\dot.exe\r\nDot executable is D:\Program Files (x86)\Graphviz2.38\bin\dot.exe\r\nDot version: dot - graphviz version 2.38.0 (20140413.2041)\r\r\nInstallation seems OK. File generation OK\r\n'
Loaded processor: <Diagram.diagram.plantuml.PlantUMLProcessor object at 0x000001E60784D048>
Loading viewer class from configuration: <class 'Diagram.diagram.preview.PreviewViewer'>
Unable to load configured viewer, falling back to autodetection...
Traceback (most recent call last):
File "C:\Users\shaos\AppData\Roaming\Sublime Text 3\Packages\Diagram\diagram_init_.py", line 59, in setup
vwr.load()
File "C:\Users\shaos\AppData\Roaming\Sublime Text 3\Packages\Diagram\diagram\preview.py", line 8, in load
raise Exception("Currently only supported on MacOS")
Exception: Currently only supported on MacOS
Trying Viewer Sublime3Viewer
Loading viewer class: <class 'Diagram.diagram.sublime3.Sublime3Viewer'>
Loaded viewer: <Diagram.diagram.sublime3.Sublime3Viewer object at 0x000001E607E4F080>
Processors: [<Diagram.diagram.plantuml.PlantUMLProcessor object at 0x000001E60784D048>]
Viewer: <Diagram.diagram.sublime3.Sublime3Viewer object at 0x000001E607E4F080>
generating meta info summary
generating syntax summary
reloading settings Packages/User/Package Control.sublime-settings
reloading settings Packages/User/Preferences.sublime-settings

ST3, win8, Command 'which java > /dev/null' returned non-zero exit status 1

Hello,

I get this error after I unpack plugin in sublime text 3 packages folder (on windows 8):

reloading plugin sublime_diagram_plugin.diagram_plugin
Viewer Setting: Preview
Loading processor class: <class 'sublime_diagram_plugin.diagram.plantuml.PlantUMLProcessor'>
Unable to load processor: <class 'sublime_diagram_plugin.diagram.plantuml.PlantUMLProcessor'>
Traceback (most recent call last):
File "C:\Users\dskopa\AppData\Roaming\Sublime Text 3\Packages\sublime_diagram_plugin\diagram__init__.py", line 34, in setup
proc.load()
File "C:\Users\dskopa\AppData\Roaming\Sublime Text 3\Packages\sublime_diagram_plugin\diagram\plantuml.py", line 40, in load
self.check_dependencies()
File "C:\Users\dskopa\AppData\Roaming\Sublime Text 3\Packages\sublime_diagram_plugin\diagram\plantuml.py", line 46, in check_dependencies
if not check_call("which java > /dev/null", shell=True) == 0:
File "X/subprocess.py", line 545, in check_call
subprocess.CalledProcessError: Command 'which java > /dev/null' returned non-zero exit status 1
error: Unable to load diagram plugin, check console for details.

Java sdk and Graphviz are installed.

What else should I check for?

Generated .png are not removed

The generated .png files are not cleaned up as mentioned in the documentation.

All files are created in such a way that they will be cleaned up unless Sublime Text dies a particularly horrible death.

I'm running ST3 on Ubuntu 14.04
PlantUML build 8027

Error Processing Diagram

I got this on my console when I ran it on the example diagrams at example.wsd. I fixed this evandrocoan@7a89dee, but now no diagrams show up. How can I know what is the error?

Rendering [(<PlantUmlDiagrams.diagram.plantuml.PlantUMLProcessor object at 0x05F347D0>, ['\nComponent diagram 1\n\n@startuml\n\nskinparam componentStyle uml2\n\ncloud "GoogleDocs" {\n  [GDOC docs]\n}\n\n[GDOC docs] --> [DOCX docs] : Download\n[DOCX docs] --> [MD parts] : DocConvert\n[MD parts] --> [Drupal feed] : book-parts-to-feed\n[MD parts] --> [MD eBook] : book-join\n[MD parts] --> [HTML parts] : pandoc\n[MD eBook] --> [HTML eBook] : pandoc\n[MD eBook] --> [FB2 eBook] : calibre\n[MD eBook] --> [EPUB eBook] : calibre\n[MD eBook] --> [MOBI eBook] : calibre\n\n@enduml\n\n----------------------------------------------------------\n\nComponent diagram 2\n\n@startuml\n\nskinparam component {\n  Style uml2\n  BackgroundColor #FEFECE\n}\nnode "Database Server" {\n  database "MSSQL / ORA \\n " {\n    [DB] as DB\n  }\n}\nnode "Business Logic Server" {\n  frame "Windows Service Host" {\n    package "GUIService" {\n      [GuiService] as GuiService\n    }\n    package "ExtService" {\n      [ExtService] as ExtService\n    }\n  }\n}\nnode "Update Server \\n (can be hosted on \\n BL Server)" {\n  folder "Remote Storage" {\n    [System Storage] as UpdateStorage\n  }\n}\nnode "Client Computer" {\n  folder "Local Storage" {\n    [System Client] as Client\n  }\n}\ncloud "External Systems" {\n  [External Systems] as ExtSystem\n}\n\ncloud "Service Locator" {\n  [Service Locator] as ServiceLocator\n}\ncloud "OSSBSS Services" {\n  [OSSBSS Services] as OSSBSS\n}\ncloud "Security \\n (Authority \\n Service)" {\n  [OSSBSS Security] as Security\n}\n[Client]          --> [GuiService]      : WCF HTTP/TCP\n[ExtSystem]       --> [ExtService]      : WCF HTTP\n[GuiService]      --> [DB]              : OSSBSS.DbAccessLayer\n[GuiService]      --> [UpdateStorage]   : SMB\n[GuiService]      --> [Security]        : WCF\n[GuiService]      --> [ServiceLocator]  : WCF\n[ServiceLocator]  --> [OSSBSS]          : WCF\n[ExtService]      --> [DB]              : OSSBSS.DbAccessLayer\n[ExtService]      ..> [GuiService]      : inproc\n\n@enduml\n\n--------------------------------------------------------------------------------\n\nState diagram\n\n@startuml\n\n[*]       --> proposed  : external \\n request \\n registered in \\n host system\nproposed  --> active    : request \\n accepted\nproposed  --> rejected  : operator \\n rejected \\n request\nproposed  --> cancelled : request \\n cancelled \\n by external \\n system\nactive    --> resolved  : new data \\n assigned\nactive    --> proposed  : request \\n reverted\nactive    --> cancelled : request \\n cancelled \\n by external \\n system \\n or by \\n power-user, \\n data \\n reverted\nactive    --> rejected  : no tech \\n capability\nresolved  --> completed : assigned data \\n confirmed\nresolved  --> active    : in case of correction\nresolved  --> cancelled : assigned data \\n reverted\ncompleted --> [*]\nrejected  --> [*]\ncancelled --> [*]\n\nproposed  : New\nactive    : In Work\nresolved  : Processed\ncompleted : Confirmed\ncancelled : Cancelled\nrejected  : Rejected\n\n@enduml'])]
Rendering diagram for block: '\nComponent diagram 1\n\n@startuml\n\nskinparam componentStyle uml2\n\ncloud "GoogleDocs" {\n  [GDOC docs]\n}\n\n[GDOC docs] --> [DOCX docs] : Download\n[DOCX docs] --> [MD parts] : DocConvert\n[MD parts] --> [Drupal feed] : book-parts-to-feed\n[MD parts] --> [MD eBook] : book-join\n[MD parts] --> [HTML parts] : pandoc\n[MD eBook] --> [HTML eBook] : pandoc\n[MD eBook] --> [FB2 eBook] : calibre\n[MD eBook] --> [EPUB eBook] : calibre\n[MD eBook] --> [MOBI eBook] : calibre\n\n@enduml\n\n----------------------------------------------------------\n\nComponent diagram 2\n\n@startuml\n\nskinparam component {\n  Style uml2\n  BackgroundColor #FEFECE\n}\nnode "Database Server" {\n  database "MSSQL / ORA \\n " {\n    [DB] as DB\n  }\n}\nnode "Business Logic Server" {\n  frame "Windows Service Host" {\n    package "GUIService" {\n      [GuiService] as GuiService\n    }\n    package "ExtService" {\n      [ExtService] as ExtService\n    }\n  }\n}\nnode "Update Server \\n (can be hosted on \\n BL Server)" {\n  folder "Remote Storage" {\n    [System Storage] as UpdateStorage\n  }\n}\nnode "Client Computer" {\n  folder "Local Storage" {\n    [System Client] as Client\n  }\n}\ncloud "External Systems" {\n  [External Systems] as ExtSystem\n}\n\ncloud "Service Locator" {\n  [Service Locator] as ServiceLocator\n}\ncloud "OSSBSS Services" {\n  [OSSBSS Services] as OSSBSS\n}\ncloud "Security \\n (Authority \\n Service)" {\n  [OSSBSS Security] as Security\n}\n[Client]          --> [GuiService]      : WCF HTTP/TCP\n[ExtSystem]       --> [ExtService]      : WCF HTTP\n[GuiService]      --> [DB]              : OSSBSS.DbAccessLayer\n[GuiService]      --> [UpdateStorage]   : SMB\n[GuiService]      --> [Security]        : WCF\n[GuiService]      --> [ServiceLocator]  : WCF\n[ServiceLocator]  --> [OSSBSS]          : WCF\n[ExtService]      --> [DB]              : OSSBSS.DbAccessLayer\n[ExtService]      ..> [GuiService]      : inproc\n\n@enduml\n\n--------------------------------------------------------------------------------\n\nState diagram\n\n@startuml\n\n[*]       --> proposed  : external \\n request \\n registered in \\n host system\nproposed  --> active    : request \\n accepted\nproposed  --> rejected  : operator \\n rejected \\n request\nproposed  --> cancelled : request \\n cancelled \\n by external \\n system\nactive    --> resolved  : new data \\n assigned\nactive    --> proposed  : request \\n reverted\nactive    --> cancelled : request \\n cancelled \\n by external \\n system \\n or by \\n power-user, \\n data \\n reverted\nactive    --> rejected  : no tech \\n capability\nresolved  --> completed : assigned data \\n confirmed\nresolved  --> active    : in case of correction\nresolved  --> cancelled : assigned data \\n reverted\ncompleted --> [*]\nrejected  --> [*]\ncancelled --> [*]\n\nproposed  : New\nactive    : In Work\nresolved  : Processed\ncompleted : Confirmed\ncancelled : Cancelled\nrejected  : Rejected\n\n@enduml'
chdir to: F:\SublimeText\Data\Packages\PlantUmlDiagrams\samples
Error Processing Diagram:
Here are some complex examples

----------------------------------------------------------

Component diagram 1

@startuml

skinparam componentStyle uml2

cloud "GoogleDocs" {
  [GDOC docs]
}

[GDOC docs] --> [DOCX docs] : Download
[DOCX docs] --> [MD parts] : DocConvert
[MD parts] --> [Drupal feed] : book-parts-to-feed
[MD parts] --> [MD eBook] : book-join
[MD parts] --> [HTML parts] : pandoc
[MD eBook] --> [HTML eBook] : pandoc
[MD eBook] --> [FB2 eBook] : calibre
[MD eBook] --> [EPUB eBook] : calibre
[MD eBook] --> [MOBI eBook] : calibre

@enduml

----------------------------------------------------------

Component diagram 2

@startuml

skinparam component {
  Style uml2
  BackgroundColor #FEFECE
}
node "Database Server" {
  database "MSSQL / ORA \n " {
    [DB] as DB
  }
}
node "Business Logic Server" {
  frame "Windows Service Host" {
    package "GUIService" {
      [GuiService] as GuiService
    }
    package "ExtService" {
      [ExtService] as ExtService
    }
  }
}
node "Update Server \n (can be hosted on \n BL Server)" {
  folder "Remote Storage" {
    [System Storage] as UpdateStorage
  }
}
node "Client Computer" {
  folder "Local Storage" {
    [System Client] as Client
  }
}
cloud "External Systems" {
  [External Systems] as ExtSystem
}

cloud "Service Locator" {
  [Service Locator] as ServiceLocator
}
cloud "OSSBSS Services" {
  [OSSBSS Services] as OSSBSS
}
cloud "Security \n (Authority \n Service)" {
  [OSSBSS Security] as Security
}
[Client]          --> [GuiService]      : WCF HTTP/TCP
[ExtSystem]       --> [ExtService]      : WCF HTTP
[GuiService]      --> [DB]              : OSSBSS.DbAccessLayer
[GuiService]      --> [UpdateStorage]   : SMB
[GuiService]      --> [Security]        : WCF
[GuiService]      --> [ServiceLocator]  : WCF
[ServiceLocator]  --> [OSSBSS]          : WCF
[ExtService]      --> [DB]              : OSSBSS.DbAccessLayer
[ExtService]      ..> [GuiService]      : inproc

@enduml

--------------------------------------------------------------------------------

State diagram

@startuml

[*]       --> proposed  : external \n request \n registered in \n host system
proposed  --> active    : request \n accepted
proposed  --> rejected  : operator \n rejected \n request
proposed  --> cancelled : request \n cancelled \n by external \n system
active    --> resolved  : new data \n assigned
active    --> proposed  : request \n reverted
active    --> cancelled : request \n cancelled \n by external \n system \n or by \n power-user, \n data \n reverted
active    --> rejected  : no tech \n capability
resolved  --> completed : assigned data \n confirmed
resolved  --> active    : in case of correction
resolved  --> cancelled : assigned data \n reverted
completed --> [*]
rejected  --> [*]
cancelled --> [*]

proposed  : New
active    : In Work
resolved  : Processed
completed : Confirmed
cancelled : Cancelled
rejected  : Rejected

@enduml
<PlantUmlDiagrams.diagram.sublime3.Sublime3Viewer object at 0x05B5B110> viewing []

error: No diagrams overlap selections.

I get the following error when using the render selection feature. I have a user config like so:

{
    "output_format": "svg",

    // The full path to the plantuml.jar file
    "jar_file": "/usr/local/Cellar/plantuml/1.2018.3/libexec/plantuml.jar"
}

Default config remains unchanged. (As an aside, the default config uses a windows path...)

error: No diagrams overlap selections.

Nothing to process.```

plantuml has been installed via homebrew and functions normally from the command line.

Collections support?

The following from PlantUML does not run, only because of the collections line

@startuml
actor Foo1
boundary Foo2
control Foo3
entity Foo4
database Foo5
collections Foo6
Foo1 -> Foo2 : To boundary
Foo1 -> Foo3 : To control
Foo1 -> Foo4 : To entity
Foo1 -> Foo5 : To database
Foo1 -> Foo6 : To collections

@enduml

Any help or is this not supported at all?

How about support of Sublime 3?

Exception: PlantUML does not appear functional
error: Unable to load diagram plugin, check console for details.
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 157, in on_api_ready
m.plugin_loaded()
File "/Users/Library/Application Support/Sublime Text 3/Packages/jvantuyl-sublime_diagram_plugin-9c079d7/diagram_plugin.py", line 26, in plugin_loaded
setup()
File "/Users/Library/Application Support/Sublime Text 3/Packages/jvantuyl-sublime_diagram_plugin-9c079d7/diagram/init.py", line 49, in setup
raise Exception('No working processors found!')
Exception: No working processors found!

Migrate to the default repositories of package_control_channel

Thanks to our tests (which were failing for your package due to unexpected BOM) it came to my attention that you didn't update your packages.json properly, especially last_modified.

I suggest you to migrate to the default repositories, which use the 3.0.0 package schema that automatically finds tags pushed to your repo.

However, these tags must be valid semantic versions (with optional leading v).

Please see wbond/package_control_channel@ebf2992 and https://github.com/wbond/package_control/blob/master/example-repository.json on how to proceed.

Pages plantuml

Hi, I would like to know why is not working the pages parameter with the plugin, it would be quite useful to be able of spliting big uml diagrams in several images.

Ex:

@startuml img/classes09.png
' Split into 4 pages
page 2x2

class BaseClass

namespace net.dummy #DDDDDD
.BaseClass <|-- Person
Meeting o-- Person

.BaseClass <|- Meeting

end namespace

namespace net.foo {
net.dummy.Person <|- Person
.BaseClass <|-- Person

net.dummy.Meeting o-- Person
}

BaseClass <|-- net.unused.Person
@enduml

BTW, amazing project.

svg support for generated plantuml images

Hi Jayson,

what do you think about adding an additional falg in the preferences for the output format of the rendered image? :) something like:

{
    "viewer" : "Preview", // Preview, QuickLook, EyeOfGnome, WindowsDefaultViewer
    "format" : "svg", // png, svg, ascii
    "check_on_startup": true,
    "charset": null // Can be "UTF-8" - to support non-latin text in diagram
}

the plantuml library already has the appropriate methods for outputting svg images :)

Reload in same Viewer

Any way to reload the resulting PNG in the same viewer window. In this case the PNG can also be overwritten IMHO. Would be better in fast iteration developing mode.

!include support

Please add -Dplantuml.include.path arg to support preprocessings like this "!include styles.wsd".

command = [
'java',
'-Dplantuml.include.path=%s' % split(self.sourceFile)[0],
'-jar',
self.proc.plantuml_jar_path,
'-pipe',
'-tpng'
]

Nothing to process...

Environment
Windows 8.1
Sublime_text 3
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) Client VM (build 25.25-b02, mixed mode, sharing)

Plugin installed with package control. Not zipped in packages folder.

Sublime gives error message

Processing diagrams in <sublime.View object at 0x0000002FC3FF4048>...
error: No diagrams overlap selections.

Nothing to process.

Running plantUML example code. Entire file or single diagrams selected. Works with plantUML by itself so it's just the plugin.

Here are some complex examples

----------------------------------------------------------

Component diagram 1

@startuml

skinparam componentStyle uml2

cloud "GoogleDocs" {
  [GDOC docs]
}

[GDOC docs] --> [DOCX docs] : Download
[DOCX docs] --> [MD parts] : DocConvert
[MD parts] --> [Drupal feed] : book-parts-to-feed
[MD parts] --> [MD eBook] : book-join
[MD parts] --> [HTML parts] : pandoc
[MD eBook] --> [HTML eBook] : pandoc
[MD eBook] --> [FB2 eBook] : calibre
[MD eBook] --> [EPUB eBook] : calibre
[MD eBook] --> [MOBI eBook] : calibre

@enduml

----------------------------------------------------------

Component diagram 2

@startuml

skinparam component {
  Style uml2
  BackgroundColor #FEFECE
}
node "Database Server" {
  database "MSSQL / ORA \n " {
    [DB] as DB
  }
}
node "Business Logic Server" {
  frame "Windows Service Host" {
    package "GUIService" {
      [GuiService] as GuiService
    }
    package "ExtService" {
      [ExtService] as ExtService
    }
  }
}
node "Update Server \n (can be hosted on \n BL Server)" {
  folder "Remote Storage" {
    [System Storage] as UpdateStorage
  }
}
node "Client Computer" {
  folder "Local Storage" {
    [System Client] as Client
  }
}
cloud "External Systems" {
  [External Systems] as ExtSystem
}

cloud "Service Locator" {
  [Service Locator] as ServiceLocator
}
cloud "OSSBSS Services" {
  [OSSBSS Services] as OSSBSS
}
cloud "Security \n (Authority \n Service)" {
  [OSSBSS Security] as Security
}
[Client]          --> [GuiService]      : WCF HTTP/TCP
[ExtSystem]       --> [ExtService]      : WCF HTTP
[GuiService]      --> [DB]              : OSSBSS.DbAccessLayer
[GuiService]      --> [UpdateStorage]   : SMB
[GuiService]      --> [Security]        : WCF
[GuiService]      --> [ServiceLocator]  : WCF
[ServiceLocator]  --> [OSSBSS]          : WCF
[ExtService]      --> [DB]              : OSSBSS.DbAccessLayer
[ExtService]      ..> [GuiService]      : inproc

@enduml

--------------------------------------------------------------------------------

State diagram

@startuml

[*]       --> proposed  : external \n request \n registered in \n host system
proposed  --> active    : request \n accepted
proposed  --> rejected  : operator \n rejected \n request
proposed  --> cancelled : request \n cancelled \n by external \n system
active    --> resolved  : new data \n assigned
active    --> proposed  : request \n reverted
active    --> cancelled : request \n cancelled \n by external \n system \n or by \n power-user, \n data \n reverted
active    --> rejected  : no tech \n capability
resolved  --> completed : assigned data \n confirmed
resolved  --> active    : in case of correction
resolved  --> cancelled : assigned data \n reverted
completed --> [*]
rejected  --> [*]
cancelled --> [*]

proposed  : New
active    : In Work
resolved  : Processed
completed : Confirmed
cancelled : Cancelled
rejected  : Rejected

@enduml

Sublime Text 3 Image Viewer

I would love to have this plugin utilize split views and the built in ST3 image viewer so that I could see live updates of my diagram (or updates on save) side-by-side with the plant uml.

some advices (8)

Hey, this is jebbs. I modified a version of my own, which makes improvements as below. Since I am a starter in python, I won't commit my code, but hope you will adopt some of them if you think it will make the plug-in better. Thank you.

  • Add setting for output file format, available: png, svg, eps, latex. This setting takes effect immediately.
  • Add preview support, generating to TEMP.

alt m for preview,
shift alt m for final output

  • In preview mode, select multiple lines to preview the selected area; select one line or select none to preview current diagram. (Auto selection of current diagram block)
  • Add diagram title (if exists) or number index (if multiple diagrams file) as suffix to file name.
  • Add ctrl r jump list support for wsd file, ensure to put "title titletext" in your diagram. It's useful when you have multiple diagrams in one file.
  • No more random file name for final output files.
  • Updated "plantuml.jar" file.
  • Brief console messages

The path problem with Package Control

I installed sublime_diagram_plugin through Package Control on macOSX. However, I can't access the example file, Settings, and Keybindings. I found that ST 3 has wrong location definition. The Package Control installed this package to ${packages}/Diagram, but the package defines its location to ${pacakges}/sublime_diagram_plugin in Main.sublime-menu. I report this issue here because of Package Control's recommendation. https://github.com/wbond/package_control_channel/pull/6970

Can't save outputted diagram

Hello,

I have created a diagram in sublime and used your plugin to generate it.

Problem is, it generates using something called "qlmanage" and theres no way of saving / printing the diagram! The only thing I can do is close it using this.

How can I save the outputted diagram?


Machine Details: 2010 Macbook Pro, Mac OS X Mountain Lion, Sublime Text 2 v2.0.1 build 2217.

includes don't work

when generating diagrams that include other files, plantuml will look for those files in the sublime package directory, instead of the opened file's directory.

can't output .png

My sublime3 has been working normally, but suddenly it cannot output pictures. It is normal to call the .jar package directly, and I cannot view the log output.

Please help

Sublime3:build 3211
Java: build 1.8.0_102-b14
Config:
{
"viewer" : "Preview",
"check_on_startup": 1,
"plantuml_server": "", //https://www.plantuml.com/plantuml/",
"jar_file": "~/.jar/plantuml.jar",
"charset": "UTF-8"
}
plantuml.jar:Version 1.2020.15

Package control says it's MISSING

Impossible to install via package control as it shows 'MISSING' status: http://shot.kim.aero/20170209150449-0cd4bbfb-71f9-4dea-a8a2-e711c1704e8b-wqLR6.png

Tried to install from repository, got the following:

error: Unable to load diagram plugin, check console for details.
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 157, in reload_plugin
    m.plugin_loaded()
  File "/Users/denis/Library/Application Support/Sublime Text 3/Packages/sublime_diagram_plugin/diagram_plugin.py", line 26, in plugin_loaded
    setup()
  File "/Users/denis/Library/Application Support/Sublime Text 3/Packages/sublime_diagram_plugin/diagram/__init__.py", line 36, in setup
    print("Viewer Setting: " + sublime_settings.get("viewer"))
TypeError: Can't convert 'NoneType' object to str implicitly
generating syntax summary

Operation Instructions?

I believe I have installed the diagram plugin. What next? I have a sample uml file, but how to visualize? Is there a hot key?

only registers .wsd files

The plugin only registers web sequence diagram (.wsd) files. Since it uses plantuml to generate the diagrams, it could as well open all plantuml files (*.pu, *.puml, *.uml, *.plantuml).

Package streching

Running on MacOSX Sierra v10.12.5, on sublime text 3 and preview as viewer, the package or node function does not display as wanted. I have no idea why actually, but on the plantuml server, the same code display as required.
screenshot 2017-06-27 13 55 58

And the one I should have:
component1

Display a picture of ...Syntax Error?... after pressing alt-m

I select the following code

 def extract_sections_from_html(self, page, BASE_URL):
        """
        Extract sections (Section->SubSection) from the html page
        """

        def _make_url(section_soup):  # FIXME: Extract from here and test
            try:
                return BASE_URL + section_soup.ul.a['href']
            except AttributeError:
                # Section might be empty and contain no links
                return None

        def _get_section_name(section_soup):  # FIXME: Extract from here and test
            try:
                return section_soup.h3.a.string.strip()
            except AttributeError:
                return None

        def _make_subsections(section_soup):
            try:
                subsections_soup = section_soup.ul.find_all("li")
            except AttributeError:
                return []
            # FIXME correct extraction of subsection.name (unicode)
            subsections = [SubSection(position=i,
                                      url=BASE_URL + s.a['href'],
                                      name=s.p.get_text().replace('current section',''))
                           for i, s in enumerate(subsections_soup, 1)]

            return subsections

        soup = BeautifulSoup(page)
        sections_soup = soup.find_all('div', attrs={'class': 'chapter'})

        sections = [Section(position=i,
                            name=_get_section_name(section_soup),
                            url=_make_url(section_soup),
                            subsections=_make_subsections(section_soup))
                    for i, section_soup in enumerate(sections_soup, 1)]
        # Filter out those sections for which name or url could not be parsed
        sections = [section for section in sections
                    if section.name and section.url]

        return sections

After pressing alt-m, it output this picture.
parsing-lh6nlt

for update

Please update to the latest version to support mind mapping. The latest plantuml does not depend on dot tools,exp :
plantuml-nodot.1.2021.2.jar

installing on Mac results in console error

Upon adding the sublime_diagram_plugin folder to Packages, Sublime Text 3 sent the following to its console (seems it's almost working):

reloading plugin sublime_diagram_plugin.diagram_plugin
error: Unable to load diagram plugin, check console for details.
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 116, in reload_plugin
m.plugin_loaded()
File "/Users//Library/Application Support/Sublime Text 3/Packages/sublime_diagram_plugin/diagram_plugin.py", line 26, in plugin_loaded
setup()
File "/Users///Library/Application Support/Sublime Text 3/Packages/sublime_diagram_plugin/diagram/init.py", line 34, in setup
print("Viewer Setting: " + sublime_settings.get("viewer"))
TypeError: Can't convert 'NoneType' object to str implicitly
generating syntax summary
no command for selector: noop:
using gpu buffer for window
SublimeLinter: annotations activated:

ST3: Unable to load diagram plugin, check console for details.

Hi,

I tried installing the plugin with Package Control (v2.0.0-alpha9) on Sublime Text 3 (build 3047), but get the following error:

reloading plugin Diagram.diagram_plugin
Viewer Setting: Preview
Loading processor class: <class 'Diagram.diagram.plantuml.PlantUMLProcessor'>
Unable to load processor: <class 'Diagram.diagram.plantuml.PlantUMLProcessor'>
Traceback (most recent call last):
File "diagram in /home/todor/.config/sublime-text-3/Installed Packages/Diagram.sublime-package", line 34, in setup
File "diagram.plantuml in /home/todor/.config/sublime-text-3/Installed Packages/Diagram.sublime-package", line 41, in load
File "diagram.plantuml in /home/todor/.config/sublime-text-3/Installed Packages/Diagram.sublime-package", line 81, in find_plantuml_jar
Exception: can't find plantuml-7963.jar
error: Unable to load diagram plugin, check console for details.
Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 115, in reload_plugin
m.plugin_loaded()
File "diagram_plugin in /home/todor/.config/sublime-text-3/Installed Packages/Diagram.sublime-package", line 26, in plugin_loaded
File "diagram in /home/todor/.config/sublime-text-3/Installed Packages/Diagram.sublime-package", line 41, in setup
Exception: No working processors found!

Hope this is useful to you in case anyone else faces the same problem.

No diagrams overlap selections.

Followed the instructions but no diagram is produced.

Environment OSX El Capitan

Steps to reproduce

  1. select plantuml text in editor
  2. press CMD-M

I get the error message:

No diagrams overlap selections

Is triggered with this code

class DisplayDiagrams(TextCommand):
    def run(self, edit):
        print("Processing diagrams in %r..." % self.view)
        if not process(self.view):
            error_message("No diagrams overlap selections.\n\n" \
                "Nothing to process.")

Unable to load configured viewer, falling back to autodetection...

After the installation, the following error appears as follows:

Viewer Setting: Preview

Loading processor class: <class 'sublime_diagram_plugin.diagram.plantuml.PlantUMLProcessor'>
Detected 'C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\sublime_diagram_plugin\diagram\plantuml.1.2018.1.jar'
Version Detection:
b'PlantUML version 1.2018.01 (Mon Jan 29 02:08:22 CST 2018)\r\n(GPL source distribution)\r\nJava Runtime: Java(TM) SE Runtime Environment\r\nJVM: Java HotSpot(TM) Client VM\r\nJava Version: 1.8.0_144-b01\r\nOperating System: Windows 10\r\nOS Version: 10.0\r\nDefault Encoding: GBK\r\nLanguage: zh\r\nCountry: CN\r\nMachine: LapTopS4KUA-Q\r\nPLANTUML_LIMIT_SIZE: 4096\r\nProcessors: 4\r\nMax Memory: 259,522,560\r\nTotal Memory: 16,252,928\r\nFree Memory: 12,276,536\r\nUsed Memory: 3,976,392\r\nThread Active Count: 1\r\n\r\nThe environment variable GRAPHVIZ_DOT has been set to C:\Program Files (x86)\Graphviz2.38\bin\dot.exe\r\nDot executable is C:\Program Files (x86)\Graphviz2.38\bin\dot.exe\r\nDot version: dot - graphviz version 2.38.0 (20140413.2041)\r\r\nInstallation seems OK. File generation OK\r\n'
PlantUML Smoke Check:
b'The environment variable GRAPHVIZ_DOT has been set to C:\Program Files (x86)\Graphviz2.38\bin\dot.exe\r\nDot executable is C:\Program Files (x86)\Graphviz2.38\bin\dot.exe\r\nDot version: dot - graphviz version 2.38.0 (20140413.2041)\r\r\nInstallation seems OK. File generation OK\r\n'
Loaded processor: <sublime_diagram_plugin.diagram.plantuml.PlantUMLProcessor object at 0x000001C52A4DDA90>
Loading viewer class from configuration: <class 'sublime_diagram_plugin.diagram.preview.PreviewViewer'>
Unable to load configured viewer, falling back to autodetection...
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\sublime_diagram_plugin\diagram_init_.py", line 59, in setup
vwr.load()
File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\sublime_diagram_plugin\diagram\preview.py", line 8, in load
raise Exception("Currently only supported on MacOS")
Exception: Currently only supported on MacOS
Trying Viewer Sublime3Viewer
Loading viewer class: <class 'sublime_diagram_plugin.diagram.sublime3.Sublime3Viewer'>
Loaded viewer: <sublime_diagram_plugin.diagram.sublime3.Sublime3Viewer object at 0x000001C52A4E46A0>
Processors: [<sublime_diagram_plugin.diagram.plantuml.PlantUMLProcessor object at 0x000001C52A4DDA90>]
Viewer: <sublime_diagram_plugin.diagram.sublime3.Sublime3Viewer object at 0x000001C52A4E46A0>

The default configuration error of the Diagram.sublime-settings file is checked

"Viewer": "Preview", after changing to Sublime3Viewer, the problem is solved

render file if nothing was selected

Hi,

thanks for the plugin. Works like a charm when selecting a block of text. Is it possible to try to render the whole file if no selection was detected ?

I am using plain text files to create diagrams ... the need to select the text first destroys the "flow"...

thanks anyway, Julian

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.