mathpix / mpx-cli Goto Github PK
View Code? Open in Web Editor NEWCLI for document conversion for scientific documents, powered by Mathpix OCR
Home Page: https://www.npmjs.com/package/@mathpix/mpx-cli
License: MIT License
CLI for document conversion for scientific documents, powered by Mathpix OCR
Home Page: https://www.npmjs.com/package/@mathpix/mpx-cli
License: MIT License
Right now we're using the synchronous endpoints.
Given an empty directory out
, and in/index.mmd
containing:
# Test
Here is some text referencing footnote one[^1].
[^1]: This is a footnote.
Then running npx mpx build --input in --output out
does not handle the footnote correctly. You end up with html that renders like this in a browser:
Here is some text referencing footnote one[^1].
[^1]: This is a footnote.
(where the text [^1]
is just plain text, not a link)
However, npx mpx convert in/index.mmd out/index.html
converts the footnote correctly, so that you end up with html that renders like this:
Here is some text referencing footnote one[1].
This is a footnote. ↩︎
(where the [1]
is a link to the footnote, and the ↩︎
is a link back to the relevant point in the document)
>mpx --version
0.4.0
I run this:
>mpx convert --verbose "xxx.png" "xxx.mmd"
And get this:
Source: xxx.png
Destination: xxx.mmd
Options: { pdfMethod: 'latex', verbose: true }
Convert with snip api xxx.png xxx.mmd mmd
There was an unexpected error, you can try again or if it continues please submit
an issue to https://github.com/mathpix/mpx-cli/issues including the output below:
--------------------------------------------------------------------------------
TypeError: process.stdout.clearLine is not a function
at ConvertImageWithSnipAPI (<PATH_TO_NPM>\npm\node_modules\@mathpix\mpx-cli\lib\convert.js:492:18)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async ConvertImage (<PATH_TO_NPM>\npm\node_modules\@mathpix\mpx-cli\lib\convert.js:596:5)
at async Object.ImageToMMD (<PATH_TO_NPM>\npm\node_modules\@mathpix\mpx-cli\lib\convert.js:607:3)
at async Command.<anonymous> (<PATH_TO_NPM>\npm\node_modules\@mathpix\mpx-cli\lib\mpx.js:171:11)
--------------------------------------------------------------------------------
Request: include package in HomeBrew for installation.
mpx convert x.jpg y.tex
Error: Snip server response 400 with json body:
{"errors":[{"id":"invalid_image_format","message":"Image must be jpeg or png format."}]}
at ConvertImageWithSnipAPI (/data/data/com.termux/files/usr/lib/node_modules/@mathpix/mpx-cli/lib/convert.js:479:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async ConvertImage (/data/data/com.termux/files/usr/lib/node_modules/@mathpix/mpx-cli/lib/convert.js:596:5)
at async Object.ImageToTEX (/data/data/com.termux/files/usr/lib/node_modules/@mathpix/mpx-cli/lib/convert.js:615:3)
at async Command.<anonymous> (/data/data/com.termux/files/usr/lib/node_modules/@mathpix/mpx-cli/lib/mpx.js:180:11)
-------------------------------------------------------------------------------
Hi:
I just tried calling the API using the mpx path/to/input.pdf path/to/output.docx
method and received the following warning (5 times).
at Timeout.<anonymous> (C:\Users\USERNAME\AppData\Roaming\npm\node_modules\@mathpix\mpx-cli\lib\convert.js:258:22)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
(node:14308) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)
I have attached the (single-page) PDF file in question.
The Markdown and MS Word documents I requested are downloaded successfully, but what do you recommend?
When I try to convert pdf
files to Markdown using mpx convert file.pdf file.md
, it seems like it always uses the non-standard Mathpix Markdown format, even when I don't use the mmd
file extension. I was wondering if there is a way to export to standard Markdown, similar to the functionality found in Snap Web?
Feature request: mpx pdf conversion with options to specify pdf page range
Hi there,
I am trying to install spectra following the instructions in Github, which I understand is only to run npm install -g @mathpix/spectra
. This is the error message I obtain, once and again:
The authenticity of host 'github.com (140.82.121.3)' can't be [email protected] checking installable status
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
⸨░░░░░░░░░░░░░░░░░░⸩ ⠇ fetchMetadata: sill resolveWithNewModule @mathpix/[email protected] checking installable status
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://[email protected]/montanaflynn/eleventy.git
npm ERR!
npm ERR! Host key verification failed.
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! path_to_the_log_file____logs/2021-02-05T05_07_16_988Z-debug.log
I would very much appreciate some clue to solve this problem, perhaps only mine because I have not too much experience on this kind of things.
Many thanks for your time and effort!!!
Josu
I've been playing around with mpx ("@mathpix/mpx-cli": "^0.4.0"
) to build a github pages site from some markdown files with inline and block equations, and noticed some strange behaviour.
Given src/index.mmd
, and an empty docs
directory, invoking mpx with npx build --input src --output docs
results in:
bash-5.1# npx mpx build --input src --output docs
Converting src to docs
Wrote 0 files in 0.24 seconds
If I rename src
to source
and repeat, it works fine:
bash-5.1# npx mpx build --input source --output docs
Converting source to docs
Wrote 1 file in 0.57 seconds
mpx convert input-file.pdf output-file.tex
When I changed the file extension to .tex, it could be opened normally.
Hi,
I am trying to convert an image in my user root folder.
The command I am using is as follows:
mpx convert image.jpg image.mmd
It succeeds in converting, but it says this:
Convert with snip api image.jpg image.mmd mmd
Could not write to destination path: image.mmd
Finally, I lose a snip from my plan and can't see it.
I tried it in another folder that has 777 permissions and the same thing happens.
What can I do?
Thanks!
An unexpected error occurred in converting a DOCX file from a PDF file.
Comand
mpx convert 68222-247693-1-SM.pdf 68222-247693-1-SM.docx
Error Message
(node:19632) ExperimentalWarning: The fs.promises API is experimental
Unexpected error, please submit a bug report at: https://github.com/mathpix/mpx-cli/issues
About PDF file
PDF file name is 68222-247693-1-SM.pdf.
This PDF downloaded from https://www.ccsenet.org/journal/index.php/apr/article/view/68222.
About Node.js version
v10.15.3
We want to be able to use this for local testing and on prem deployments.
Hello…
I'm a screen reader user attempting to get MathML from the html output, but the tool doesn't seem to provide this option.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.