Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Mathpix/mpx-cli
CLI for document conversion for scientific documents, powered by Mathpix OCR
https://github.com/Mathpix/mpx-cli
cli converter document-conversion format-converter html latex markdown pdf science static-site-generator
Last synced: about 1 month ago
JSON representation
CLI for document conversion for scientific documents, powered by Mathpix OCR
- Host: GitHub
- URL: https://github.com/Mathpix/mpx-cli
- Owner: Mathpix
- License: mit
- Created: 2020-12-09T04:56:47.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-11-20T19:34:54.000Z (about 1 year ago)
- Last Synced: 2024-11-16T07:16:59.147Z (about 1 month ago)
- Topics: cli, converter, document-conversion, format-converter, html, latex, markdown, pdf, science, static-site-generator
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@mathpix/mpx-cli
- Size: 2.06 MB
- Stars: 92
- Watchers: 13
- Forks: 12
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mpx cli [![npm package][npm-img]][npm-url] [![github license][license-img]][license-url]
Document conversion for scientific documents.
## Install
```
npm install -g @mathpix/mpx-cli
```## Usage
Sign up at https://accounts.mathpix.com and then run `mpx login` which will ask for your Mathpix email and password then save an authorization token to be used for any commands that require connecting to our servers such as digitizing PDF files or converting Markdown to docx or pdf files.
```
mpx login
```Alternatively you can use a Mathpix API account by creating an API key from https://accounts.mathpix.com/ocr-api and then set the API key as an environment variable `MATHPIX_OCR_API_KEY`:
```
export MATHPIX_OCR_API_KEY=...
```Or save it permanently in the mpx config file:
```
mpx set-api-key ...
# This will save the key in a file at
# ~/.mpx/config on Linux, macOS, or Unix
# C:\Users\USERNAME\.mpx\config on Windows
```To digitize PDF's to editable Mathpix Markdown, docx, html or tex.zip:
```
mpx convert input-file.pdf output-file.mmd
mpx convert input-file.pdf output-file.docx
mpx convert input-file.pdf output-file.tex
mpx convert input-file.pdf output-file.html
```To digitize images to editable Mathpix Markdown, docx, html or tex.zip:
```
mpx convert input-file.png output-file.mmd
mpx convert input-file.png output-file.docx
mpx convert input-file.jpeg output-file.tex
mpx convert input-file.jpeg output-file.html
```You can also compile Markdown files without using Mathpix OCR:
```
mpx convert input-file.mmd output-file.docx
mpx convert input-file.mmd output-file.tex
mpx convert input-file.mmd output-file.html
mpx convert input-file.mmd output-file.pdf
mpx convert input-file.mmd output-file.pdf --pdf-method html
```To view mmd files rendered into html on a local server:
```
mpx serve ./input-dir
mpx serve ./input-dir/example.mmd
```To build a directory of mmd files into a static html site:
```
mpx build ./input-dir ./output-dir
```The cli has built in `--help` that will show all commands and flags:
```
$ mpx --help
Usage: mpx command [options] [args]Document conversion for scientific documents
Options:
-V, --version output the version number
-h, --help display help for commandCommands:
build [options] [source] [destination] build a static html site from a directory of markdown or mathpix markdown
convert [options] convert files between markdown, mathpix markdown, docx, latex and pdf formats
serve [options] serve markdown or mathpix markdown rendered at html
set-api-key [options] save Mathpix OCR API key
unset-api-key [options] remove Mathpix OCR API key
login [options] log into your Mathpix Snip account and save authorization token
logout [options] log out of your Mathpix Snip account and remove authorization token
help [command] display help for command
```[npm-img]: https://img.shields.io/npm/v/@mathpix/mpx-cli?color=blue
[npm-url]: https://www.npmjs.com/package/@mathpix/mpx-cli
[license-img]: https://img.shields.io/github/license/mathpix/mpx-cli?color=blue
[license-url]: https://github.com/Mathpix/mpx-cli/blob/master/LICENSE