Markdown image not rendering in Jupyter notebook in private organisation repository

Markdown image not rendering in Jupyter notebook in private organization repository

To reproduce this bug, create a private repository in a github organisation, then create a Jupyter notebook with a markdown image link or an html image link in a markdown cell.

The image does not render in the github jupyter notebook viewer, but right-clicking on the unloaded image and opening it in a new tab works.

test image

there are reports of Jupyter Notebook here in the past,

try logging in in Incognito mode then visit the Developer Tools to see what’s causing the issue

Logging in in Incognito mode and opening developer tools shows the link on the page as:

<img alt="test image" src="//github.com/uwasystemhealth/markdown-image-test/raw/9c785cdb5b426648189b1b6ea76689797a3b2053//test-image.png">

Opening this link in a new tab generates the URL:

https://raw.githubusercontent.com/uwasystemhealth/markdown-image-test/9c785cdb5b426648189b1b6ea76689797a3b2053/test-image.png?token=BLAH

I assume it is the absence of the token in the first link which makes the image fail to load.

The Developer Tools console has error message:

test-image.png:1 Failed to load resource: the server responded with a status of 404 ()

Replacing this image src URL with the URL from the open tab allows the image to appear

good nice observation, hoping you’ll fix it,

do you have any idea whether it’s Notebook or GitHub ? because last time, we were able to resolve the issue by concluding that it is not on GitHub side

I believe it is definitely a problem with the GitHub notebook renderer (I have no idea how this works, or whether this was written by someone from github or jupyter).

Here is the raw notebook code from an example file:

{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "2bd366b4-6be9-4947-88fe-f1e65885f7c7",
   "metadata": {},
   "source": [
    "# markdown-image-test\n",
    "\n",
    "Private organisation repository to test markdown images in Jupyter notebook.\n",
    "\n",
    "This repository has been created to test a bug in github, which causes markdown images in Jupyter notebooks to not render in the markdown viewer. \n",
    "\n",
    "To reproduce this bug, create a private repository in a github organisation, then create a Jupyter notebook with a markdown image link or an html image link in a markdown cell.\n",
    "\n",
    "The image does not render in the github jupyter notebook viewer, but right-clicking on the unloaded image and opening it in a new tab works.\n",
    "\n",
    "![test image](test-image.png)\n",
    "\n",
    "<img src=test-image.png/>\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}

And here is the raw html of the image in the github rendered file:

<img alt="test image" src="//github.com/uwasystemhealth/markdown-image-test/raw/9c785cdb5b426648189b1b6ea76689797a3b2053//test-image.png">

The notebook renderer needs to replace this with:

<img alt="test image" src="//github.com/uwasystemhealth/markdown-image-test/raw/9c785cdb5b426648189b1b6ea76689797a3b2053//test-image.png?token=TOKEN>

I have no idea how alter the github notebook renderer. Does anybody have any suggestions?

you may want to ask them too by raising an issue in one of their repos, fortunately it’s open source