notebook icon indicating copy to clipboard operation
notebook copied to clipboard

Unable to hyperlink to current folder

Open raymondw2 opened this issue 2 years ago • 1 comments

Description

In a markdown cell, whenever we attempt to hyperlink [current directory](./) to show the contents of the current directory like this: Screen Shot 2022-02-01 at 4 50 15 PM copy

I get this error: Screen Shot 2022-02-01 at 4 52 00 PM

Reproduce

  1. Go to a markdown cell
  2. Type in [current directory](./)
  3. Click on link

Expected behavior

The hyperlink should display: Screen Shot 2022-02-01 at 4 50 15 PM copy the contents of the current directory.

Context

  • Operating System and version:
  • Browser and version:
  • JupyterLab version:
Troubleshoot Output
Paste the output from running `jupyter troubleshoot` from the command line here.
You may want to sanitize the paths in the output.
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Browser Output
Paste the output from your browser Javascript console here, if applicable.

raymondw2 avatar Feb 04 '22 00:02 raymondw2

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

welcome[bot] avatar Feb 04 '22 00:02 welcome[bot]

Checking the behavior with the latest Notebook 7 pre-release (currently 7.0.0a13).

Linking to the current directory does not show the error dialog anymore, but it also doesn't open the folder in a new browser tab:

https://user-images.githubusercontent.com/591645/220569136-69a90ef7-a4e0-47ca-b6a9-67b841db2f91.mp4

Linking to another directory tries to open the directory under /edit:

https://user-images.githubusercontent.com/591645/220569210-b7865717-4c4c-4fc4-87e7-0bb60c678bf9.mp4

jtpio avatar Feb 22 '23 08:02 jtpio

Digging a bit into this, JupyterLab handles local links via the CommandLinker in this plugin:

https://github.com/jupyterlab/jupyterlab/blob/eeaa6505f658f7eaaad18ea2d7f15c3c5da0b23a/packages/rendermime-extension/src/index.ts#L66-L90

[](./) is treated as "path": "" which then does nothing because of this check: https://github.com/jupyterlab/jupyterlab/blob/eeaa6505f658f7eaaad18ea2d7f15c3c5da0b23a/packages/rendermime-extension/src/index.ts#L71

[](./folder) then tries to open folder via the document manager

jtpio avatar May 25 '23 13:05 jtpio