Skip to content

Commit 9b02758

Browse files
committed
Adapt isPlotlyLibrary regex for new plotly.py 6+ inclusion
This way the cell content is correctly detected and moved into the head
1 parent cc8bf09 commit 9b02758

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/jupyter/widgets.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,11 @@ function isWidgetIncludeHtml(html: string) {
190190
}
191191

192192
function isPlotlyLibrary(html: string) {
193-
return /^\s*<script type="text\/javascript">/.test(html) &&
193+
return (/^\s*<script type="text\/javascript">/.test(html) &&
194194
(/require\.undef\(["']plotly["']\)/.test(html) ||
195-
/define\('plotly'/.test(html));
195+
/define\('plotly'/.test(html))) ||
196+
// also handle new module syntax from plotly.py 6+
197+
/\s*<script type=\"module\">import .*plotly.*<\/script>/.test(html);
196198
}
197199

198200
function htmlLibrariesText(htmlText: string) {

0 commit comments

Comments
 (0)