Comments (9)
That is odd. What is your version of RStudio and operating system?
from bookdown.
Ubuntu 14.04 with RStudio 0.99.878.
from bookdown.
I cannot reproduce it with the current release of RStudio 0.99.892 on Ubuntu 15.04: https://www.rstudio.com/products/rstudio/download/
from bookdown.
The issue persists after updating to RSTudio 0.99.892. I installed knitr from you github repo so that the version is 1.12.21 to solve some initial issues I had rendering the bookdown example in the inst folder. servr is at version 0.3.
To try to narrow the issue down I reduced the example in the inst folder to a minimal template and I can reproduce the issue with that smaller file-set. Perhaps I should update all your packages to the yihui-XRAN repo.
from bookdown.
I don't think this is relevant to knitr, because you said even servr::httd()
for static HTML files had the same problem.
The possible reason is that your Ubuntu system does not recognize the MIME type of .html files. You may run the system command mimetype
on any HTML file to see the output, or servr:::guess_type()
on an HTML file. The expected output is text/html
, and you system might give application/octet-stream
.
from bookdown.
Yes, that is probably it!
> servr:::guess_type("index.html")
[1] "application/x-extension-html"
It appears to be an oddity introduced by installing firefox. Looking at /etc/mimetypes, everything seems to be in order:
~ ❯❯❯ grep html /etc/mime.types
[...]
text/html html htm shtml
But in .local/share/applications
~/.l/s/applications ❯❯❯ ag "x-extension-html"
mimeapps.list
25:application/x-extension-html=firefox.desktop
66:application/x-extension-html=firefox.desktop;
I've never run into this before, so I will have a look how to change that.
from bookdown.
Do you know how to modify MIME types? If not, you may look at this article: https://help.ubuntu.com/community/AddingMimeTypes It is odd anyway; application/x-extension-html
should not be the default MIME type for .html files on Ubuntu.
from bookdown.
Yes, it was in fact the mime type that was causing the issue. I am not sure which application made the change, but suspect it was Firefox at some point.
To change the mime type for html files back to the text/html default these were the steps I had to take. Remove the x-extension-html.xml and user-extension-html.xml files from the ~./local/share/mime folder and then rebuild the mime type database. In the steps below I do not delete the files, but copy them to the desktop.
mv ./local/share/mime/application/x-extension-html.xml ~/Desktop
mv ./local/share/mime/packages/user-extension-html.xml ~/Desktop
update-mime-database ~/.local/share/mime
Then log-out and log in again. The mimetype is now correct and the bookdown preview works as expected.
from bookdown.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
from bookdown.
Related Issues (20)
- [FR] Add support for the YALM setting "language: ui: references_name" to change the title of references section in html output HOT 7
- Image embeded in flextable lost in .docx output HOT 3
- [FR] Typst Support HOT 3
- Equation in book is broken HOT 3
- [FR] Allow to use `$$` for numbering equation in **bookdown**
- R4.3 error if multiple files are passed to `render_book` without an `output_format` specified HOT 2
- crosstalk html widget doesn't display the figure caption HOT 3
- html output error with echo=FALSE option HOT 1
- [FR] Multi language support
- Square brackets around citations in text HOT 2
- Cannot generate pdf via "server" but only html despite I tried probably all suggestions. HOT 4
- Use of 'tab.scap.' for tables? (Non kable() users!) HOT 2
- Hyphenation only works in English HOT 17
- bs4_book - references by chapter not displaying HOT 1
- The manual's recommendation of only previewing the web version is dangerous. HOT 5
- Search in gitbook doesn't work because of empty search_index.json HOT 5
- Check and adapt to new `--number-sections` in Pandoc 3.1.12 HOT 5
- Unnumbered didn't work properly HOT 8
- Section numbering increments on unnumbered sections HOT 2
- [FR] pdf_book compilation: for easier refactoring LaTeX chunks please remove _main.Rmd file HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bookdown.