GithubHelp home page GithubHelp logo

joethei / obsidian-plantuml Goto Github PK

View Code? Open in Web Editor NEW
355.0 5.0 17.0 138 KB

Generate PlantUML Diagrams inside Obsidian.md

License: MIT License

TypeScript 95.46% JavaScript 3.26% CSS 1.28%
plantuml obsidian obsidian-md obsidian-plugin

obsidian-plantuml's Introduction

PlantUML Support for Obsidian

Maintenance GitHub manifest.json dynamic (path) libera manifesto

Render PlantUML Diagrams in Obsidian


Demonstration

This plugin uses either the PlantUML Online Server, or a local .jar file for rendering.

You can also host your own server (Docker / JEE / PicoWeb) and specify its address in the settings.

Please note that using the local rendering method is not as performant as using a server.

Usage

Create a fenced codeblock using plantuml as the language. Specify your plantuml code inside. To generate a diagram with higher resolution use plantuml-svg

You can also use plantuml-ascii to generate ASCII Art.

Documentation on Plantuml can be found on plantuml.com

Linking to notes in vault

Since the syntax for weblinks in PlantUML is the same for as for Wikilinks in Obsidian, a special syntax is used: [[[Your other note]]] For the content of such a link refer to the obisidian documentation.

Normal web links are described here

Including an .puml file

⚠️ Only works when using local rendering

This works just as describe in the official documentation.

Examples

```plantuml
Bob -> Alice : hello
Alice -> Wonderland: hello
Wonderland -> next: hello
next -> Last: hello
Last -> next: hello
next -> Wonderland : hello
Wonderland -> Alice : hello
Alice -> Bob: hello
```

results in:

```plantuml-ascii
Bob -> Alice : hello
Alice -> Wonderland: hello
Wonderland -> next: hello
next -> Last: hello
Last -> next: hello
next -> Wonderland : hello
Wonderland -> Alice : hello
Alice -> Bob: hello
```

results in:

     ┌───┐          ┌─────┐          ┌──────────┐          ┌────┐          ┌────┐
     │Bob│          │Alice│          │Wonderland│          │next│          │Last│
     └─┬─┘          └──┬──┘          └────┬─────┘          └─┬──┘          └─┬──┘
       │    hello      │                  │                  │               │   
       │──────────────>│                  │                  │               │   
       │               │                  │                  │               │   
       │               │      hello       │                  │               │   
       │               │─────────────────>│                  │               │   
       │               │                  │                  │               │   
       │               │                  │       hello      │               │   
       │               │                  │ ─────────────────>               │   
       │               │                  │                  │               │   
       │               │                  │                  │     hello     │   
       │               │                  │                  │ ──────────────>   
       │               │                  │                  │               │   
       │               │                  │                  │     hello     │   
       │               │                  │                  │ <──────────────   
       │               │                  │                  │               │   
       │               │                  │       hello      │               │   
       │               │                  │ <─────────────────               │   
       │               │                  │                  │               │   
       │               │      hello       │                  │               │   
       │               │<─────────────────│                  │               │   
       │               │                  │                  │               │   
       │    hello      │                  │                  │               │   
       │<──────────────│                  │                  │               │   
     ┌─┴─┐          ┌──┴──┐          ┌────┴─────┐          ┌─┴──┐          ┌─┴──┐
     │Bob│          │Alice│          │Wonderland│          │next│          │Last│
     └───┘          └─────┘          └──────────┘          └────┘          └────┘

Known issues

Not all methods of using PlantUML support all different diagrams. Following are a few known issues.

  • ASCII can only ever generate Sequence diagrams
  • The PicoWeb server does not support clickable links in png diagrams
  • Some languages like chinese are not rendered correctly -> Switch to SVG rendering

Installation

Settings > Community plugins > Community Plugins > Browse and search for PlantUML.

obsidian-plantuml's People

Contributors

blacktau avatar joethei avatar michalgawlikaws avatar zhang-stephen 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

obsidian-plantuml's Issues

Support using local shell command in settings

Is your feature request related to a problem? Please describe.

