Trouble incorporating R Markdown into my website.

I'm trying to incorporate R Markdown into my website. However, whenever I do so the menu bar at the top of my page shift to the other side. I tried various fixes like putting the 'style' section that shifts the menu bar into the individual 'div' that contains the R Markdown code so that it doesn't effect the menu bar. But nothing seems to be working.

Here's a picture...

What do you mean exactly ? Other side like should be on the right and this is on the left ?

Only thing I think off is related to how your other website do with CSS or JS. Maybe there is some specific styling or processing that will modify the one from the html produced with rmarkdown.

html_document() will produce a full HTML document with <head> and <body> and will rely on some resources like specific CSS and JS library depending on the feature you are using (example, it uses bootstrap by default).

When you include in another website, this could all conflict with your website style, resources and rules. Usually not easy to include a full HTML in another place without doing an <iframe>.

There is html_fragment() format too that will only produce a <body> part, but some feature will be missing.

Anyhow, not sure how to solve this except trying to isolate the possible CSS rules that are impacting

The drop down menus should be on the right, not the left. If you can visit my site you can see how it should look.

I basically just create an R Markdown HTML page and then copy and pasted it into my site. Is there a better method?

I tried isolating the CSS rules inside the relevant DIV but it didn't work.

I will try html_document() and html_fragment(). Maybe those will work.

Thanks

This will be a full HTML document with <html> <head> and <body>. Usually it is not advice to take all this and paste it in another website, the resources will conflict. html_fragment() will only give you a HTML version of you body and this should help.

Otherwise, using an iframe is the best for this

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.