nbviewer icon indicating copy to clipboard operation
nbviewer copied to clipboard

all rendered notebook return malformed html

Open tonyfast opened this issue 1 year ago • 1 comments

Describe the bug when nbviewer renders the notebook body it recieves a complete html document including a new head and body. this is invalid html if we check it on the w3c validator.

To Reproduce Steps to reproduce the behavior:

  1. visit https://validator.w3.org/
  2. enter an nbviewer url like https://github.com/jupyterlab/jupyterlab-demo/blob/master/notebooks/Lorenz.ipynb
  3. Scroll down to Error Stray Doctype

Expected behavior two options:

  1. the javascript assets for the notebook are loaded in the existing head and the notebook contents is rendered inside the body.
  2. iframe!

Screenshots image

Additional context these errors were discovered when trying to remediate the accessibility of nbviewer. most accessibility fixes can't be made until we have well formed html. the current malformed dom structure will have unknown effects across browsers, AT, and OS.

tonyfast avatar Mar 27 '24 00:03 tonyfast

it would be really nice to have the w3c validator running as a pytest for several different projects including nbconvert and nbviewer. this is a feature in nbconvert-a11y that might be worth extracting https://github.com/deathbeds/nbconvert-a11y/blob/main/nbconvert_a11y/pytest_w3c.py

tonyfast avatar Apr 05 '24 23:04 tonyfast