First of all, I'm using plantuml installed by homebrew, which will create a shell command, not just a jar file.

$ brew info plantuml
==> plantuml: stable 1.2023.5 (bottled)
Draw UML diagrams
https://plantuml.com/
...

$ which plantuml
/usr/local/bin/plantuml

The problem is, every time I upgrade plantuml , the local jar file path will change,
like /usr/local/Cellar/plantuml/1.2023.5/libexec/plantuml.jar,
I have to update the "Local Jar" settings to the new path every time.

Describe the solution you'd like

support using shell command-line in 'Local JAR" setting, like /usr/local/bin/plantuml.
If the value is not end with .jar, which means it's not a jar path, using the value as command directly.

Describe alternatives you've considered

Add a new setting for command-line plantuml,
but there will be a priority issue.

Additional context

Syntax Highlighting

Oh man I love this.. if only it offered Syntax Highlighting like VS Code. If only...

Plugin fails to load in a new Obsidian installation

What happened?

I am a new Obsidian user, trying to using it on top of MacOS.

I installed obsidian-plantuml and every time I try to enable it I get an error from Obsidian:

Failed to load plugin obsidian-plantuml

In the developer tools console I get:

app.js:1 Plugin failure: obsidian-plantuml TypeError: a is not a constructor
    at t.<anonymous> (app.js:1)
    at app.js:1
    at Object.next (app.js:1)
    at s (app.js:1)

Obsidian version

0.13.23

Plugin version

1.5.0

What distribution are you seeing the problem on?

Desktop

Are you using a local .jar or a remote server

local .jar

Relevant log output

app.js:1 Plugin failure: obsidian-plantuml TypeError: a is not a constructor
    at t.<anonymous> (app.js:1)
    at app.js:1
    at Object.next (app.js:1)
    at s (app.js:1)

Generating PlantUML diagram/Unable to locate a Java Runtime

Is your feature request related to a problem? Please describe.

When trying to use the plugin with a local JAR on macOS, I get only Generating PlantUML diagram while in the console I see:

VM659:5157 Uncaught (in promise) Error: The operation couldn�t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.


    at ChildProcess.eval (eval at <anonymous> (app.js:1:1494667), <anonymous>:5157:20)
    at ChildProcess.emit (node:events:402:35)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)

Removing the path to the JAR (/usr/local/Cellar/plantuml/1.2022.4/libexec/plantuml.jar) makes it work.

Describe the solution you'd like

Being able to specify a JAR and have it working.

Describe alternatives you've considered

I tried to figure out how to add the path to the java executable manually, but couldn't figure out where.
which java gives me /usr/bin/java, inspecting the plantuml wrapper installed by Homebrew as shown below gives a different path to the java runtime.

#!/bin/bash
if [[ "$*" != *"-gui"* ]]; then
  VMARGS="-Djava.awt.headless=true"
fi
GRAPHVIZ_DOT="/usr/local/opt/graphviz/bin/dot" exec "/usr/local/opt/openjdk/bin/java" $VMARGS -jar /usr/local/Cellar/plantuml/1.2022.4/libexec/plantuml.jar "$@"

Additional context

  • plantuml 1.2022.4
  • plugin version: 1.6.2
  • Obsidian version: 0.14.6

/opt/local/bin/dot not found on homebrew-installed graphviz on Apple Silicon

Is your feature request related to a problem? Please describe.
When deployed on MacOS and with graphviz installed by homebrew, dot executable is in /opt/homebrew/bin/dot and not in /opt/local/bin so when using local jar, dot cannot be found.

Describe the solution you'd like
Additional settings field with path to dot executable and then to use '-graphvizdot' plantuml argument to pass custom path.

Describe alternatives you've considered
Tried to symlink /opt/homebrew/bin/dot to /opt/local/bin but didn't worked.

Additional context
I've created PR with proposed changes: #45

Zoom not working for PNG, large diagrams are cut

