{"id":20671130,"url":"https://github.com/allnulled/skemator","last_synced_at":"2025-03-10T17:22:17.463Z","repository":{"id":49725723,"uuid":"208241468","full_name":"allnulled/skemator","owner":"allnulled","description":"To build diagrams via scripting.","archived":false,"fork":false,"pushed_at":"2021-06-10T10:34:43.000Z","size":1318,"stargazers_count":2,"open_issues_count":10,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-17T23:34:38.704Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/allnulled.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-13T10:17:44.000Z","updated_at":"2022-07-17T19:23:48.000Z","dependencies_parsed_at":"2022-09-12T23:22:18.786Z","dependency_job_id":null,"html_url":"https://github.com/allnulled/skemator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fskemator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fskemator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fskemator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fskemator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allnulled","download_url":"https://codeload.github.com/allnulled/skemator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242889634,"owners_count":20201995,"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":[],"created_at":"2024-11-16T20:25:20.882Z","updated_at":"2025-03-10T17:22:17.442Z","avatar_url":"https://github.com/allnulled.png","language":"JavaScript","readme":"# skemator\n\nTo build diagrams via scripting.\n\n## Index\n\n- [Introduction](#introduction)\n- [Installation](#installation)\n- [Get started](#get-started)\n- [Usage](#usage)\n   - [CLI](#cli)\n   - [API](#api)\n   - [Browser](#browser)\n- [Language](#language)\n- [Versioning](#versioning)\n- [Issues](#issues)\n- [License](#license)\n\n## Introduction\n\nWelcome to the **`skemator` official documentation**.\n\nBy `skemator`, we can refer to:\n\n  - **Skemator Project**: this whole set of tools.\n  - **Skemator Language**: the programming language implementation of `skemator`.\n  - **Skemator CLI**: the command-line interface of `skemator`.\n  - **Skemator API**: the abstract programming interface of `skemator`.\n\n## Installation\n\n`$ npm i -g skemator`\n\n## Get started\n\nTo start working with `skemator`, create the following file called `example1.skm`:\n\n```\n#L2R\n[This]\n [is]\n  ==\u003e[imagination]=i1\n   [or]=o1\n    [reality]=r1\n  ==\u003e[reality]=r2\n   [or]=o2\n    [imagination]=i2\n@i1 .-\u003e @i2\n@r1 .-\u003e @r2\n\n```\n\n(Use double quotes to wrap special characters, like `.`, `-`, or others that can arise errors.)\n\n\nThen, from the console, you can type this to generate an image from your `*.skm` file:\n\n`$ skemator compile example1.skm --png`\n\nAutomatically, a `example1.png` will be generated beside `example1.skm`. It should look like:\n\n![A complete diagram](./test/example.png)\n\n## Usage\n\nBelow, the CLI and API usages are explained.\n\n### CLI\n\nThe `skemator CLI` brings some powerful shortcuts. With it, we can:\n\n- Compile `*.skm` to `*.mmd`, `*.png`, `*.svg`, `*.pdf`\n- Compile `*.plantuml` to `*.png`\n- Compile `index.md` to `book.md`\n- Compile `*.bkm` to a real files and folders\n\nSo, this tool can be useful for anyone who works with `skm`, `bkm`, `plantuml` and `md`.\n\n#### Help\n\nThe help for all the commands:\n\n```\nUsage:\n  skemator \u003ccommand\u003e \u003cargs\u003e [options]\n\nCommands:\n  skemator compile \u003cfiles..\u003e      Compile skemator files\n  skemator compile:uml \u003cfiles..\u003e  Compile plantuml files\n  skemator compile:book \u003cfile\u003e    Compile markdown files recursively in 1\n  skemator create:book \u003cfolder\u003e   Create a book in a folder (by a script\n                                  optionally)\n\nOptions:\n  --version  Show version number                                       [boolean]\n  --verbose                                           [boolean] [default: false]\n  --help     Show help                                                 [boolean]\n```\n\nThe help to compile a `*.skm` file to `*.mmd` (and `*.pdf`, `*.png`, `*.svg`):\n\n```\nskemator compile \u003cfiles..\u003e\n\nCompile skemator files\n\nOptions:\n  --version    Show version number                                     [boolean]\n  --verbose                                           [boolean] [default: false]\n  --help       Show help                                               [boolean]\n  --pdf                                               [boolean] [default: false]\n  --png                                               [boolean] [default: false]\n  --svg                                               [boolean] [default: false]\n  --watch, -w                                         [boolean] [default: false]\n  --command                                                 [default: \"compile\"]\n```\n\nThe help to compile a `*.uml` or `*.plantuml` file into `*.png`:\n\n```\nskemator compile:uml \u003cfiles..\u003e\n\nCompile plantuml files\n\nOptions:\n  --version    Show version number                                     [boolean]\n  --verbose                                           [boolean] [default: false]\n  --help       Show help                                               [boolean]\n  --watch, -w                                         [boolean] [default: false]\n  --command                                              [default: \"compileUML\"]\n```\n\nThe help to compile a book (into a `book.md` file from an `index.md` file):\n\n```\nskemator compile:book \u003cfile\u003e\n\nCompile markdown files recursively in 1\n\nOptions:\n  --version    Show version number                                     [boolean]\n  --verbose                                           [boolean] [default: false]\n  --help       Show help                                               [boolean]\n  --title                                             [boolean] [default: false]\n  --index                                             [boolean] [default: false]\n  --watch, -w                                         [boolean] [default: false]\n  --command                                             [default: \"compileBook\"]\n```\n\nThe help to create a book (optionally using a `*.bkm` script):\n\n```\nskemator create:book \u003cfolder\u003e\n\nCreate a book in a folder (by a script optionally)\n\nOptions:\n  --version     Show version number                                    [boolean]\n  --verbose                                           [boolean] [default: false]\n  --help        Show help                                              [boolean]\n  --script, -s                                          [string] [default: null]\n  --watch, -w                                         [boolean] [default: false]\n  --command                                              [default: \"createBook\"]\n```\n\n#### Compile example\n\nExample: it compiles `first.skm second.skm third.skm` and generates the `*.mmd *.png *.svg *.pdf` files.\n\n`$ skemator compile first.skm second.smk third.skm --png --svg --pdf`\n\n#### Watch example\n\nExample: it watches `first.skm second.skm third.skm` for changes and generates the `*.mmd *.png *.svg *.pdf` files.\n\n`$ skemator compile first.skm second.smk third.skm --png --svg --pdf --watch`\n\n### API\n\nThe API shares all the options accepted by the CLI, but passed in a JavaScript object to the `Skemator.execute` static method as unique parameter. The `command` property is reserved by this software, and it indicates which method needs to be statically invoked by the `Skemator` class, and this way we can dispatch all the commands from the same method.3\n\n#### Import module\n\n```js\nconst Skemator = require(\"skemator\");\n```\n\n#### Compile example\n\nExample: compiles `first.skm second.skm third.skm` and generates the `*.mmd *.png *.svg *.pdf` files.\n\n```js\nSkemator.execute({\n  command: \"compile\",\n  files: [\"first.skm\", \"second.smk\", \"third.skm\"]\n  png: true,\n  svg: true,\n  pdf: true\n});\n```\n\n#### Watch example\n\nExample: watches `first.skm second.skm third.skm` for changes and generates the `*.mmd *.png *.svg *.pdf` files.\n\n```js\nSkemator.execute({\n  command: \"watch\",\n  files: [\"first.skm\", \"second.smk\", \"third.skm\"]\n  png: true,\n  svg: true,\n  pdf: true\n});\n```\n\n### Browser\n\nBrowser is not supported yet.\n\n\u003c!--\n\nFor browser usage, import normally the package.\n\n#### Compile (from browser) example\n\nIn browsers, we only have this method, which in Windows gives problems...\n\n```js\nSkemator.fromSkematorToSvg(\"#L2R\\n[Hello]\\n [World]\\n  [!]=0\\n\").then(code =\u003e {\n  console.log(code.svg);\n  console.log(code.mmd);\n});\n```\n--\u003e\n\n## Language\n\nEvery script read by this tool follows a specific set of grammar rules.\n\nEvery script is composed by the header (options, currently the direction) and the body.\n\n### Script options\n\nEach option has a new line character ('\\n') at the end of it.\n\n#### Diagram direction option\n\nOne of:\n\n- `#L2R`: from left to right\n- `#R2L`: from right to left\n- `#T2B`: from top to bottom\n- `#B2T`: from bottom to top\n\n### Script body\n\nEvery body of a script is composed by sentences.\n\nEvery sentence is finished with a new line character (`\\n`).\n\nBelow, the different types of sentences are explained.\n\n#### Sentence type 1: Node sentence\n\nNode: `  --some message--\u003e[Node]=id`\n\n...where...\n\n- `  ` is the tabulation. **Optional**.\n- `--some message` is the message of the relation with its parent. **Optional**.\n- `--\u003e` is the type of the relation with its parent. Optional, but needed for the message. It can be:\n  - `--\u003e` which is an arrow\n  - `.-\u003e` which is a dotted arrow\n  - `==\u003e` which is a bold arrow\n  - `---` which is a line\n- `[Node]` is the of the node (`[`, `]`) and its text content (`Node`). **Required**. It can be:\n  - `[...]` which is a square\n  - `\u003c...\u003e` which is a diammond\n  - `{...}` which is a rounded square\n  - `(...)` which is a circle\n- `=id` is the identifier for the node. **Optional**.\n\n...or, alternatively...\n\nNode: `  --some message--\u003e@id`\n\n...where...\n\n- `  ` is the tabulation. **Optional**. It indicates in which level of the main tree is set this node. With the tabulation, we implicitly overstand a relation between this node and its corresponding parent in the tree, and this way we do not need to explicitly code every time this implicit relation.\n- `--some message` is the message of the relation with its parent. **Optional**.\n- `--\u003e` is the type of the relation with its parent. **Optional**, but needed for the message.\n- `@id` is the identifier for the node. **Required**.\n\n#### Sentence type 2: Relation sentence\n\nNode: `[Some node]--some message--\u003e@someOtherNode`\n\n...where...\n\n- `[Some node]` is the node source of the relation. **Required**. Any type of node is accepted.\n- `--some message` is the message of the relation with its parent. **Optional**.\n- `--\u003e` is the type of the relation with its parent. **Required**.\n- `@someOtherNode` is the node destination of the relation. **Required**. Any type of node is accepted.\n\n*Note: each sentence ends with a new line (`\\n`), included the last one.*\n\n## Versioning\n\nThis projects adheres to the [semmantic versioning 2.0](https://semver.org/) of `MAJOR.MINOR.PATCH`.\n\n## Issues\n\nPlease, share the issues you found in the corresponding section of the package. Thank you.\n\n## Changelog\n\nChanges from version to version are available in the `CHANGELOG.md` file in the root.\n\n## License\n\nThis license is tied to the license of [mermaid](#) and other libraries.\n\nBut the part developed by me is `WTFL` (which means *meh*).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallnulled%2Fskemator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallnulled%2Fskemator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallnulled%2Fskemator/lists"}