MCPcopy
hub / github.com/skanaar/nomnoml

github.com/skanaar/nomnoml @v1.7.0 sqlite

repository ↗ · DeepWiki ↗ · release v1.7.0 ↗
665 symbols 2,100 edges 53 files 0 documented · 0%
README

nomnoml npm version Known Vulnerabilities web site =======

Hello, this is nomnoml, a tool for drawing UML diagrams based on a simple syntax. It tries to keep its syntax visually as close as possible to the generated UML diagram without resorting to ASCII drawings.

Created by Daniel Kallin with help from a group of contributors.

Library

The nomnoml javascript library can render diagrams on your web page. The only dependency is graphre. Install nomnoml using either npm or good old script inclusion.

SVG output in NodeJS

npm install nomnoml
var nomnoml = require('nomnoml')
var src = '[nomnoml] is -> [awesome]'
console.log(nomnoml.renderSvg(src))

In the SVG output the node name is attached to SVG shapes and <g> containers with data-name attribute. You can use this to implement interactive diagrams.

document.querySelector('svg').onclick = function (e) {
  console.log(e.target.closest('g[data-name]')?.attributes['data-name'])
}

HTML Canvas rendering target

<script src="https://github.com/skanaar/nomnoml/raw/v1.7.0/unpkg.com/graphre/dist/graphre.js"></script>
<script src="https://github.com/skanaar/nomnoml/raw/v1.7.0/unpkg.com/nomnoml/dist/nomnoml.js"></script>

<canvas id="target-canvas"></canvas>
<script>
  var canvas = document.getElementById('target-canvas')
  var source = '[nomnoml] is -> [awesome]'
  nomnoml.draw(canvas, source)
</script>

Command Line Interface

npx nomnoml exposes the SVG renderer with a command-line interface. This mode also supports the #import: <filename> directive for dividing complex diagrams into multiple files.

npx nomnoml input-file.noml

Web application

The nomnoml web application is a simple editor with a live preview. It is purely client-side and uses your browser's localStorage, so your diagram should be here the next time you visit (but no guarantees).

Example

This is how the Decorator pattern can look in nomnoml syntax:

[<frame>Decorator pattern|
  [<abstract>Component||+ operation()]
  [Client] depends --> [Component]
  [Decorator|- next: Component]
  [Decorator] decorates -- [ConcreteComponent]
  [Component] <:- [Decorator]
  [Component] <:- [ConcreteComponent]
]

Association types

-    association
->   association
<->  association
-->  dependency
<--> dependency
-:>  generalization
<:-  generalization
--:> implementation
<:-- implementation
+-   composition
+->  composition
o-   aggregation
o->  aggregation
-o)  ball and socket
o<-) ball and socket
->o  ball and socket
--   note
-/-  hidden

Classifier types

[name]
[<abstract> name]
[<instance> name]
[<reference> name]
[<note> name]
[<package> name]
[<frame> name]
[<database> name]
[<pipe> name]
[<start> name]
[<end> name]
[<state> name]
[<choice> name]
[<sync> name]
[<input> name]
[<lollipop> lollipop]
[<sender> name]
[<socket> socket]
[<receiver> name]
[<transceiver> name]
[<actor> name]
[<usecase> name]
[<label> name]
[<hidden> name]
[<table> name| a | 5 || b | 7]

Comments

Comments are supported at the start of a line.

//[commented]
[not //commented]

Id attribute

Two distinct nodes can have the same display name with the id attribute.

[<actor id=a>User]
[<actor id=b>User]
[a] -- [b]

Directives

#import: my-common-styles.nomnoml
#arrowSize: 1
#bendSize: 0.3
#direction: down | right
#gutter: 5
#edgeMargin: 0
#gravity: 1
#edges: hard | rounded
#background: transparent
#fill: #eee8d5; #fdf6e3
#fillArrows: false
#font: Calibri
#fontSize: 12
#leading: 1.35
#lineWidth: 3
#padding: 8
#spacing: 40
#stroke: #33322E
#title: filename
#zoom: 1
#acyclicer: greedy
#ranker: network-simplex | tight-tree | longest-path

Custom classifier styles

A directive that starts with "." define a classifier style. The style is written as a space separated list of modifiers and key/value pairs.

#.box: fill=#8f8 dashed
#.blob: visual=ellipse title=bold
[<box> GreenBox]
[<blob> HideousBlob]

Modifiers

dashed
empty

Key/value pairs

fill=(any css color)

stroke=(any css color)

align=center
align=left

direction=right
direction=down

visual=actor
visual=class
visual=database
visual=ellipse
visual=end
visual=frame
visual=hidden
visual=input
visual=none
visual=note
visual=package
visual=pipe
visual=receiver
visual=rhomb
visual=roundrect
visual=sender
visual=start
visual=table
visual=transceiver

Style title and text body with a comma separated list of text modifiers

title=left,italic,bold
body=center,italic,bold

Text modifiers

bold
center
italic
left
underline

Contributing

If you want to contribute to the project, more info is available in CONTRIBUTING.md.

Extension points exported contracts — how you extend this code

GraphStore (Interface)
(no doc) [6 implementers]
webapp/FileSystem.ts
Chainable (Interface)
(no doc) [1 implementers]
src/Graphics.ts
ISvgGraphics (Interface)
(no doc) [1 implementers]
src/GraphicsSvg.ts
Config (Interface)
(no doc)
src/domain.ts
Rect (Interface)
(no doc)
src/nomnoml.ts
ICanvasGraphics (Interface)
(no doc)
src/GraphicsCanvas.ts
ParsedDiagram (Interface)
(no doc)
src/parser.ts
Vec (Interface)
(no doc)
src/vector.ts

Core symbols most depended-on inside this repo

part
called by 122
test/utils.js
node
called by 102
test/utils.js
deepEqual
called by 96
test/assert.js
lt
called by 86
codemirror/codemirror-compressed.js
Je
called by 61
codemirror/codemirror-compressed.js
Rl
called by 56
codemirror/codemirror-compressed.js
from
called by 55
webapp/Route.ts
O
called by 54
codemirror/codemirror-compressed.js

Shape

Function 488
Method 121
Class 30
Interface 26

Languages

TypeScript100%

Modules by API surface

codemirror/codemirror-compressed.js342 symbols
webapp/FileSystem.ts39 symbols
src/Graphics.ts36 symbols
src/linearParse.ts23 symbols
src/GraphicsSvg.ts22 symbols
src/nomnoml.ts17 symbols
webapp/App.ts15 symbols
webapp/CanvasPanner.ts12 symbols
webapp/FileMenu.tsx11 symbols
src/terminators.ts11 symbols
src/parser.ts11 symbols
src/visuals.ts10 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

@rollup/plugin-commonjs28.0.1 · 1×
@rollup/plugin-node-resolve15.3.0 · 1×
@rollup/plugin-terser0.4.4 · 1×
@rollup/plugin-typescript12.1.1 · 1×
@types/node22.10.1 · 1×
@types/react18.3.12 · 1×
@types/react-dom18.3.1 · 1×
file-saver2.0.5 · 1×
graphre0.1.3 · 1×
react18.3.1 · 1×
react-dom18.3.1 · 1×
rollup4.28.0 · 1×

For agents

$ claude mcp add nomnoml \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact