sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.53k stars 2.12k forks source link

sphinx-gallery reference_url links do not work with sphinx >=5 #10621

Open hndgzkn opened 2 years ago

hndgzkn commented 2 years ago

Describe the bug

After sphinx version 5, reference_url in sphinx_gallery_conf section gives the following error upon doc build:

Extension error (sphinx_gallery.docs_resolv):
Handler <function embed_code_links at 0x7fe9e0a40820> for event 'build-finished' threw an exception (exception: Expecting property name enclosed in double quotes: line 1 column 2 (char 1))

As far as I could address, for reference_url http://example.com/stable/"in conf.py, /"at the end is treated as escape and removed.

How to Reproduce

$ git clone https://github.com/alphacsc/alphacsc
$ cd alphacsc
$ pip install -e .[doc]
$ cd docs
$ make html 

Expected behavior

No response

Your project

https://github.com/alphacsc/alphacsc

Screenshots

No response

OS

Linux

Python version

3.9.12

Sphinx version

v5.0.0

Sphinx extensions

No response

Extra tools

No response

Additional context

No response

tk0miya commented 2 years ago

Note: This was also reported to sphinx-gallery project as https://github.com/sphinx-gallery/sphinx-gallery/issues/967.

tk0miya commented 2 years ago

Could you share a minimal reproducible example, please? On my local, alphacsc repo requires 20+ minutes (still in progress...)

tk0miya commented 2 years ago

I used this Dockerfile to reproduce the error:

FROM python:3.10-slim

RUN apt update; apt install -y build-essential curl git make unzip vim
RUN git clone https://github.com/alphacsc/alphacsc
WORKDIR /alphacsc
RUN pip install -e .[doc]
WORKDIR /alphacsc/doc
#RUN make html
RUN sphinx-build . _build/html

Note: I used sphinx-build command instead of make html because I got failure with given procedure.

------
 > [7/7] RUN make html:
#11 0.211 mpiexec -np 1  --host localhost:50 sphinx-build -b html -d _build/doctrees   . _build/html
#11 0.211 make: mpiexec: No such file or directory
#11 0.211 make: *** [Makefile:56: html] Error 127
------
hndgzkn commented 2 years ago

Sorry for late response.

You can delete all the directories under examples directory except csc directory. Then it will be quick to reproduce.

rashidnhm commented 2 months ago

Was there a solution to this for anyone (outside of downgrading sphinx)?