CLI reference
The asciichem CLI provides conversion, linting, and round-trip
verification. Install via gem install asciichem.
convert
Section titled “convert”Convert AsciiChem source to an output format.
asciichem convert -i "H_2O" -t mathmlasciichem convert -i "2Na+ + SO_4^2- -> Na_2SO_4" -t cmlasciichem convert -f input.asciichem -t htmlecho "H_2O" | asciichem convert -i - -t latexOptions
Section titled “Options”| Flag | Description |
|---|---|
-i, --input | AsciiChem source text (or - for stdin) |
-f, --file | Read source from a file |
-t, --format | Output format: mathml (default), text, html, latex, svg, cml |
Run chemistry validation checks. Exits 1 if any errors found.
asciichem lint -i "H_2 + O_2 -> H_2O"asciichem lint -i "crystal[x](a=-1){Na@f(0,0,0)}" -f jsonOptions
Section titled “Options”| Flag | Description |
|---|---|
-i, --input | AsciiChem source text |
-f, --format | Output format: text (default) or json |
JSON output is an array of {severity, message, node} objects.
roundtrip
Section titled “roundtrip”Parse and re-emit text; exit non-zero if output differs from input.
asciichem roundtrip -i "H_2O"parse-cml
Section titled “parse-cml”Parse CML XML and emit AsciiChem text.
asciichem parse-cml -i "<cml xmlns=\"http://www.xml-cml.org/schema\">...</cml>"version
Section titled “version”asciichem versionasciichem --version