{"id":20878667,"url":"https://github.com/ochko/markdoc","last_synced_at":"2025-05-07T04:10:28.685Z","repository":{"id":30230728,"uuid":"33781840","full_name":"ochko/markdoc","owner":"ochko","description":"Markdown with flowchart and sequence diagram","archived":false,"fork":false,"pushed_at":"2022-06-15T04:39:33.000Z","size":62,"stargazers_count":60,"open_issues_count":4,"forks_count":18,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-01T04:27:02.468Z","etag":null,"topics":["documentation","markdown","pseudocode","svg"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/ochko.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}},"created_at":"2015-04-11T15:53:19.000Z","updated_at":"2025-03-28T06:19:17.000Z","dependencies_parsed_at":"2022-08-30T03:21:24.217Z","dependency_job_id":null,"html_url":"https://github.com/ochko/markdoc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ochko%2Fmarkdoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ochko%2Fmarkdoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ochko%2Fmarkdoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ochko%2Fmarkdoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ochko","download_url":"https://codeload.github.com/ochko/markdoc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252810273,"owners_count":21807759,"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":["documentation","markdown","pseudocode","svg"],"created_at":"2024-11-18T07:13:43.775Z","updated_at":"2025-05-07T04:10:28.666Z","avatar_url":"https://github.com/ochko.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Markdoc\n\nA markdown to html converter with sequence diagram and flowchart support. Generating documents including diagrams has advantages:\n\n- Docs can be checked into version control like source code, and can compare changes effectively as it is all text\n- Making and updating diagrams using drawing software is slow\n\nIt converts markdown codeblocks for diagrams using [Graphviz](http://www.graphviz.org). Pseudocode to Graphviz is inspired by this [gist](https://gist.github.com/antimatter15/1841460). Pseudocode is converted to dot file and then Graphviz's `dot` program converts it to vector image.\n\n## System requirements\n\n- Ruby 2.7.6 and up\n- Graphviz (tested with dot version 3.0.0)\n\n#### OS X\n\n`$ brew install graphviz`\n\n#### Linux (debian, ubuntu)\n\n`$ apt-get install graphviz`\n\n#### Linux (fedora, rhel or centos)\n\n`$ yum install graphviz`\n\n\n## Installing\n\n`$ gem install markdoc`\n\nFor bundler add `gem markdoc` to your Gemfile.\n\n\n## Usage\n\n`$ markdoc document.md \u003e document.html`\n\nGenerated html includes inline svg diagrams, eliminating need for attached image files. It provides 3 executables:\n- `markdoc` converts markdown document to html\n- `pseudo2svg` converts pseudocode to svg image (see below for pseudocode format)\n- `sequence2svg` converts sequence diagram spec to svg image(see below for sequence diagram spec format)\n\n### Pseudocode blocks\n\nCurrently it supports only `if/else` branch logic, but you can achieve a lot with it.\n\n```\nif ConditionN\n  Action-A\n  Action-B\nelse\n  Action-C\nend\n```\n\nInclude codeblock with `pseudo` language in your markdown.\n\n\u003cpre\u003e\n```pseudo\nvisit registration page\nenter email address\nif new user\n  fill in registration form\n  submit\n  if validation error\n    fix registration form\n    review the fix\n    submit\n  else\n    submit\n  end\nelse\n  enter password\n  if password wrong\n    ask password again\n  else\n    good to go\n  end\n  confirm account info\nend\nconfirm registration info\n```\n\u003c/pre\u003e\n\nOr you could compile individual pseudocode to vector image. Below is generated by:\n\n`$ pseudo2svg examples/example.pseudo \u003e examples/flowchart.svg`\n\n![flowchart](http://ochko.github.io/markdoc/examples/flowchart.svg \"Flowchart\")\n\n### Sequence diagram\n\nInclude codeblock with `sequence` language in your markdown. Sequence diagram starts with actor declaration(becomes symbol of man), then object declaration(becomes big rectangles with vertical lifeline), then follows messages. Message format is:\n- `A -\u003e B : Label` - Arrow from A to B with Label over it. Arrows work either way, so it is equivalent to `B \u003c- A : Label`\n- `A \u003c~ B : Label` - Dashed arrow representing return message. Also works for other direction. so it is same as `B ~\u003e A : Label`\n- `C : Label` - Message to C itself. Actually it is same as `C -\u003e C : Label`\n\n\u003cpre\u003e\n```sequence\nStudent = Actor\nP = Partner Site\nApp = Web App\nApi = Reg API\n\nStudent -\u003e P : Choose course(S)\nP -\u003e Api : Issue key for(S)\nP \u003c~ Api : Registration key(K)\nP -\u003e App : Register with key(K)\nStudent \u003c~ App : Registration form\nStudent -\u003e App : Fill the form(F)\nApp : Save the form(F)\nApp -\u003e Api : Register(K, F) # New API\nApi : Create course\nApp \u003c~ Api : Course details(C)\nApp : Save(C)\nStudent \u003c~ App : Show course summary\nStudent -\u003e Api : Click study button\nStudent \u003c~ Api : Show mypage\n```\n\u003c/pre\u003e\n\nOr you could compile individual sequence diagram to vector image. Below is generated by:\n\n`$ sequence2svg examples/example.sequence \u003e examples/sequence.svg`\n\n![sequence](http://ochko.github.io/markdoc/examples/sequence.svg \"Sequence\")\n\n### Others\n\nWhen printing docs you might want to break pages at specific line. You can use this markup for that:\n\n```html\n\u003cp class=\"page-break\"\u003e\u003c!-- break --\u003e\u003c/p\u003e\n```\n\nSee [examples/doc.md](https://raw.githubusercontent.com/ochko/markdoc/master/examples/doc.md) for complete example.\n\n## Contributing\n\nFork the repo, and send a pull request. I promise I will merge almost all PR's as soon as you don't break existing behaviour. ;) More than welcome if you implement other diagram types. Please add a bit of test for your implementation if you add a feature.\n\n\n## Boring legal stuff\n\nThe MIT License (MIT)\n\nCopyright (c) Lkhagva Ochirkhuyag, 2022\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fochko%2Fmarkdoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fochko%2Fmarkdoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fochko%2Fmarkdoc/lists"}