Is your feature request related to a problem? Please describe.
I have a larger diagram for which when rendering with plantuml the font is rather small. I get the magnification arrow, but when I click nothing happens. Furthermore, depending on the diagram type, it is cut at the bottom (this is rendered with @startmindmap, with @startwbs the cutoff does not happen):

Screenshot 2022-05-09 at 09 00 04

Describe the solution you'd like
Full diagram with Zoom buttons and/or the possibility to define the final size of the image.

Describe alternatives you've considered
plantuml-svg gives only the large diagram, which is definitely much more readable.

Could relative path to local .jar file be accepted in this plugin?

Is your feature request related to a problem? Please describe.

plantuml.com is blocked by firewall of my workplace, so I have to download plantuml.jar to render plant UML codes.

Describe the solution you'd like

I just want know, could the relative path of plantuml.jar be accepted? e.g. the ./tools/plantuml.jar, and ./ means the root path of current vault of obsidian. or the absolute path is <vault>/tools/plant.jar?

I tried this but not worked. and I have read you code and found that local jar has higher priority than server URL.

Describe alternatives you've considered

I have no alternative method except use absolute path.

Additional context

SVG works, PNG does not

Is your feature request related to a problem? Please describe.

A diagram with some level of complexity does not render locally as PNG, though SVG seems to work.
All that is displayed is "Generating PlantUML diagram" and there is an error thrown on the console (see below).

Describe the solution you'd like

PNG would be nice b/c Image Toolkit allows me to copy an image to the system clipboard to paste into other apps.

Describe alternatives you've considered

As a workaround, I can put the code into a temporary file, then run plantuml.jar, which works but is klunky.

Additional context

There is some whining in the console wrt exceeding a quota. I captured debug output from the console:

obsidian.md-1661466216414.log

Option to always use SVG processor

Is your feature request related to a problem? Please describe.

I want to always have high-res SVG diagrams. But I don't want to use ```plantuml-svg as that's not compatible with other Markdown processors (e.g., VS Code); I'd like to use ```plantuml as usual.

Describe the solution you'd like

Offer a setting that makes plantuml act as plantuml-svg. Maybe you could then offer plantuml-png for symmetry and completeness.

Describe alternatives you've considered

Additional context

I actually don't see a reason to use lower-res PNG. Is there an advantage that I'm missing? Perhaps there's a good reason this is the default?

Error if path to local plantuml.jar contains non-ascii symbols.

My directory for attachments contains non-ascii symbols. Obsidian work with it correctly. But when I try to use this path for plantuml plugin console contains the following error:

plugin:obsidian-plantuml:5147 Uncaught (in promise) Error: Error: Unable to access jarfile C:\Users\user\OneDrive - Name\Obsidian\???????\plantuml-1.2022.5.jar

    at ChildProcess.eval (plugin:obsidian-plantuml:5147:20)
    at ChildProcess.emit (node:events:402:35)
    at maybeClose (node:internal/child_process:1064:16)
    at Socket.<anonymous> (node:internal/child_process:450:11)
    at Socket.emit (node:events:390:28)
    at Pipe.<anonymous> (node:net:687:12)

Center resulting image

Hi,
I would like to center the resulting image.
Putting <center> ... </center> around the code doesn't work because it will view the plantuml code as plain text.

Is there a way to do that?

Thanks

different result of yaml data between obsidian preview and PlantUML Web Server

test code:

@startyaml
root:
	-
		attr1: value1
		attr2: value2
	-
		attr3: value3
		attr4: value4
	- ...
@endyaml

It looks like this from PlantUML Web Server
image

and looks like this from obsidian preview
image

I guess this is due to the eol. So I try open the markdown file with a hex-editor. Then I find the file uses LF, but my laptop runs Windows.
Is this the problem?

add control of how picture aligns in the context

Is your feature request related to a problem? Please describe.

When the server return the rendered pictures, it's aligned to the left by default. But in most circumstance, I'd like the picture aligned to the middle, maybe it's because the picture is displayed in the code block rather than context?

Describe the solution you'd like

I wonder if we can have control of where picture aligns by adding left/middle/right tags somewhere or in configs. Thanks a lot!

