In a R markdown html file I constructed, toc works on my laptop but not if I open the saved file on other computers. By “not working” I mean, clicking the toc bullet points won’t lead to the respective section. Either nothing happens or the result is a blank page, depends on the browser. The computers “elsewhere” belong to an institution (hospital), not sure what are the implications of that except that I have no administrate privilege to them.
Here are more details:
The file is something like this:
---
title: 'very interesting analysis'
author: "my name"
date: "3/14/1592"
output:
html_document:
toc: yes
theme: united
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
headline 1a
headline 2a
Text, code chunks, output
headline 2b
Text, code chunks, output
headline 2c
Text, code chunks, output
headline 1b
headline 2c
Text, code chunks, output
headline 2d
Text, code chunks, output
Here is what I tried so far:
- When I knit the code on my laptops - toc works well on the two of them.
- I open the file on a browser - Chrome or Edge - toc still works well.
- I save the html file locally, then open it - still works well.
- I attach the html to a draft email – this is so I can download it anywhere. If I download from the draft email to my laptops, toc still works well.
- But when I download the file to computers elsewhere, the toc is printed but clicking the toc bullet point doesn’t lead to the respective section, as described above.
Does anyone have an idea why is that, and whether there is anything I can change in the file to have a more consistent effect across computers?