Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
ebnf2railroad
Advanced tools
A command line tool to create great documentation including railroad diagrams based on the ISO/IEC 14977 specification
npm install -g ebnf2railroad
Usage: ebnf2railroad [options] <file>
Converts an ISO/IEC 14977 EBNF file to a HTML/Markdown file with SVG railroad diagrams
Options:
-V, --version output the version number
-q, --quiet suppress output to STDOUT
-o, --target [target] output the file to target destination.
--no-target skip writing output HTML
-t, --title [title] title to use for HTML document
--lint exit with status code 2 if EBNF document has warnings
--write-style rewrites the source document with styled text
--no-optimizations does not try to optimize the diagrams
--no-overview-diagram skip creating overview diagrams for root elements
--no-diagram-wrap does not wrap diagrams for width minimization
--no-text-formatting does not format the output text version (becomes single line)
--dump-ast dump EBNF file AST to target destination for further processing
--read-ast input file is in the AST format
-h, --help output usage information
To generate HTML documentation of the EBNF file:
ebnf2railroad --title 'My Title' inputfile.ebnf -o outputfile.html
To only verify the EBNF file:
ebnf2railroad --lint inputfile.ebnf --no-target
To prettify the source EBNF file:
ebnf2railroad --write-style inputfile.ebnf --no-target
Check the examples folder for an example input file and the generated result page.
ebnf2railroad examples/ebnf.ebnf --title EBNF
View html result online View sourceebnf2railroad examples/json.ebnf --title JSON
View html result online View sourceThe following optimizations are applied:
View html result online View source View markdown result
const { parseEbnf, createDocumentation } = require("ebnf2railroad");
const ebnf = "definition = 'a', other, { other } | item, 'b';";
const ast = parseEbnf(ebnf); // can throw parse error exceptions
const htmlOutput = createDocumentation(ast);
The code is licensed under MIT (see LICENSE file).
Thanks for your interest in contributing! There are many ways to contribute to this project. Get started here
FAQs
EBNF to Railroad diagram
The npm package ebnf2railroad receives a total of 53 weekly downloads. As such, ebnf2railroad popularity was classified as not popular.
We found that ebnf2railroad demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.