Skip to content

Conversation

@StFroese
Copy link
Contributor

@StFroese StFroese commented Jun 30, 2025

Hi all 😊

I was in need of cross-gluing images/figures from my notebooks, well here I am 😄

I tried to add the handling of image mime types in the generate_any_nodes for PendingGlueReference with image.
This is mostly a copy of mystnb/core/render.py::render_image but instead of writing the image again I try to figure out the existing uri and create the image node from it.

I also added a figure to the orphaned notebook to display this feature in the docs 🎨

Comments are very welcome, I am very new to this codebase! 🙏

closes #591, closes #431

@StFroese
Copy link
Contributor Author

@StFroese
Copy link
Contributor Author

This should be one step in the direction of #396, hopefully

@bsipocz bsipocz added the enhancement New feature or request label Jun 30, 2025
@StFroese
Copy link
Contributor Author

StFroese commented Jul 1, 2025

closes #591

@StFroese
Copy link
Contributor Author

StFroese commented Jul 1, 2025

closes #431

@bsipocz
Copy link
Collaborator

bsipocz commented Jul 1, 2025

@StFroese - you need to add those close comments in the the pull request's description, so the issues will be automatically picked up for closure upon merge (https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword)

I'll try to come back to review and merge this later this week.

@StFroese
Copy link
Contributor Author

StFroese commented Jul 1, 2025

@bsipocz thanks for pointing that out! It was more meant as a cross-ref to check if somebody agrees on closing these, should have made it more clearly. I'll go ahead and explicitly add the keyword in the PR description 😊
Thanks!

@bsipocz
Copy link
Collaborator

bsipocz commented Jul 1, 2025

Fwiw, I prefer it if it's in the PR description, so it doesn't generate pings and references each time there is a rebase, etc. and also it's easier to edit if there is a disagreement about the issue is being addressed or not with the PR

@StFroese
Copy link
Contributor Author

StFroese commented Jul 1, 2025

@bsipocz was just updating my comment from "commit message" to "PR description" as you wrote this haha! Done, thx! 😊

Copy link
Collaborator

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content here is convincing, however I wonder how it would work with markdown notebooks where we don't store the outputs in the notebook themselves? I mean that would be the actual use case most of the issues are referring to.
(after all all of our tutorial source code lives in myst markdown notebooks so the test case should handle those rather than an orphaned ipynb)

:doc: orphaned_nb.ipynb
```

A cross-pasted `any` directive from an image:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The colours look weird for this in the rendering, and I have no idea why:

Screenshot 2025-07-02 at 12 42 02

_nodes = generate_text_nodes(node, output)
else:
_nodes = generate_any_nodes(node, output, priority_list)
print("asdasg", self.app.builder.imagedir)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this print a debug remnant?

bsipocz
bsipocz previously approved these changes Jul 13, 2025
Copy link
Collaborator

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have one more look at the weird colouring for the rendered docs, and remove the debug remnant, and if CI is green (with the exception of the known devtest sphinx deprecations) then I go ahead and merge this to include it in the new release.

@bsipocz bsipocz merged commit b7387d5 into executablebooks:master Jul 13, 2025
15 checks passed
@bsipocz
Copy link
Collaborator

bsipocz commented Jul 13, 2025

Thanks @StFroese!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No displayed output when embedding glued figures from another page/notebook Allow glue-ing non-text objects (e.g. figures) from other documents

2 participants