{"id":15368393,"url":"https://github.com/matthijsgroen/ebnf2railroad","last_synced_at":"2025-04-05T18:06:31.887Z","repository":{"id":33224421,"uuid":"154995457","full_name":"matthijsgroen/ebnf2railroad","owner":"matthijsgroen","description":"📔 Create beautiful documentation for EBNF","archived":false,"fork":false,"pushed_at":"2024-11-26T11:43:47.000Z","size":2222,"stargazers_count":63,"open_issues_count":5,"forks_count":10,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-29T17:06:51.737Z","etag":null,"topics":["ebnf","railroad-diagrams"],"latest_commit_sha":null,"homepage":"https://matthijsgroen.github.io/ebnf2railroad/","language":"JavaScript","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/matthijsgroen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2018-10-27T18:17:19.000Z","updated_at":"2025-03-13T00:04:37.000Z","dependencies_parsed_at":"2024-06-21T07:30:46.680Z","dependency_job_id":"953acafe-6b69-4b33-bf3a-a018b45e72e5","html_url":"https://github.com/matthijsgroen/ebnf2railroad","commit_stats":{"total_commits":225,"total_committers":4,"mean_commits":56.25,"dds":"0.40888888888888886","last_synced_commit":"13cf7e7c66585774d311aaa114545d22cd8d3e98"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matthijsgroen%2Febnf2railroad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matthijsgroen%2Febnf2railroad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matthijsgroen%2Febnf2railroad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matthijsgroen%2Febnf2railroad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matthijsgroen","download_url":"https://codeload.github.com/matthijsgroen/ebnf2railroad/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378140,"owners_count":20929296,"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":["ebnf","railroad-diagrams"],"created_at":"2024-10-01T13:29:15.572Z","updated_at":"2025-04-05T18:06:31.859Z","avatar_url":"https://github.com/matthijsgroen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EBNF 2 RailRoad\n\n[![npm](https://badgen.now.sh/npm/v/ebnf2railroad?icon=npm)](http://npm.im/ebnf2railroad)\n[![code style: prettier](https://badgen.now.sh/badge/code%20style/prettier/ff69b4)](https://github.com/prettier/prettier)\n[![license](https://badgen.now.sh/github/license/matthijsgroen/ebnf2railroad)](https://github.com/matthijsgroen/ebnf2railroad)\n\nA command line tool to create great documentation including railroad diagrams\nbased on the ISO/IEC 14977 specification\n\n## Features\n\n- Creates optimized visual syntax diagrams based on the EBNF syntax\n- Quick navigation using references of used declarations\n- Nice comment markup using markdown\n- Validates if document is complete and has no duplicate declarations\n- Shows pretty printed text syntax in the document\n- Pretty printing of the sourcefile\n- Table of contents indicating root elements, character sets, common elements\n  and recursion\n- Generation of large overview diagrams for root elements\n\n## Installation\n\n```\nnpm install -g ebnf2railroad\n```\n\n## Usage from command line\n\n```\nUsage: ebnf2railroad [options] \u003cfile\u003e\n\nConverts an ISO/IEC 14977 EBNF file to a HTML/Markdown file with SVG railroad diagrams\n\nOptions:\n\n  -V, --version          output the version number\n  -q, --quiet            suppress output to STDOUT\n  -o, --target [target]  output the file to target destination.\n  --no-target            skip writing output HTML\n  -t, --title [title]    title to use for HTML document\n  --lint                 exit with status code 2 if EBNF document has warnings\n  --write-style          rewrites the source document with styled text\n  --no-optimizations     does not try to optimize the diagrams\n  --no-overview-diagram  skip creating overview diagrams for root elements\n  --no-diagram-wrap      does not wrap diagrams for width minimization\n  --no-text-formatting   does not format the output text version (becomes single line)\n  --dump-ast             dump EBNF file AST to target destination for further processing\n  --read-ast             input file is in the AST format\n  -h, --help             output usage information\n```\n\n### Examples\n\nTo generate HTML documentation of the EBNF file:\n\n```\nebnf2railroad --title 'My Title' inputfile.ebnf -o outputfile.html\n```\n\nTo only verify the EBNF file:\n\n```\nebnf2railroad --lint inputfile.ebnf --no-target\n```\n\nTo prettify the source EBNF file:\n\n```\nebnf2railroad --write-style inputfile.ebnf --no-target\n```\n\n### Online examples\n\nCheck the examples folder for an example input file and the generated result\npage.\n\n- EBNF `ebnf2railroad examples/ebnf.ebnf --title EBNF`\n  [View html result online][example-ebnf] [View source](./examples/ebnf.ebnf)\n- JSON `ebnf2railroad examples/json.ebnf --title JSON`\n  [View html result online][example-json] [View source](./examples/json.ebnf)\n\n### Optimizations\n\nThe following optimizations are applied:\n\n- Ungrouping of groups that do not affect meaning of syntax\n- Untangling of nested choice elements\n- Duplicate choices are removed\n- Pretty printing of original syntax, with wrapping, column alignment\n\n[View html result online][example-optimizations] [View source](./examples/optimizations.ebnf)\n[View markdown result](./examples/optimizations.md)\n\n## Usage as module\n\n```javascript\nconst { parseEbnf, createDocumentation } = require(\"ebnf2railroad\");\n\nconst ebnf = \"definition = 'a', other, { other } | item, 'b';\";\nconst ast = parseEbnf(ebnf); // can throw parse error exceptions\nconst htmlOutput = createDocumentation(ast);\n```\n\n## Licence\n\nThe code is licensed under MIT (see LICENSE file).\n\n## Contributing\n\nThanks for your interest in contributing! There are many ways to contribute to\nthis project. [Get started here](CONTRIBUTING.md)\n\n## Acknowledgements\n\n- All SVG railroad diagrams are generated through:\n  https://github.com/tabatkins/railroad-diagrams\n- All UTF railroad diagrams are generated through:\n  https://github.com/matthijsgroen/utf-railroad\n- The EBNF parser is generated by http://zaa.ch/jison/\n- All markdown is parsed with http://showdownjs.com/\n\n[example-ebnf]: https://htmlpreview.github.io/?https://github.com/matthijsgroen/ebnf2railroad/blob/master/examples/ebnf.html\n[example-json]: https://htmlpreview.github.io/?https://github.com/matthijsgroen/ebnf2railroad/blob/master/examples/json.html\n[example-optimizations]: https://htmlpreview.github.io/?https://github.com/matthijsgroen/ebnf2railroad/blob/master/examples/optimizations.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthijsgroen%2Febnf2railroad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatthijsgroen%2Febnf2railroad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthijsgroen%2Febnf2railroad/lists"}