Describe alternatives you've considered

Additional context

Feature request: Option to export a rendered diagram locally

Is your feature request related to a problem? Please describe.
Sometimes I want to put multiple diagrams in my notes so that it is easier to understand what I'm writing about for myself. Sometimes I need to send the diagrams to others and I'd like to do so without sending the entire md file.

Describe the solution you'd like
The ability to export a rendered diagram using some sort of context menu.

Describe alternatives you've considered
Having plantuml installed locally is a hassle, especially when they are technically already rendered and stored in the document.

Cached images

Hi, this looks like a very useful plugin, thanks!

Do you have any plans to cache the results so the images aren't regenerated unless needed?

Documents only displaying "Generating PlantUML diagram" with release 1.5.1 update

What happened?

Post 1.5.1 upgrade all diagrams are not rendering only leaving a message, "Generating PlantUML diagram. The issue persists when creating a simple markdown with only the PlantUML tags and simple diagram.

Obsidian version

v0.13.23

Plugin version

1.5.1

What distribution are you seeing the problem on?

Desktop

Are you using a local .jar or a remote server

server

Relevant log output

app.js:1 Obsidian Developer Console
main.ts:103 Dataview: Version 0.4.26 Loaded
main.ts:20 Loading natural language date parser plugin
main.ts:31 Loading Note Refactor plugin
main.ts:30 loading markdown-table-editor plugin
VM229:5309 loading plugin plantuml
index.ts:154 Dataview: Task & metadata parsing queued in 0.066s.
VM229:66 Uncaught (in promise) undefined
rejected @ VM229:66
Promise.then (async)
step @ VM229:69
eval @ VM229:70
__async @ VM229:54
DebouncedProcessors.png @ VM229:5211
e @ app.js:1
enter @ app.js:1
t.iterate @ app.js:1
update @ app.js:1
(anonymous) @ app.js:1
hr @ app.js:1
t @ app.js:1
t.applyTransaction @ app.js:1
get @ app.js:1
t.update @ app.js:1
_dispatch @ app.js:1
t.dispatch @ app.js:1
t.set @ app.js:1
e.setViewData @ app.js:1
e.setData @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
s @ app.js:1
Promise.then (async)
l @ app.js:1
(anonymous) @ app.js:1
D @ app.js:1
e.loadFileInternal @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
D @ app.js:1
e.onLoadFile @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
D @ app.js:1
e.onLoadFile @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
D @ app.js:1
e.loadFile @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
D @ app.js:1
e.setState @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
D @ app.js:1
e.setState @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
s @ app.js:1
Promise.then (async)
l @ app.js:1
(anonymous) @ app.js:1
D @ app.js:1
e.setViewState @ app.js:1
eval @ VM191:74
o @ VM191:23
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
D @ app.js:1
e.openFile @ app.js:1
e.onFileClick @ app.js:1
s @ app.js:1
Show 32 more frames
VM229:66 Uncaught (in promise) undefined
rejected @ VM229:66
Promise.then (async)
step @ VM229:69
eval @ VM229:70
__async @ VM229:54
DebouncedProcessors.png @ VM229:5211
e @ app.js:1
enter @ app.js:1
t.iterate @ app.js:1
update @ app.js:1
(anonymous) @ app.js:1
hr @ app.js:1
t @ app.js:1
t.applyTransaction @ app.js:1
get @ app.js:1
t.update @ app.js:1
_dispatch @ app.js:1
t.dispatch @ app.js:1
blur @ app.js:1
t.runCustomHandlers @ app.js:1
(anonymous) @ app.js:1
e.setEphemeralState @ app.js:1
e.setEphemeralState @ app.js:1
e.setEphemeralState @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
s @ app.js:1
Promise.then (async)
l @ app.js:1
(anonymous) @ app.js:1
D @ app.js:1
e.setViewState @ app.js:1
eval @ VM191:74
o @ VM191:23
checkCallback @ app.js:1
SR @ app.js:1
t.executeCommandById @ app.js:1
eval @ VM191:74
o @ VM191:23
t.onTrigger @ app.js:1
t.handleKey @ app.js:1
t.onKeyEvent @ app.js:1
index.html:1 Uncaught (in promise) undefined
Promise.then (async)
h @ app.js:1
t.onRender @ app.js:1
requestAnimationFrame (async)
Be @ app.js:1
t.queueRender @ app.js:1
t.set @ app.js:1
e.set @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
s @ app.js:1
Promise.then (async)
l @ app.js:1
(anonymous) @ app.js:1
D @ app.js:1
e.setMode @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
D @ app.js:1
e.setState @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
D @ app.js:1
e.setViewState @ app.js:1
eval @ VM191:74
o @ VM191:23
checkCallback @ app.js:1
SR @ app.js:1
t.executeCommandById @ app.js:1
eval @ VM191:74
o @ VM191:23
t.onTrigger @ app.js:1
t.handleKey @ app.js:1
t.onKeyEvent @ app.js:1

