Skip to content

screen reader improvements to nbconvert html exporterยค

this post is used for testing screen reader improvements to the nbconvert html exporter. for the most part, without focus there are no visual changes just accessibility annotation changes.

it adds: * hidden cell numbers as interactive elements to focus on * some chunky ass focus, i even toned it down from the default i use. i like my focus thikk. * list navigation of cells

it removes: * disability dongles using beautiful soup

> current the exporter ALWAYS runs the exported html through beautiful soup using the slowest horse in town.
> if your website is thikkk then thats a lot soup to boil.

it doesn't: - include lines of code and number of outputs in the details - any form elements. the only interactive element used is a link.

    import nbconvert

take a recent and pass it through the exporter

    (
        pandas.Series(
            ["2024-02-28-histograms-sucks.ipynb"]
        ).apply(
            nbconvert.get_exporter("html")().from_filename
        ).itemgetter(0)
        .apply(do(Path("tmp.html").write_text))
        .display.iframe().display()
    )

write the file and copy the path to demo in another tab.

     Index(["tmp.html"]).path().path.absolute().path.as_uri().astype(
         str
     ).map(do(pyperclip.copy)).map(
         lambda x: F"[{x}]({x})"
     ).map(Markdown)#.display()
tmp.html    <IPython.core.display.Markdown object>
Name: as_uri, dtype: object