Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link checking confused by )? #40

Closed
jbednar opened this issue Jan 6, 2020 · 3 comments
Closed

Link checking confused by )? #40

jbednar opened this issue Jan 6, 2020 · 3 comments
Labels

Comments

@jbednar
Copy link

jbednar commented Jan 6, 2020

It looks to me like nbsmoke is parsing Markdown URL specifications incorrectly when they contain a trailing right parenthesis, causing it it to extract a too-short URL that is then flagged as a broken link:

~/datashader> pytest "--nbsmoke-verify" "-k" ".ipynb"  examples/user_guide/8_Geography.ipynb
...
examples/user_guide/8_Geography.ipynb::/Users/jbednar/datashader/examples/user_guide/8_Geography.ipynb
  /Users/jbednar/miniconda3/envs/pyviz/lib/python3.7/site-packages/nbsmoke/__init__.py:287: UserWarning:
  
  /Users/jbednar/datashader/examples/user_guide/8_Geography.ipynb:
  ***** invalid modules: set()
  
  ***** bad links: {'https://en.wikipedia.org/wiki/Aspect_(geography'}
  
  ***** bad images: set()
  
  --------------------
0588:~/datashader> grep wiki/Aspect examples/user_guide/8_Geography.ipynb
    "[Aspect](https://en.wikipedia.org/wiki/Aspect_(geography)) is the orientation of slope, measured clockwise in degrees from 0 to 360, where 0 is north-facing, 90 is east-facing, 180 is south-facing, and 270 is west-facing.\n",
@ceball
Copy link
Member

ceball commented Jan 7, 2020

All the relevant code will be in <100 lines of verify.py from about line 57 onwards (https://github.com/pyviz-dev/nbsmoke/blob/master/nbsmoke/verify.py#L57), if you wanted to check out how difficult/easy it would be to fix this issue. However, in that file I always stop reading when I get to this note:

# [...] quickly copied in code from datashader
# examples/nb (which itself came from bokeh). Need to check it works
# as expected. Takes a while to run so must be doing something :) But
# fails to run properly for various projects other than datashader
# (e.g. for geoviews, gives spurious errors about notebook syntax,
# complains that
# https://www.earthsystemcog.org/projects/esmf/regridding is a bad
# link).

Also, "verify" is not covered by any tests (#28) (and it wasn't covered by any tests in other projects I could find anywhere at the time I moved it in), plus I have never used it myself. So we should probably decide its value before investing time in it, and we should probably also check to see what other projects do now (e.g. bokeh).

@ceball
Copy link
Member

ceball commented Jan 7, 2020

Despite what I said, I decided to have a look!

The problem appears to come from nbconvert (and ultimately from mistune), so I don't think it can easily be addressed in nbsmoke.

jupyter/notebook#2709 (comment)
lepture/mistune#46

@jbednar jbednar added the wontfix label Jan 7, 2020
@jbednar
Copy link
Author

jbednar commented Jan 7, 2020

That helped, thanks! I'll mark this wontfix because (a) it's a known problem in an underlying library we don't control, and (b) there is a workaround. I.e., instead of https://en.wikipedia.org/wiki/Aspect_(geography), just encode those characters:

https://en.wikipedia.org/wiki/Aspect_%28geography%29

@jbednar jbednar closed this as completed Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants