mystmd
mystmd copied to clipboard
Non-DOI links to `https://doi.org` trigger obscure error
Description
A simple link to https://doi.org, e.g. [DOI](http://www.doi.org/index.html) causes the MyST build to crash with an obscure
This format is not supported or recognized
error.
Proposed solution
Only treat the link as a DOI if it matches r"https:\/\/doi\.org\/10\.\d+\/.*"
One thing to keep in mind is that there is the short-doi service, where dois don't follow the normal rules but are still valid:
For example: https://doi.org/cr3qwn https://doi.org/10.1175/1520-0493(1972)100<0081:OTAOSH>2.3.CO;2 (which is a terrible URL, but is real)
This was introduced here where we now no longer validate a DOI URL after it is recognized: https://github.com/executablebooks/mystmd/pull/735
I think we can treat this as a new error, and treat non-resolving DOIs in the transform a bit better.
No longer crashes, and has a better error message:
⛔️ page.md:63 Citation data from doi.org was not available or malformed for doi:index.html
To resolve this error, visit https://doi.org/index.html and add citation info to local BibTeX file