Skip to content

Fix markdown cell do not re-render when re-executed #155268

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danilhendrasr
Copy link

This PR fixes #151151

With this PR I added a new command (notebook.cell.finishEdit) that increments the cell's text model version ID when triggered, I changed the re-rendering logic from content-based to version ID-based as well. This is done to distinguish between the action of re-executing cell and stop editing cell.

Meanwhile the already-existing command (notebook.cell.quitEdit) now only exits the cell edit mode when triggered, it does not trigger a re-render.

Tbh I don't fully understand some parts of the changes, so let me know if I can do some things better.

How to test

  1. Create a Markdown cell with an tag referring to a non-existing path, e.g. <img src="myimg.png">.
  2. Execute the cell. A "broken image" icon appears.
  3. Create the image at the specified path.
  4. Click the cell to edit. Re-execute it (without making any changes).

@ghost
Copy link

ghost commented Jul 15, 2022

CLA assistant check
All CLA requirements met.

@mjbvz mjbvz requested a review from rebornix July 15, 2022 20:31
@rebornix rebornix added this to the July 2022 milestone Jul 22, 2022
@mjbvz mjbvz modified the milestones: July 2022, August 2022 Jul 27, 2022
@mjbvz mjbvz modified the milestones: August 2022, September 2022 Aug 25, 2022
@mjbvz mjbvz modified the milestones: September 2022, October 2022 Sep 26, 2022
@rebornix rebornix modified the milestones: October 2022, November 2022 Oct 24, 2022
@mjbvz mjbvz modified the milestones: November 2022, December 2022 Nov 29, 2022
@mjbvz mjbvz modified the milestones: January 2023, On Deck Jan 24, 2023
@msathyaanand
Copy link

Here are the steps to follow:

  1. Create a Markdown cell with an <img> tag referring to a non-existing path. For example:

  2. Execute the cell. A "broken image" icon will appear, indicating that the image couldn't be loaded because the specified path doesn't exist.

  3. Create the image at the specified path (myimg.png in this case). Make sure to place the image in the correct location so that it can be accessed by the Jupyter Notebook or the Markdown renderer.

  4. Click the cell to edit it. You can do this by double-clicking on the cell or selecting it and pressing Enter.

  5. Re-execute the cell without making any changes. You can do this by clicking the "Run" button in the toolbar or by using the appropriate keyboard shortcut (e.g., Shift+Enter).

After re-executing the cell, the image should appear correctly since you have created it at the specified path. The broken image icon should no longer be displayed, indicating that the image is now being successfully loaded.

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image stays broken when re-executing Markdown cell
5 participants