Does not render on Obsidian for Android and IOS

First of all thank you for this plugin I, much enjoy it on the desktop.
On mobile devices however the diagrams are not rendered.

Steps to reproduce:
use the plantuml diagram from the example in the READMe

Bob -> Alice : hello
Alice -> Wonderland: hello
Wonderland -> next: hello
next -> Last: hello
Last -> next: hello
next -> Wonderland : hello
Wonderland -> Alice : hello
Alice -> Bob: hello

I tested on Mac Os, Linux and Windows, Android and IOS Apps, (all the latest version). Consistently its working on the Desktop Apps but not in the mobile ones. On mobile you are shown the plain plantuml markup snippet instead of the rendered diagram

Using local jar leaks in Electron local storage

Using the local JAR option, the images seem to be stored in cache in Electron's local storage.

However, they don't seem to get cleaned up which eventually leads to exceeded quota errors and being unable to render diagrams.

Reproduction is pretty simple. Just modify a diagram repeatedly and see the list grow here :

image

Please add local cache file support

Hello,
I use local jar to render the uml, if a file contains more than 20 blocks of plantuml, it will start 20 java processes at once, it will cause computer crash.
I think there is not need to real-time render the uml, instead generate uml in queue, and storage cache file in vault, when the plantuml block hash change, then regenerate the image and storage again.
Thank!

Cannot work with Pandoc Plugin. TypeError: Cannot read property 'path' of null

What happened?

Version 1.5.1 cannot use Pandoc Plugin (version 0.25) exporting files from HTML.
Have tried plantuml and plantuml-svg. Perfect display in Obsidian, but cannot generate DOCX, PPT, HTML via Pandoc Plugin.

Obsidian version

13.31

Plugin version

1.51

What distribution are you seeing the problem on?

Desktop

Are you using a local .jar or a remote server

server

Relevant log output

main.ts:160 TypeError: Cannot read property 'path' of null
    at t.getDirectParent (app.js:1)
    at Replacer.getFullPath (eval at <anonymous> (app.js:1), <anonymous>:4876:42)
    at Replacer.getPath (eval at <anonymous> (app.js:1), <anonymous>:4880:17)
    at DebouncedProcessors.eval (eval at <anonymous> (app.js:1), <anonymous>:5233:81)
    at Generator.next (<anonymous>)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:70:61)
    at new Promise (<anonymous>)
    at __async (eval at <anonymous> (app.js:1), <anonymous>:54:10)
    at DebouncedProcessors.processor (eval at <anonymous> (app.js:1), <anonymous>:5220:54)
    at DebouncedProcessors.eval (eval at <anonymous> (app.js:1), <anonymous>:5212:18)
eval @ main.ts:160
rejected @ tslib.es6.js:74
Promise.then (async)
step @ tslib.es6.js:75
eval @ tslib.es6.js:76
__awaiter @ tslib.es6.js:72
startPandocExport @ main.ts:88
checkCallback @ main.ts:49
WR @ app.js:1
t.onChooseItem @ app.js:1
t.onChooseSuggestion @ app.js:1
t.selectSuggestion @ app.js:1
e.useSelectedItem @ app.js:1
(anonymous) @ app.js:1
e.handleKey @ app.js:1
e.onKeyEvent @ app.js:1

