{"id":20660964,"url":"https://github.com/liatemplates/plantuml","last_synced_at":"2026-03-19T16:59:46.733Z","repository":{"id":107256840,"uuid":"185989095","full_name":"LiaTemplates/plantUML","owner":"LiaTemplates","description":"A set of macros for plotting diagrams with plantUML in LiaScript","archived":false,"fork":false,"pushed_at":"2024-08-29T15:05:32.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-17T12:16:29.530Z","etag":null,"topics":["diagram","liascript","liascript-template","plantuml","template","uml"],"latest_commit_sha":null,"homepage":"https://liascript.github.io/course/?https://raw.githubusercontent.com/liaTemplates/plantuml/master/README.md","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LiaTemplates.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-10T13:00:24.000Z","updated_at":"2024-08-29T15:05:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"701f26e8-3a20-4f45-9ccb-37e72d4adf8b","html_url":"https://github.com/LiaTemplates/plantUML","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FplantUML","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FplantUML/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FplantUML/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FplantUML/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LiaTemplates","download_url":"https://codeload.github.com/LiaTemplates/plantUML/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242787898,"owners_count":20185188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["diagram","liascript","liascript-template","plantuml","template","uml"],"created_at":"2024-11-16T19:06:38.786Z","updated_at":"2025-12-25T03:07:50.607Z","avatar_url":"https://github.com/LiaTemplates.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\nauthor:   André Dietrich\n\nemail:    LiaScript@web.de\n\nversion:  0.0.11\n\nlanguage: en\n\nnarrator: US English Male\n\ncomment:  A set of macros for plotting diagrams with plantUML in LiaScript. See\n          also https://plantuml.com for more information.\n\nscript:   https://cdn-0.plantuml.com/synchro2.min.js\n\n@onload\n\nwindow.cleanDitaa = function(code) {\n  const pattern = /@startuml\\nditaa/g \n  if(code.match(pattern)) {\n    return code.replace(pattern, \"@startditaa\").replace(/@enduml/g, \"@endditaa\")\n  }\n  return code\n}\n\n@end\n\n@plantUML: @plantUML.exec(svg,```@0```)\n\n@plantUML.svg: @plantUML.exec(svg,```@0```)\n\n@plantUML.png: @plantUML.exec(png,```@0```)\n\n@plantUML.exec\n\u003cscript run-once modify=\"false\"\u003e\nfunction draw(type, code, counter = 10) {\n  try {\n    let s = unescape(encodeURIComponent(window.cleanDitaa(code)));\n    var arr = [];\n    for (let i = 0; i \u003c s.length; i++) {\n      arr.push(s.charCodeAt(i));\n    }\n    let compressor = new Zopfli.RawDeflate(arr);\n    let compressed = compressor.compress();\n    let dest = \"https://www.plantuml.com/plantuml/\" + type + \"/\" + encode64_(compressed);\n\n    setTimeout(function() {\n      send.lia(\"HTML: \u003cimg style='max-width: 100%' src='\" + dest + \"' onclick='window.LIA.img.click(\\\"\" + dest + \"\\\")'\u003e\")\n    }, 100)\n  } catch(e) {\n    if (counter \u003e 0) {\n      setTimeout(function() {\n        draw(type, code, counter - 1)\n      }, 500)\n    } else {\n      send.lia(\"LIA: stop\")\n    }\n  }\n}\n\n\ndraw(\"@0\", `@'1`)\n\u003c/script\u003e\n\n\u003cspan\u003e\n\u003cimg id=\"plant@0\" src=\"@0\" style=\"display:none\"\u003e\n\u003c/span\u003e\n\n@end\n\n\n@plantUML.eval\n\u003cscript\u003e\nfunction draw(type, code, counter = 10) {\n  try {\n    let s = unescape(encodeURIComponent(window.cleanDitaa(code)));\n    var arr = [];\n    for (let i = 0; i \u003c s.length; i++) {\n      arr.push(s.charCodeAt(i));\n    }\n    let compressor = new Zopfli.RawDeflate(arr);\n    let compressed = compressor.compress();\n    let dest = \"https://www.plantuml.com/plantuml/\" + type + \"/\" + encode64_(compressed);\n\n    console.html(\"\u003cimg style='max-width: 100%' src='\" + dest + \"' onclick='window.LIA.img.click(\\\"\" + dest + \"\\\")'\u003e\")\n    console.log(dest)\n\n    send.lia(\"LIA: stop\")\n  } catch(e) {\n    if (counter \u003e 0) {\n      setTimeout(function() {draw(type, code, counter - 1)}, 100)\n    } else {\n      send.lia(\"LIA: stop\")\n    }\n  }\n}\n\n\ndraw(\"@0\", `@'input`)\n\"\"\n\u003c/script\u003e\n@end\n\n\n--\u003e\n\n# plantUML\n\n                         --{{0}}--\n\nA template for including plantUML diagrams into\n[LiaScript](https://liascript.github.io) courses. See the following links for\nfurther information and documentation:\n\n                          {{0-1}}\n* See the plantUML docs [here...](http://plantuml.com)\n* See the Github version of this document\n  [here...](https://github.com/liascript-templates/plantUML)\n* See the LiaScript version of this document\n  [here...](https://liascript.github.io/course/?https://raw.githubusercontent.com/liascript-templates/plantUML/master/README.md)\n\n\n                         --{{1}}--\nThere are three ways to use this template. The easiest way is to use the\n`import` statement and the URL of the raw text-file of the master branch or any\nother branch or version. But you can also copy the required functionality\ndirectly into the header of your Markdown document, see therefor the\n[last slide](#6). And of course, you could also clone this project and change\nit, as you wish.\n\n                           {{1}}\n1. Load the macros via\n\n   `import: https://raw.githubusercontent.com/liascript-templates/plantUML/master/README.md`\n\n   to import the latest version, but the API might change in the future, to load\n   this specific version load:\n\n   `import: https://github.com/LiaTemplates/plantUML/blob/0.0.11/README.md`\n\n2. Copy the definitions into your Project\n\n3. Clone this repository on GitHub\n\n## `@plantUML`\n\n                         --{{0}}--\nSimply call the macro `@plantUML` in block-notation, thus, directly within the\nheader of the code-block. The code block should contain the code for the UML\ndiagram. The code is then directly evaluated and translated into a plantUML-URL.\n\n```text @plantUML\n@startuml\nBob -\u003e Alice : hello\n@enduml\n```\n\nThe default image type is `svg`, however, you can overwrite this or make it\nexplicit, by calling either `@plantUML.png` or `@plantUML.svg`. SVG might cause\nsome problems in some browsers.\n\n```text @plantUML.png\n@startuml\nditaa\n             Daten                 Daten\n               |                     |\n               |                     |\n+--------------|---------------+     |\n| +------+     |               |     |     Funktionsauswahl\n| |      |     |               :     |        F_0 F_1 F_2\n| |      V     V               V     V         |   |   | Zielregister\n| | +----+-----+-----+    +----+-----+-----+   |   |   |  auswahl\n| | |cBFB Register A |    |cBFB Register B |   |   |   |     Z\n| | +---+------------+    +---------+------+   |   |   |     |\n| |     |                           |          |   |   |     |\n| |     |        +------------------+          |   |   |     |\n| |     |        |                  |          |   |   |     |\n| |     +--------+-----------+      |          |   |   |     |\n| |     |        |           |      |          |   |   |     |\n| |     V        V           V      V          |   |   |     |\n| | +----------------+    +----------------+   |   |   |     |\n| | |c808            |\u003c-  |c808            |\u003c--+   |   |     |\n| | | Demultiplexer  |\u003c-  | Demultiplexer  |\u003c------+   |     |\n| | |                |\u003c-  |                |\u003c----------+     |\n| | ++-+-+-+-+-+-+-+-+    ++-+-+-+-+-+-+-+-+                 |\n| |  | | | | | | | |       | | | | | | | |                   |\n| |  | | | | | | | |       V V V V V V V V                   |\n| |  | | | | | | | +----------------------------------+      |\n| |  | | | | | | +-----------------------------+      |      |\n| |  | | | | | +------------------------+      |      |      |\n| |  | | | | +-------------------+      |      |      |      |\n| |  | | | +--------------+      |      |      |      |      |\n| |  | | +---------+      |      |      |      |      |      |\n| |  | +----+      |      |      |      |      |      |      |\n| |  |      |      |      |      |      |      |      |      |\n| |  |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |\n| |  V  V   V  V   V  V   V  V   V  V   V  V   V  V   V  V   |\n| | +----+ +----+ +----+ +----+ +----+ +----+ +----+ +----+  |\n| | | 000| | 001| | 010| | 011| | 100| | 101| | 110| | 111|  |\n| | |cFF4| |cFF4| |cFF4| |cFF4| |cFF4| |cFF4| |cFF4| |cFF4|  |\n| | | OR | |AND | |EXOR| |ADD | |SUB | |MUL | |DIV | | SL |  |\n| | +-+--+ +-+--+ +-+--+ +-+--+ +-+--+ +-+--+ +-+--+ +-+--+  |\n| |   :      :      :      :      :      :      :      :     |\n| |   +------+------+------+---+--+------+------+------+     |\n| |                            |                             |\n| |                            V                             |\n| |                 +----------+----------+                  |\n| |                 |cCCB DeMuxer/Selektor|\u003c-----------------+\n| |                 +---+-+---------------+\n| |                     : :                     |      |\n| +---------------------+ |                   --+---+--+\n|                         |                         | Status\n+-------------------------+                         v S\n@enduml\n```\n\n\n\n\n## `@plantUML.eval`\n\n                         --{{0}}--\nUse a code-block with plantUML code and add the macro `@plantUML.eval` to the\nend of that block to get and editor, which contains the code and by clicking\nonto play, you trigger its evaluation. You have to pass the parameter `svg` or\n`png` to tell service, wheather you want to have an svg or png image back. The\ndisplayed URL is also the source of the image.\n\n\n```\n@startuml\n\nabstract class AbstractList\nabstract AbstractCollection\ninterface List\ninterface Collection\n\nList \u003c|-- AbstractList\nCollection \u003c|-- AbstractCollection\n\nCollection \u003c|- List\nAbstractCollection \u003c|- AbstractList\nAbstractList \u003c|-- ArrayList\n\nclass ArrayList {\n  Object[] elementData\n  size()\n}\n\nenum TimeUnit {\n  DAYS\n  HOURS\n  MINUTES\n}\n\nannotation SuppressWarnings\n\n@enduml\n```\n@plantUML.eval(png)\n\n## Implementation\n\n                         --{{0}}--\nThe two main-macros make use of `@plantUML.exec` which receives two parameters.\nThe first one is a unique id and the second one contains the code.\n\n````html\nscript:   https://cdn-0.plantuml.com/synchro2.min.js\n\n@onload\n\nwindow.cleanDitaa = function(code) {\n  const pattern = /@startuml\\nditaa/g \n  if(code.match(pattern)) {\n    return code.replace(pattern, \"@startditaa\").replace(/@enduml/g, \"@endditaa\")\n  }\n  return code\n}\n\n@end\n\n@plantUML: @plantUML.exec(svg,```@0```)\n\n@plantUML.svg: @plantUML.exec(svg,```@0```)\n\n@plantUML.png: @plantUML.exec(png,```@0```)\n\n@plantUML.exec\n\u003cscript run-once modify=\"false\"\u003e\nfunction draw(type, code, counter = 10) {\n  try {\n    let s = unescape(encodeURIComponent(window.cleanDitaa(code)));\n    var arr = [];\n    for (let i = 0; i \u003c s.length; i++) {\n      arr.push(s.charCodeAt(i));\n    }\n    let compressor = new Zopfli.RawDeflate(arr);\n    let compressed = compressor.compress();\n    let dest = \"https://www.plantuml.com/plantuml/\" + type + \"/\" + encode64_(compressed);\n\n    setTimeout(function() {\n      send.lia(\"HTML: \u003cimg style='max-width: 100%' src='\" + dest + \"' onclick='window.LIA.img.click(\\\"\" + dest + \"\\\")'\u003e\")\n    }, 100)\n  } catch(e) {\n    if (counter \u003e 0) {\n      setTimeout(function() {\n        draw(type, code, counter - 1)\n      }, 500)\n    } else {\n      send.lia(\"LIA: stop\")\n    }\n  }\n}\n\n\ndraw(\"@0\", `@1`)\n\u003c/script\u003e\n\n\u003cspan\u003e\n\u003cimg id=\"plant@0\" src=\"@0\" style=\"display:none\"\u003e\n\u003c/span\u003e\n\n@end\n\n\n@plantUML.eval\n\u003cscript\u003e\nfunction draw(type, code, counter = 10) {\n  try {\n    let s = unescape(encodeURIComponent(window.cleanDitaa(code)));\n    var arr = [];\n    for (let i = 0; i \u003c s.length; i++) {\n      arr.push(s.charCodeAt(i));\n    }\n    let compressor = new Zopfli.RawDeflate(arr);\n    let compressed = compressor.compress();\n    let dest = \"https://www.plantuml.com/plantuml/\" + type + \"/\" + encode64_(compressed);\n\n    console.html(\"\u003cimg style='max-width: 100%' src='\" + dest + \"' onclick='window.LIA.img.click(\\\"\" + dest + \"\\\")'\u003e\")\n    console.log(dest)\n\n    send.lia(\"LIA: stop\")\n  } catch(e) {\n    if (counter \u003e 0) {\n      setTimeout(function() {draw(type, code, counter - 1)}, 100)\n    } else {\n      send.lia(\"LIA: stop\")\n    }\n  }\n}\n\n\ndraw(\"@0\", `@input`)\n\"\"\n\u003c/script\u003e\n@end\n````\n\n                         --{{1}}--\nIf you want to minimize loading effort in your LiaScript project, you can also\ncopy this code and paste it into your main comment header, see the code in the\nraw file of this document.\n\n{{1}} https://raw.githubusercontent.com/liascript-templates/plantUML/master/README.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliatemplates%2Fplantuml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliatemplates%2Fplantuml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliatemplates%2Fplantuml/lists"}