Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include picture for quiz in learnr #628

Open
DrAtzi opened this issue Dec 5, 2021 · 2 comments
Open

Include picture for quiz in learnr #628

DrAtzi opened this issue Dec 5, 2021 · 2 comments
Labels
FAQ 🙋 Good question/issue for FAQ section in docs

Comments

@DrAtzi
Copy link

DrAtzi commented Dec 5, 2021

Hello,

I am using learnr to create a quiz for my students and I wonder if it is possible to include pictures in learnr? I know how to include picture in rmarkdoen, but the same code doesn't work for learnr. There is no error, just the picture is not shown when I run the code. I apologize if this a stupid quesion; I am just starting with R and still have a lot to learn. However, I googled that issue already, but I didn't find an answer.

I'd appreciate any advice!

@edgar-treischl
Copy link

edgar-treischl commented Dec 5, 2021

Hi DrAtzi,

it works the same as with shiny applications. Create a folder (called “www”) and adjust the path in markdown to ![](www/picture.png). Or you can use the html tag: <img src="www/picture.png" style="width: 80%"/>.

Best,
Edgar

@gadenbuie
Copy link
Member

gadenbuie commented Dec 5, 2021

If the image is part of the static content, you can include it just like in a regular R Markdown document: ![image description](picture.png).

This doesn't work for images that are shown as part of the dynamic content. When an image appears in a question or another part of your app, place the image in an images/ folder next to your tutorial. learnr makes sure that folder is accessible by the shiny app that runs the tutorial, so you can reference the image as ![image description](images/picture.png). (This is very much in line with @edgar-treischl's answer above, but I recommend this approach instead so you don't have to worry as much about the path to the image.)

You can read more about this in the section on external resources in the Get Started article.

@gadenbuie gadenbuie added the FAQ 🙋 Good question/issue for FAQ section in docs label Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FAQ 🙋 Good question/issue for FAQ section in docs
Projects
None yet
Development

No branches or pull requests

3 participants