{"id":13418748,"url":"https://github.com/esimov/diagram","last_synced_at":"2025-05-16T18:10:10.903Z","repository":{"id":45062228,"uuid":"99112874","full_name":"esimov/diagram","owner":"esimov","description":"CLI app to convert ASCII arts into hand drawn diagrams.","archived":false,"fork":false,"pushed_at":"2025-05-12T17:07:23.000Z","size":6408,"stargazers_count":850,"open_issues_count":0,"forks_count":34,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-05-12T18:24:26.411Z","etag":null,"topics":["ascii","ascii-art","canvas","cli","diagram","drawing","go","gocui","golang","termbox-go","terminal"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/esimov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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,"zenodo":null},"funding":{"github":"esimov"}},"created_at":"2017-08-02T12:14:38.000Z","updated_at":"2025-05-12T17:07:27.000Z","dependencies_parsed_at":"2025-04-13T05:04:42.262Z","dependency_job_id":"0927204b-fdd5-46f1-a001-f3ac66aee63e","html_url":"https://github.com/esimov/diagram","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esimov%2Fdiagram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esimov%2Fdiagram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esimov%2Fdiagram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esimov%2Fdiagram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/esimov","download_url":"https://codeload.github.com/esimov/diagram/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254582907,"owners_count":22095518,"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":["ascii","ascii-art","canvas","cli","diagram","drawing","go","gocui","golang","termbox-go","terminal"],"created_at":"2024-07-30T22:01:06.527Z","updated_at":"2025-05-16T18:10:10.896Z","avatar_url":"https://github.com/esimov.png","language":"Go","funding_links":["https://github.com/sponsors/esimov"],"categories":["Go","Repositories","Programming Languages","Editors, Drawing \u0026 Diagramming"],"sub_categories":["Go","Imported: Upstream Snippet Gallery"],"readme":"# Diagram\r\n[![Go Reference](https://pkg.go.dev/badge/github.com/esimov/diagram.svg)](https://pkg.go.dev/github.com/esimov/diagram)\r\n[![build](https://github.com/esimov/diagram/actions/workflows/build.yml/badge.svg)](https://github.com/esimov/diagram/actions/workflows/build.yml)\r\n[![Go Report Card](https://goreportcard.com/badge/github.com/esimov/diagram)](https://goreportcard.com/report/github.com/esimov/diagram)\r\n[![license](https://img.shields.io/github/license/esimov/diagram)](./LICENSE)\r\n\r\nDiagram is a small CLI application to generate hand drawn diagrams from ASCII art.\r\n\r\n![screencast](images/screencast.gif)\r\n\r\n## Installation\r\n\r\nIn order to run the application please make sure that Go is installed on your local machine and check if `$GOPATH/bin` is included into the `PATH` directory.\r\n\r\nRun the following commands to download the project and build the executable.\r\n\r\n```bash\r\n$ git clone https://github.com/esimov/diagram\r\n$ cd diagram\r\n$ go build\r\n\r\n# Start the application\r\n$ diagram\r\n```\r\n\r\n#### Build\r\n\r\nA shell script is bundled into the library to mitigate the generation of binary files for the most known operating systems, but take care: different dependencies are needed for different operating systems. To build the executable file run:\r\n\r\n`$ make all`\r\n\r\n## Usage\r\n\r\nOnce you are inside the terminal application you can create, edit or delete the ASCII diagrams. By pressing `CTRL+g` you can convert the ASCII art into a handwritten diagram. The generated `PNG` file will be saved into the `output` folder relative to the current path.\r\n\r\n### Command Line support\r\n\r\nThe application also supports the generation of hand drawn diagrams directly from command line without to enter into the CLI application.\r\n\r\n`$ diagram --help` will show the currently supported options:\r\n\r\n```bash\r\n┌┬┐┬┌─┐┌─┐┬─┐┌─┐┌┬┐\r\n │││├─┤│ ┬├┬┘├─┤│││\r\n─┴┘┴┴ ┴└─┘┴└─┴ ┴┴ ┴\r\n    Version: 1.0.6\r\n\r\nCLI app to convert ASCII arts into hand drawn diagrams.\r\n\r\n  -font string\r\n    \tPath to the font file (default \"/Users/esimov/Projects/Go/src/github.com/esimov/diagram/font/gloriahallelujah.ttf\")\r\n  -in string\r\n    \tSource\r\n  -out string\r\n    \tDestination\r\n  -preview\r\n    \tShow the preview window (default true)\r\n```\r\n\r\n#### CLI Examples\r\n\r\nRead input from `sample.txt` and write image to `sample.png` showing a preview window with the hand drawn diagram:\r\n\r\n```bash\r\ndiagram -in sample.txt -out sample.png\r\n```\r\n\r\nRead input from `sample.txt` and write image to `sample.png`, and exit immediately without showing a preview window:\r\n\r\n```bash\r\ndiagram -in sample.txt -out sample.png -preview=false\r\n```\r\n\r\nGenerate diagram as above but use a font at a different location:\r\n\r\n```bash\r\ndiagram -in sample.txt -out sample.png -preview=false -font /path/to/my/font/MyHandwriting.ttf\r\n```\r\n\r\n### Key bindings\r\nKey                                     | Action\r\n----------------------------------------|---------------------------------------\r\n\u003ckbd\u003eF1\u003c/kbd\u003e                           | Show/hide help panel\r\n\u003ckbd\u003eTab\u003c/kbd\u003e                          | Next Panel\r\n\u003ckbd\u003eShift+Tab\u003c/kbd\u003e                    | Previous Panel\r\n\u003ckbd\u003eCtrl+s\u003c/kbd\u003e                       | Open Save Diagram Modal\r\n\u003ckbd\u003eCtrl+s\u003c/kbd\u003e                       | Save Diagram\r\n\u003ckbd\u003eCtrl+d\u003c/kbd\u003e                       | Convert Ascii to PNG\r\n\u003ckbd\u003eCtrl+x\u003c/kbd\u003e                       | Clear the editor content\r\n\u003ckbd\u003eCtrl+z\u003c/kbd\u003e                       | Restore the editor content\r\n\u003ckbd\u003ePageUp\u003c/kbd\u003e                       | Jump to the top\r\n\u003ckbd\u003ePageDown\u003c/kbd\u003e                     | Jump to the bottom\r\n\u003ckbd\u003eHome\u003c/kbd\u003e                         | Jump to the line start\r\n\u003ckbd\u003eEnd\u003c/kbd\u003e                          | Jump to the line end\r\n\u003ckbd\u003eDelete/Backspace\u003c/kbd\u003e             | Delete diagram\r\n\u003ckbd\u003eCtrl+c\u003c/kbd\u003e                       | Quit\r\n\r\n### Example\r\n| Input | Output |\r\n|:--:|:--:|\r\n| \u003cimg src=\"https://user-images.githubusercontent.com/883386/29396424-9200a978-8320-11e7-9c60-17d2be989136.png\" height=\"300\"\u003e | \u003cimg src=\"https://user-images.githubusercontent.com/883386/29396385-529a23a4-8320-11e7-9d70-bf9b33d769cc.png\" height=\"300\"\u003e |\r\n\r\nThe application was tested on **Ubuntu**, **MacOS** and **Windows**.\r\n\r\n### Acknowledgements\r\nThe ASCII to PNG conversion was ported from [shaky.dart](https://github.com/mraleph/moe-js/blob/master/talks/jsconfeu2012/tools/shaky/web/shaky.dart).\r\n\r\n## Dependencies\r\n\r\n- https://github.com/jroimartin/gocui\r\n- https://github.com/fogleman/gg\r\n- https://gioui.org/\r\n\r\n## Author\r\n\r\n* Endre Simo ([@simo_endre](https://twitter.com/simo_endre))\r\n\r\n## License\r\n\r\nCopyright © 2017 Endre Simo\r\n\r\nThis project is under the MIT License. See the [LICENSE](https://github.com/esimov/diagram/blob/master/LICENSE) file for the full license text.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesimov%2Fdiagram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fesimov%2Fdiagram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesimov%2Fdiagram/lists"}