简体   繁体   English

"R Markdown HTML 输出到 Sharepoint 的渲染问题"

[英]Render Issues for R Markdown HTML Output to Sharepoint

I've finished a lovely R Markdown script with an HTML output and was excited to share the analysis to colleagues internally, by sharing the Sharepoint link.我已经完成了一个带有 HTML 输出的可爱的 R Markdown 脚本,并且很高兴通过共享 Sharepoint 链接与内部同事分享分析。

The output works fine when I open the HTML file directly on my machine.当我直接在我的机器上打开 HTML 文件时,输出工作正常。 But for whatever reason, when I share or view via the Sharepoint link, simple things like the TOC, plotly graphs and leaflet maps do not render.但无论出于何种原因,当我通过 Sharepoint 链接共享或查看时,TOC、绘图和传单地图等简单的东西都不会呈现。

Here's an example of the problem I'm running into, with some really basic script just as an example.这是我遇到的问题的一个示例,其中包含一些非常基本的脚本作为示例。

---
title: "Test_Output"
output: 
  html_document:
    toc: true
    toc_float: true
    
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown
Hello, this is a test.

## Test
```{r test plotly, echo = FALSE, warning = FALSE, message = FALSE}
library(plotly)
plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length)
```

And so this is the output, right.所以这就是输出,对吧。

在此处输入图像描述

But when I share the link (something like this https://mycompany.sharepoint.com/:f:/s/mydepartment/EvLlZjmxOetc ) or if someone were to try and just navigate to the page on our Sharepoint, the output is all messed up.但是当我分享链接时(类似这样的https://mycompany.sharepoint.com/:f:/s/mydepartment/EvLlZjmxOetc )或者如果有人试图导航到我们的 Sharepoint 上的页面,输出就是全部弄乱。 It looks like this: plots and TOC and maps do not render.它看起来像这样:绘图和 TOC 和地图不渲染。

在此处输入图像描述

If anyone can help me to figure out how to allow my Markdown HTML output to render instantly once I share the link, that would be incredible, and I would feel like all my work on the script was not in vain!如果有人可以帮助我弄清楚如何让我的 Markdown HTML 输出在我分享链接后立即呈现,那将是不可思议的,我会觉得我在脚本上所做的所有工作都没有白费!

I've tried adding "download=1" to the end of the URL, which indeed gives users an ability to view the output correctly by clicking the link and downloading the HTML, but this is not optimal as this is supposed to be a live product that I will continue updating.我尝试在 URL 的末尾添加“download=1”,这确实使用户能够通过单击链接并下载 HTML 来正确查看输出,但这并不是最佳的,因为这应该是实时的我将继续更新的产品。

Turns out that a solution is to rename your HTML file to aspx.事实证明,一个解决方案是将您的 HTML 文件重命名为 aspx。 Then, when you provide the link to users in your organisation, they can easily view it.然后,当您向组织中的用户提供链接时,他们可以轻松查看。

renaming .aspx is really clever !重命名 .aspx 真的很聪明! thanks it works for interactive charts made with rAmCharts感谢它适用于使用 rAmCharts 制作的交互式图表

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM