Skip to content

Commit 4178bcf

Browse files
committed
prevent multiple <script>s from being HTML escaped
`markdown::markdownToHTML` will escape multiple scripts if they are inline with divs, see https://github.com/rstudio/markdown/issues/74 so, separate the divs and scripts with a new line
1 parent 1bd2e70 commit 4178bcf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: R/offline.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ offline <- function(p = last_plot(), height = 400, width = "100%",
6060

6161
new_offline <- function(data, layout, height, width, id) {
6262
sprintf(
63-
'<div class="%s loading" style="color: rgb(50,50,50);">Drawing...</div><div id="%s" style="height: %s; width: %s;" ></div><script type="text/javascript">Plotly.plot("%s", %s, %s).then(function() {$(".%s.loading").remove();})</script>',
63+
'<div class="%s loading" style="color: rgb(50,50,50);">Drawing...</div><div id="%s" style="height: %s; width: %s;" ></div>\n<script type="text/javascript">Plotly.plot("%s", %s, %s).then(function() {$(".%s.loading").remove();})</script>',
6464
id, id, height, width, id, data, layout, id
6565
)
6666
}

0 commit comments

Comments
 (0)