In RStudio, where is knitr markdown output located? - html

In RStudio, I set the knit option to current folder :
When I knit a Markdown document to HTML, this surprisingly happens in a temporary directory (for example : 'Temp\RtmpOa3xSM\preview-11e8c6644fdd.dir' directory).
As far as I can remember, this didn't happen previously : the knit would happen in the directory I selected in the options.
Option rstudio.markdownToHTML isn't set :
getOption('rstudio.markdownToHTML')
NULL
When I close the HTML preview, the HTML document disappears.
The only solution I found to keep the HTML document is to open the document in a Browser and to save it from there.
Bug or am I missing something?
Thanks for your help!
[EDIT] other Win 10 users reported to me the same problem

Under certain conditions, RStudio moves the knitted (HTML or PDF) file to a temporary directory (located under tempdir()). These conditions are:
You are in a RStudio Project.
The "Project build tools" are set to "Package".
The RMD file is located in a subdirectory vignettes.
Knitting is initiated with the "Knit" button in RStudio.
Typically, this happens when knitting a package vignette and has the purpose of "keep[ing] your vignettes folder from becoming cluttered with HTML files".
Changing the Project build tools, changing the folder name or closing the project prevents this behavior. Another way to keep the generated (HTML or PDF) file is to call rmarkdown::render interactively (although this is not exactly equivalent to the "Knit" button).
Note that this only affects where the generated file will be saved. The Working Directory while knitting is unaffected.

Related

VS Code issues with html

I'm having a few issues in VS Code specifically with HTML files.
The HTML boilerplate feature is not working (typing '!').
On existing html files that have content, the "Open in Browser" feature is no longer shown. I even see my "open-in-browser.default": "Safari" is configured in settings.json.
Not sure what change I might've done that caused this as both features were working fine not too long ago.
Fixed both issues which were actually connected. For some reason my vs code was identifying .html files as Django files. I went into the settings.json and added the following to ensure .html files would be classified as html files
"files.associations": {
"*.html": "html"
},
This then allowed the open in browser extension to identify the file as html and enable the open in default browser option along with fixing the boilerplate issue.

Inserting index.html file into Github Repository

I've created a very simple website in a Codecademy exercise that I'd like to upload to the Internet using Github Pages. Because you are unable to export your index.html and main.css files from Codecademy, I copy and pasted them into a word document, with the intent to get them in their proper file formats. However, I have been unable to find a source to convert these plain text files to .html and .css formats. Also, I've created an account on Github and a new repository, but the tutorial doesn't cover how to insert these two files into this repository.
How do I convert code from text in a document to .html and .css file format, and then insert these files into a Github repository? Thanks!
You don't need any special tools to convert plain text files to html or css.
You simply do it yourself as well.
Follow the steps to change .txt files to .html or .css:
Right-click on your index.txt or main.txt
Click on Rename from the list of options shown
Then it will take you to editing the file name
Navigate the cursor and delete txt
Type html in txt's place
Press Enter
Then you might receive a prompt asking if you are sure. Click on Yes/use .html whichever is appropriate for your prompt.
Voila! you have your file extension changed
Follow a similar approach to change the files to css as well
*Please note that my screenshots are from Mac OS and may look different from yours depending on the Operating system you are using
Hosting Webpages on Github:
Github pages website gives you a step by step guide with visual illustrations on how to do it.
If you are looking for a more comprehensive guide, then please refer to this page.
Seems nonsense, but after struggling a lot with Github Pages I have tested (and worked):
duplicate your first html file and rename it as index.html
drag and drop it into the /docs folder
drag and drop the remaining html files to the /docs folder (including the one you
have duplicated, of course with it´s original name)
commit changes
Goto Settings / Github pages and
Go down till “Github Pages”
Clic on the down arrow in [None] and select “main”
Clic on the down arrow in [/root] and select “/docs”
Clic on [Save]
After a few minutes you will see in [Settings] / “Github Pages”
Your site is published at
https://your_account_name.github.io/your_repo_name/

Iframe contents not visible in a chm file

I am compiling one chm file with set of html files. In one html file i am using iframe tag and viewing text file throught 'src' attribute. I am able to see the contents of text file inside iframe when opening that HTML file in a browser. But when viewing that file in a chm file i don't see text file content. It is showing 'This page can’t be displayed' error in iframe.
This is the tag i'm using:
<iframe src="./mytextfile.txt" style="width: 100%; height: 300px;border:none"></iframe>
Is there anything to add to view that file. Please help me.
As you can see - your problem is reproducible (here on a German Windows10 machine).
You must ensure that the text file is either in the same directory as the project (.hhp) file or in a subdirectory of that directory.
You also have to add the *.txt file extension or filename to the [FILES] list in the .hhp file, as this ensures that the text file will be compiled into the .chm file. Best way is to do this by a text editor like shown below:
Save the *.hhp file and compile all content to your *.chm file.
Done!
BTW - here are some hints to another problem may be targeted:
Microsoft introduced some security restrictions many years ago that disable functionality in HTML Help files that are accessed over a network, so what you're seeing is almost certainly by design. There are two possible solutions: move the help file to your local drive, or implement some changes in the Windows registry so that you can view the contents of remote help files.
Microsoft's summary of the problem: http://support.microsoft.com/kb/896054
You may try following workaround that lets you explicitly 'unblock' a CHM help file coming from a network drive or internet download. To do this:
Open Windows Explorer
Find your CHM file
Right click and select Propertie
Click the Unblock button on the General tab
For information on how to make the registry changes, see this page:
http://www.grainge.org/pages/authoring/chm_mspatch/896358.htm
Or more straightforwardly, use the free HHReg utility available from the page below to make the required changes.
http://www.ec-software.com/products_hhreg.html

Joomla HTML validation

I am trying to validate the home page of my Joomla. The issue is that I have the site on my local host so I can not simply copy the URL into http://validator.w3.org/ to validate.
My next thought was to open the index page in my browser and then run firebug to access the source code, and then copy and paste the code into the validator.
This seemed to work okay however when the code returns errors, I now don't know where to access the html to correct them.
Thoughts?
If you have not much knowledge about the way Joomla works, you will have to learn about the file locations.
Normaly, most changes should be done on the index.php file located in your template folder (root/templates/name_of_your_template/index.php)
If the changes you need to make aren't located in this file, you can have a look at the modules, component or plugin files that output these error and that becomes more serious.
If there is a template override for the module/component/plugin you need to modify, the files should be located in root/templates/name_of_your_template/html/name_of_the_module_component_or_plugin
If there is no template overide for the module/component/plugin that outputs the error, you will have to learn about template overrides.
Depending on your browser, there are many extensions that will validate non-accessible (i.e. localhost) pages
In Google Chrome - https://chrome.google.com/webstore/detail/html-validator/cgndfbhngibokieehnjhbjkkhbfmhojo?hl=en
Once it's installed, click on the icon and validate local page.

Strange problem while compiling CHM file

I had to write some documentation. I wrote each page in MS Word and then save each *.docx as htm file. I'm using "HTML Help Workshop" (from microsoft) to compile a chm file.
I was able to sucessfully create a chm file but the problem is that not all images in chm file are displayed. I tried decompiling the *.chm file into another folder and opened each .htm file in web browser. All images are correctly displayed.
Then why aren't they displayed in chm file. Strangely, only some of them aren't displayed. I checked if image format is causing problem, but all images are of same format. I checked if file naming is a problem, but all images are named like image[001-100].jpg in their corresponding folders.
Any idea about whats going wrong?
HTML Help Workshop (HHW) is known to have problems with the HTML generated by Word (or better put: Word generates terrible HTML). Some versions put VML coding around the IMG tags that HHW cannot handle.
Possible solutions:
In Word: Deselect the option 'Rely on VML for displaying graphics in browsers' (Tools > Options > General > Web Options)
In Word: Save as 'filtered HTML'.
In HHW: Manually add the images to the project's [FILES] section.
Let me know if any of this helps.
More information can be found in the HTML Help 1.X FAQ