-
Notifications
You must be signed in to change notification settings - Fork 18
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
🌉 Update images to work locally #145
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments. I think this is good to go!
@@ -6,7 +6,7 @@ import { AttachmentsResolver } from '@jupyterlab/attachments'; | |||
|
|||
type Options = { | |||
resolver: IRenderMime.IResolver | null; | |||
cell: MarkdownCell; | |||
cell?: MarkdownCell; | |||
}; | |||
|
|||
export async function imageUrlSourceTransform( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function was updated to remove the cell as a requirement, which has an attachments model.
@@ -131,7 +133,6 @@ export class RenderedMySTMarkdown | |||
const file = new VFile(); | |||
const references = { | |||
cite: { order: [], data: {} }, | |||
footnotes: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just an update for myst which no longer separates these from the mdast.
.myst img { | ||
max-width: 100%; | ||
} | ||
|
||
.myst figure img { | ||
display: block; | ||
max-width: 100%; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor style updates to prevent crazy wide images in markdown previews.
if (inNotebook) { | ||
// If in the notebook, lift children out of blocks for the next step | ||
// We are working here as one cell at a time | ||
liftChildren(mdast, 'block'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The structure of the markdown should stay in the blocks that the markdown gave, which is not the case for cells, which MUST lift children of the blocks so that we can target and identify them.
The link checker looks to be failing with |
- name: Install missing dependencies | ||
# On May 30, 2023 this wasn't included in the base try removing in future! | ||
run: pip install typing_extensions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this to fix the CI, worst case it is a no-op. But it will probably be fixed in the future with an update to maintainer-tools.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! We might need to revisit this with the changes needed for JupyterLab 4, but this is a good first step!
🚀 |
This enables local images to work in the markdown preview.