mdurl parse issue after upgrading to latest version of JupyterBook
melaniewalsh opened this issue · comments
Describe the bug
context
I am trying to build my JupyterBook with the latest version of of the package (and I hadn't upgraded for quite a while), and the mdurl package is throwing an error. Does anyone know what I can change to avoid this error? It's hard for me to identify where this error is coming from, and I wondered if others who have upgraded after a while have run into something similar.
(base) melwalsh@is-melwalshm14x Intro-Cultural-Analytics-Textbook % cat /var/folders/06/y6vmvyfj0wg08vb3rszcfy080000gn/T/sphinx-err-0kwu59p8.log
# Platform: darwin; (macOS-14.3-arm64-arm-64bit)
# Sphinx version: 7.2.6
# Python version: 3.11.5 (CPython)
# Docutils version: 0.20.1
# Jinja2 version: 3.1.2
# Pygments version: 2.15.1
# Last messages:
# 04-Data-Collection/Workbooks/03.5-Web-Scraping-Part2-Workbook
#
# reading sources... [ 49%]
# 04-Data-Collection/Workbooks/04.5-APIs-WORKBOOK
#
# reading sources... [ 50%]
# 04-Data-Collection/template
#
# Loaded extensions:
# sphinx.ext.mathjax (7.2.6)
# alabaster (0.7.12)
# sphinxcontrib.applehelp (1.0.2)
# sphinxcontrib.devhelp (1.0.2)
# sphinxcontrib.htmlhelp (2.0.0)
# sphinxcontrib.serializinghtml (1.1.10)
# sphinxcontrib.qthelp (1.0.3)
# sphinx_togglebutton (0.3.2)
# sphinx_copybutton (0.5.2)
# myst_nb (1.0.0)
# jupyter_book (1.0.0)
# sphinx_thebe (0.3.1)
# sphinx_comments (0.0.3)
# sphinx_external_toc (1.0.1)
# sphinx.ext.intersphinx (7.2.6)
# sphinx_design (0.5.0)
# sphinx_book_theme (unknown version)
# notfound.extension (1.0.0)
# sphinxext.rediraffe (unknown version)
# sphinx_jupyterbook_latex (unknown version)
# sphinx_multitoc_numbering (unknown version)
# pydata_sphinx_theme (unknown version)
# Traceback:
Traceback (most recent call last):
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/jupyter_book/sphinx.py", line 167, in build_sphinx
app.build(force_all, filenames)
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/sphinx/application.py", line 355, in build
self.builder.build_update()
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 293, in build_update
self.build(to_build,
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 313, in build
updated_docnames = set(self.read())
^^^^^^^^^^^
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 420, in read
self._read_serial(docnames)
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 441, in _read_serial
self.read_doc(docname)
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 498, in read_doc
publisher.publish()
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/docutils/core.py", line 234, in publish
self.document = self.reader.read(self.source, self.parser,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/sphinx/io.py", line 105, in read
self.parse()
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/docutils/readers/__init__.py", line 76, in parse
self.parser.parse(self.input, document)
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/myst_nb/sphinx_.py", line 142, in parse
mdit_tokens = notebook_to_tokens(notebook, mdit_parser, mdit_env, logger)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/myst_nb/core/nb_to_tokens.py", line 143, in notebook_to_tokens
mdit_parser.core.process(state)
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/markdown_it/parser_core.py", line 45, in process
rule(state)
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/markdown_it/rules_core/inline.py", line 10, in inline
state.md.inline.parse(token.content, state.md, state.env, token.children)
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/markdown_it/parser_inline.py", line 143, in parse
self.tokenize(state)
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/markdown_it/parser_inline.py", line 123, in tokenize
ok = rule(state, False)
^^^^^^^^^^^^^^^^^^
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/markdown_it/rules_inline/link.py", line 53, in link
href = state.md.normalizeLink(res.str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/markdown_it/main.py", line 345, in normalizeLink
return normalize_url.normalizeLink(url)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/markdown_it/common/normalize_url.py", line 23, in normalizeLink
parsed = mdurl.parse(url, slashes_denote_host=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/mdurl/_parse.py", line 300, in url_parse
u.parse(url, slashes_denote_host)
File "/Users/melwalsh/anaconda3/lib/python3.11/site-packages/mdurl/_parse.py", line 204, in parse
if rest[host_end - 1] == ":":
~~~~^^^^^^^^^^^^^^
IndexError: string index out of range
Reproduce the bug
You can reproduce the error if you clone my repo https://github.com/melaniewalsh/Intro-Cultural-Analytics/ and try to build the book. However, I also had to re-install a couple of custom extensions that I am using before getting to this error, so you might have to do that too if you are trying to reproduce
List your environment
Jupyter Book : 1.0.0
External ToC : 1.0.1
MyST-Parser : 2.0.0
MyST-NB : 1.0.0
Sphinx Book Theme : 1.1.2
Jupyter-Cache : 1.0.0
NbClient : 0.5.13
I'm encountering a new issue #2125