Local .jar file

Is your feature request related to a problem? Please describe.

  • Using the local .jar file causes random syntax not to render properly
  • Using plantuml-1.2022.14.jar
  • Below the syntax which is working with the server but gives attaced screenshot-result

Describe the solution you'd like

  • Should work same as using server

Describe alternatives you've considered

  • None

Additional context

Code

Dependency

[SpaceShip] .> [Input]

Dependency relationship implies that two elements are dependent on each other. It is used to reflect that one class interacts with another one, receives an instance this class as a method parameter. Compared to Association, Dependency relationship is weaker.

Implementation

[IGameElement] <<Interface>>
[SpaceShip] .up.|> [IGameElement]

Interface implementation.

Result

image

Issue with external links

Is your feature request related to a problem? Please describe.
If I have an external link such as [[https://this.site.come/stuff/morestuff#directtosomestuff ⇨]] Obsidian wants to create a note for it instead of just opening the link.

Describe the solution you'd like
I'd like the above to work and If I'm being stupid, then please forgive me 😄

Describe alternatives you've considered
I would not know of an alternate... It works perfectly in vscode

Additional context
SYSTEM INFO:
Obsidian version: v0.15.9
Installer version: v0.15.9
Operating system: Darwin Kernel Version 21.6.0: Sat Jun 18 17:05:47 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T8101 21.6.0
Login status: logged in
Catalyst license: vip
Insider build toggle: on
Live preview: on
Legacy editor: off
Base theme: light
Community theme: Minimal
Snippets enabled: 26
Restricted mode: off
Plugins installed: 79
Plugins enabled: 60

Links are not rendered correctly in gantt diagrams

Is your feature request related to a problem? Please describe.
Links added to tasks are occasionally not rendered properly. Plant UML Web server renders it correctly, it is also rendered correctly when generated .svg is embedded inside obsidian note.

Example chart:

@startgantt
print between 2023-04-12 and 2023-09-09
Project starts 2023-04-12
[task_1] starts 2023-04-12 and ends 2023-06-25 and links to [[https://github.com/joethei/obsidian-plantuml]]
[task_2] starts 2023-05-25 and ends 2023-06-25 and links to [[https://google.com]]
[task_3] starts 2023-06-05 and ends 2023-06-25 and links to [[https://youtube.com]]
@endgantt

https://www.plantuml.com/plantuml/svg/bP11Qe0m44NtdY8NIAEn5jgLH-XUf2GwQ3JEY9bGUljQCLBS2Tdap_ptOEh0PkF187EsRWvPME1l01GwrwNCNsMXXS7-_BxlB_lSQ8AEnL4D_nQpXasOluesZMuCm3vbRr9NH-OTpa4mYQOPcTVmeTJWU8psfQD5JGGyWbDaW-kTGRbwWnmNtxQdJDzarGv-92CQFFp9BcIPa5SzVuJyeSZH9cQzjuxx_W80

Describe the solution you'd like

Describe alternatives you've considered

Additional context

Fails to generate diagram with multiple internal Wikilinks

What happened?

Everything works for a single link and links to external sources. Once I add multiple internal Wikilinks it keeps showing Generating PlantUML diagram.
Example:

```plantuml-svg
Bob -> Alice : [[[test1]]]
Alice -> Wonderland: [[[test2]]]
Wonderland -> next: hello
next -> Last: hello
Last -> next: hello
next -> Wonderland : hello
Wonderland -> Alice : hello
Alice -> Bob: hello
```

Obsidian version

0.13.23

Plugin version

1.5.1

What distribution are you seeing the problem on?

Desktop

Are you using a local .jar or a remote server

server

Relevant log output

app.js:1 Uncaught (in promise) TypeError: Cannot read property 'path' of null
    at t.getObsidianUrl (app.js:1)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:4863:35)
    at String.replace (<anonymous>)
    at Replacer.replaceLinks (eval at <anonymous> (app.js:1), <anonymous>:4860:17)
    at DebouncedProcessors.eval (eval at <anonymous> (app.js:1), <anonymous>:5233:39)
    at Generator.next (<anonymous>)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:70:61)
    at new Promise (<anonymous>)
    at __async (eval at <anonymous> (app.js:1), <anonymous>:54:10)
    at DebouncedProcessors.processor (eval at <anonymous> (app.js:1), <anonymous>:5220:54)
    at DebouncedProcessors.eval (eval at <anonymous> (app.js:1), <anonymous>:5218:18)
    at Generator.next (<anonymous>)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:70:61)
    at new Promise (<anonymous>)
    at __async (eval at <anonymous> (app.js:1), <anonymous>:54:10)
    at DebouncedProcessors.svg (eval at <anonymous> (app.js:1), <anonymous>:5217:37)

Support local rendering

It would be great if it was possible to render diagrams using a local version of Plantuml (in addition to cloud rendering). Some of my diagrams are proprietary and it would be preferred to avoid transferring that data over the wire to a thirdparty. Also, using a local version would more easily enable the inclusion of local files (#4).

Currently, I rely on a VSCode plugin to handle my rendering outside of Obsidian. It offers both cloud and local rendering; so I wonder if it is possible to repurpose some of their code in this plugin.

PDF Export

Is your feature request related to a problem? Please describe.
Actually when I try to export the Markdown notes into a PDF file, the PDF doesn't include the PlantUML diagram.

Describe the solution you'd like
I'd like the diagram can be include in the PDF file.

Describe alternatives you've considered
Maybe download the PNG image automatically when we export into PDF to include the diagram more easily.

Additional context

Render PlantUML in Obsidian Publish

I no little to nothing about CSS javascript etc., but is there a way to enable the PlantUML diagrams to render when markdown published on Obsidian Publish? Any tips appreciated?

Failed to enable plugin in 1.0

Describe the bug
On startup Obsidian does not enable this plugin. Manually enabling on the list of installed plugins fails and shows a "Failed to enable plugin" toast. Going into the Community Plugin list and pressing the enable button there causes the same error, but the plugin enables and functions correctly despite the error.

To Reproduce
Steps to reproduce the behavior:

  1. Install the latest Obsidian (1.0.3) on Windows or Linux
  2. Install the latest version of this plugin
  3. Attempt to enable the plugin
  4. See error in console
app.js:1 Plugin failure: obsidian-plantuml DOMException: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.
    at r4.<anonymous> (app://obsidian.md/app.js:1:1032505)
    at app://obsidian.md/app.js:1:235201
    at Object.next (app://obsidian.md/app.js:1:235306)
    at a (app://obsidian.md/app.js:1:234045)

Expected behavior
I expect the plugin to be enabled on startup.

Environment:

  • OS: Windows and Linux.
  • Obsidian Version: 1.0.3

Cannot update

Cannot update to v. 1.2.0 (as mentioned in obsidian).
Latest version on your site: 1.1.2.

Copy to clipboard

Hi,

I like the plugin a lot, but I'm missing a possibility to use the rendered diagram in a different program (f.e. mail) to share it.

I think the easiest possibility would be to include a button as overlay which when clicked copies the img into the clipboard.

another option would be to save the rendered img somewhere in the vault in full resolution to make it available on filesystem.

maybe I'm just missing something -- in that case, pls give me a hint ;)

well done - really extremely helpful! thx 100x

CORS error when fetching ascii from official server

Access to fetch at 'https://plantuml.com/plantuml/txt/JSf12W8n343H_O1tY0Teiv-5e3TfOvWKqdP8KmOz_…oAoynpi55lpiqZzOfva1p9thZFgi65Am-iQJWR_efUkTlsDuIln8zSbaVF46vmrq8CAmYhzkK4' from origin 'app://obsidian.md' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Markdown syntax is not working

Hi, thanks for the plugin !
The markdown syntax from the doc (with tabs) is not working:

@startmindmap
* root node
	* some first level node
		* second level node
		* another second level node
	* another first level node
@endmindmap

but using this syntax is ok:

 @startmindmap
* root node
** some first level node
*** second level node
**** another second level node
** another first level node
 @endmindmap

is it a correct behavior?

Plugin doesn't understand paths with spaces

I've put plantuml.jar in attachment folder inside obsidian valet.
And valet in OneDrive folder from our organization. And it name contains spaces.
If I try to set path to this plantuml.jar I got an error:

plugin:obsidian-plantuml:5147 Uncaught (in promise) Error: Error: Unable to access jarfile C:\Users\user\OneDrive

    at ChildProcess.eval (plugin:obsidian-plantuml:5147:20)
    at ChildProcess.emit (node:events:402:35)
    at maybeClose (node:internal/child_process:1064:16)
    at Socket.<anonymous> (node:internal/child_process:450:11)
    at Socket.emit (node:events:390:28)
    at Pipe.<anonymous> (node:net:687:12)

After OneDrive following path with spaces.
I've tried to use absolute path and path like [[plantuml.jar]] - result is the same.

Is that possible to switch output from PNG to SVG?

Hi, the plugin is amazing for UML. thanks for your effort!
But I found some issues even on Plantuml online service:

  1. Hyperlink will be lost
  2. The image is too small to recognize while the UML is big
  3. some language is not rendered well, such as Chinese

but online service solved all those problems if we choose SVG instead of PNG, could we switch to that?

Internal links open up new vault

Is your feature request related to a problem? Please describe.

Linking internally as per the instructions opens up the vault again instead of opening up the linked page in another tab
Describe the solution you'd like

to behave as expected
Describe alternatives you've considered

Additional context

I have tried this with local jar and with plantuml server same result

Local jar file didn't works

Is your feature request related to a problem? Please describe.
I try to use the plugin with an local jar file. With a local file configured the rendering stops working and only the message "Generating PlantUML diagram" appears.
Here is an small sample vault with configuration and description in it. PlantUMLTest.zip

Describe the solution you'd like
I want to use the plugin with local jar file. Do I use a wrong jar file or is it a bug in the plugin?

Describe alternatives you've considered
If I use the wrong jar file, maybe there should be a link / description which file is the correct one. A Option for automatically downloading the file would also been an nice feature. The file could be saves in the folder of the plugin. (I save my personally vault in a git repository and I don't want to save the big jar file in my repo, but the plugin should run with an local jar file on all of my computer where I use my vault.)

Additional context

  • Obsidian v0.15.9
  • java --version
openjdk 11.0.16 2022-07-19
OpenJDK Runtime Environment (build 11.0.16+8-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.16+8-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)
  • Operation system: Linux Mint 20.3

"Inline" plant UML file rendering

When designing my system architecture using plantUML (just a quick thank you for making this extension), I would preferably store my UML in a separate file. I then use VS code while designing my diagrams.

Would it be possible to use Obisidiante inline (I'm not sure of the exact terminology) links and render the .pu files?

Hopefully, the image below demonstrates what I mean.
image

Compatibility with pandoc lua filters

The pandoc lua filters allow passing additional attributes to the code block.

An example from their Readme (space at the end added by me for rendering in Github):

```{.plantuml caption="This is an image, created by **PlantUML**." width=50%}
@startuml
Alice -> Bob: Authentication Request Bob --> Alice: Authentication Response
Alice -> Bob: Another authentication Request Alice <-- Bob: another Response
@enduml
`` `

As they use another identifier for the code block, the plugin currently ignores it.

It would be nice, if the plugin could at least render such code blocks as plantuml diagrams.

Add debounce

Hello!

I have noticed that when I operate in split screen (one with the rendered PlantUML diagram and the other with the text) that when I make edits to the diagram the remote plantuml server will eventually quit responding for a short period of time. I think that this is because it is rightfully rate-limiting me.

Is it possible to add a debounce time that could be set in the settings? It would also save on data for people on expensive/limited connections.

I love this plugin and use it all across my vault to help conceptualize ideas, thanks for your work! ❤️

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.