Skip to content

Render markdown preview cells inside a shadow dom#120137

Merged
mjbvz merged 2 commits intomicrosoft:mainfrom
mjbvz:notebook-renderer-shadowdom
Mar 30, 2021
Merged

Render markdown preview cells inside a shadow dom#120137
mjbvz merged 2 commits intomicrosoft:mainfrom
mjbvz:notebook-renderer-shadowdom

Conversation

@mjbvz
Copy link
Collaborator

@mjbvz mjbvz commented Mar 29, 2021

Fixes #119971

This moves all markdown previews into shadow doms. This lets us prevent styles from outside the preview leaking into the preview, and also prevents styles from the preview leaking out into the rest of the notebook

@mjbvz mjbvz added this to the April 2021 milestone Mar 29, 2021
@mjbvz mjbvz requested a review from rebornix March 29, 2021 23:58
@mjbvz mjbvz self-assigned this Mar 29, 2021
element.innerHTML = rendered;

// Insert styles into markdown preview shadow dom so that they are applied
for (const markdownStyleNode of document.getElementsByClassName('markdown-style')) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the future, we should look into pulling in contributed styles through some explicit contribution point instead of this implicit convention

mjbvz added 2 commits March 30, 2021 13:11
Fixes microsoft#119971

This moves all markdown previews into shadow doms. This lets us prevent styles from outside the preview leak into the preview, and also prevents styles from the preview leak out into the rest of the notebook
This lets us handle clicks triggered inside of a shadow dom
@mjbvz mjbvz force-pushed the notebook-renderer-shadowdom branch from 90563ac to f3e3ddb Compare March 30, 2021 20:12
@mjbvz mjbvz merged commit d4412e7 into microsoft:main Mar 30, 2021
@mjbvz
Copy link
Collaborator Author

mjbvz commented Mar 30, 2021

Merging this to get additional testing in insiders

@github-actions github-actions bot locked and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSS in custom renderer messes up markdown rendering

1 participant