Skip to content

Commit 581f07e

Browse files
committed
Merge pull request #613 from Nikolai-Hlubek/master
No '.embed' extension for Jupyter embedded pages
2 parents cf60510 + 86e1e36 commit 581f07e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

R/print.R

+6-5
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ knit_print.figure <- function(x, options, ...) {
103103
knitr::asis_output(iframe)
104104
}
105105

106-
#' Embed a plotly figure as an iframe into a IPython Notebook
106+
#' Embed a plotly figure as an iframe into a Jupyter Notebook
107107
#' @param x a plotly object
108108
#' @param width attribute of the iframe. If \code{NULL}, the width in
109109
#' \code{plot_ly} is used. If that is also \code{NULL}, '100\%' is the default.
@@ -128,15 +128,16 @@ embed_notebook <- function(x, width = NULL, height = NULL,
128128
htmlwidgets::saveWidget(as.widget(l), file = basename(file))
129129
file
130130
} else {
131-
paste0(l$url, ".embed")
131+
l$url
132132
}
133-
iframe <- plotly_iframe(src, width %||% l$width, height %||% l$height)
133+
iframe <- plotly_iframe(src, width %||% l$width, height %||% l$height, url_ext = "")
134134
get("display_html", envir = asNamespace("IRdisplay"))(iframe)
135135
}
136136

137-
plotly_iframe <- function(url = "", width = NULL, height = NULL) {
137+
plotly_iframe <- function(url = "", width = NULL, height = NULL, url_ext = ".embed") {
138+
url <- paste0(url, url_ext)
138139
sprintf(
139-
'<iframe src="%s.embed" width="%s" height="%s" id="igraph" scrolling="no" seamless="seamless" frameBorder="0"> </iframe>',
140+
'<iframe src="%s" width="%s" height="%s" id="igraph" scrolling="no" seamless="seamless" frameBorder="0"> </iframe>',
140141
url, width %||% "100%", height %||% "400"
141142
)
142143
}

0 commit comments

Comments
 (0)