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

Adding hyperlinks to incorrect message #136

Closed
mine-cetinkaya-rundel opened this issue Jan 12, 2018 · 4 comments
Closed

Adding hyperlinks to incorrect message #136

mine-cetinkaya-rundel opened this issue Jan 12, 2018 · 4 comments

Comments

@mine-cetinkaya-rundel
Copy link
Collaborator

@mine-cetinkaya-rundel mine-cetinkaya-rundel commented Jan 12, 2018

It's possible to add a hyperlink to the message displayed when an incorrect choice is selected for a multiple choice question, e.g.

question("What number is the letter A in the alphabet?",
         answer("8", message = "See [here](https://en.wikipedia.org/wiki/English_alphabet) and try again."),
         answer("14"),
         answer("1", correct = TRUE),
         answer("23"), 
         allow_retry = TRUE
         )

However in most cases I'd like to display the same incorrect message for all wrong answers, so would like to be able to do something like the following.

question("What number is the letter A in the alphabet?",
         answer("8"),
         answer("14"),
         answer("1", correct = TRUE),
         answer("23"), 
         incorrect = "See [here](https://en.wikipedia.org/wiki/English_alphabet) and try again.",
         allow_retry = TRUE
         )

This doesn't give an error however the hyperlink does not work. I think it would be a nice feature to add. The current alternative is the following, which requires repeating the message for each option.

question("What number is the letter A in the alphabet?",
         answer("8", message = "See [here](https://en.wikipedia.org/wiki/English_alphabet) and try again."),
         answer("14", message = "See [here](https://en.wikipedia.org/wiki/English_alphabet) and try again."),
         answer("1", correct = TRUE),
         answer("23", message = "See [here](https://en.wikipedia.org/wiki/English_alphabet) and try again."), 
         allow_retry = TRUE
         )
@jjallaire
Copy link
Member

@jjallaire jjallaire commented Jan 12, 2018

You could write an R function that automates the repetitive message:

alphabet_answer <- function(x) {
  answer(x, message = "See [here](https://en.wikipedia.org/wiki/English_alphabet) and try again.")
}
@mine-cetinkaya-rundel
Copy link
Collaborator Author

@mine-cetinkaya-rundel mine-cetinkaya-rundel commented Jan 12, 2018

@jjallaire Sure, that's a good workaround too. I think it might be nice to have it built into the incorrect argument since it's already there for this purpose but doesn't allow for hyperlinks.

@jjallaire
Copy link
Member

@jjallaire jjallaire commented Jan 12, 2018

Yes, you are right that it's an oversight to now allow HTML for incorrect. We will fix that!

@mine-cetinkaya-rundel
Copy link
Collaborator Author

@mine-cetinkaya-rundel mine-cetinkaya-rundel commented Jan 12, 2018

Great, thanks @jjallaire. Once that's in I can do a PR to the help file indicating this feature is available for these messages. Being able to point directly to resources is a nice feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.