Rstudio Browser overrides code

..i'am very new to rmarkdown and maybe i just made a beginner error, but i hope someone can explain why this happens.

I made a basic rmarkdown file which looks like this:


In the Viewer pane of Rstudio (1.2.1335) both logos (upper part) are rendered correctly - everything is fine.

Then i convert the Rmd file to normal Markdown and use the pelican devserver to render the page for my blog.

The Problem is that the 2nd logo (lower part) made with knitr incude_graphics function is displayed in fullsize like you see there.

The Browser "magically" insert 'style="width: 958px' and override my setting in the code
(width="80" height="80">)

Can someone explain why this happens and how it can be avoided?

Thanks a lot

Oliver

I don't know about Pelican but what does the input to Pelican Markdown look likes ? Which output to you use ?

Is it possible that pelican is inserting this specific styles in your image tag ?

Which browser is that ?

..thanks for your reply - this happens with firefox(85.0.1) and chrome(87.0.4280.66)

I use knitr and 'render_markdown()' to convert the Rmd file.
The resulting markdown code looks like this:

---
title: Learning rmarkdown
date: 23.02.2021
category: about
---

<style>
div.blue { background-color:#e6f0ff; border-radius: 5px; padding: 10px;}
</style>

<center>
<img src="images/rmarkdown.png" alt="rmarkdown logo" style="width: 150px">
</center>


<img src="images/rmarkdown.png" title="center" alt="logo" width="50" height="50" style="display: block; margin: auto;" />

<br>
Ab heute wird meine kleine Website moderner - es wird mal wieder Zeit etwas neues, besseres zu machen. 
Die Möglichkeiten sind vielfältig und mit Rstudio steht ein gutes Werkzeug für allerlei spannende Entwicklungen zur Verfügung. 
<br><br>

<div class = "blue">
Als blutiger Anfänger in Sachen R, beschreibe ich, welche Fehler mir passiert sind und wie ich sie (hoffentlich) gelöst habe.
</div>

This markdown looks fine. You should look into the HTML produced by pelican to see if the styles are added by it, or by your browser.

Hi cderv, thank you very much for your hint.
You were absolutely right - a pelican plugin added the extra style info and that causes the problem.
So this was no problem with Rstudio at all.

Oliver

1 Like