How to display verbatim code in R shiny? - r

I'm currently using helpText in my ui.R file to display some static code content. However, because the output is not fixed width, the code looks like a mess. So how to display verbatim code; fixed width so it's easy to read?

I'm not sure I understand the problem, but the first solution would be renderVerbatim. If that doesn't cut it, you could look at ShinyAce, though that may be overkill for what you need; if does have nice features like syntax highlighting for R, though.

I believe this is highly related to a related Shiny question about rendering multiple lines of text at once:
Outputting multiple lines of text with renderText() in R shiny
At least, the main answer there is one way to solve this problem.

Related

Inserting a slide break within a code chunk in rmarkdown

I am preparing some slides using Rmarkdown (ioslides_presentation) and I was wondering if it is possible to force a slide break within a chunk of code.
I saw some similar questions for pdf, but I cannot make those solutions work in the case of HTML slides.
Thanks!
~1.5 years later, I came here looking for an answer to the same question. For future people in the same situation:
I managed to solve it with
knitr::asis_output("\n\n---\n\n")
at the position were I wanted to force a new slide.

Syntax highlighting R script

As my R scripts get long and messy, I would like to create headers that are easily identifiable: for instance, change the color of certain comments in script. I am not looking for something crazy like underlining or changing the fonts for chunks of comments, just changing color, i.e. highlighting comments.
From all my search, the only option is to change the Editor appearance from setting, but I would like to distinguish certain chunks of comments from other comments.

R shiny sliderInput show time

I have a question related to the sliderInput in R shiny.
In the sliderInput, the value is a number. Some examples show that the number is $number. However, if I want to show the value of sliderInput as a time, say 10:00, 15:00, how should I do it?
Thanks a lot.
This is a partial answer, giving you some pointers that anyone with some JS knowledge can use. To the best of my knowledge, as of Shiny-0.5, you can achieve this only by writing some Javascript/JQuery.
If you are able to incorporate JQuery plug-ins into your UI.R Shiny app, this link has what you want.
Use CSS style to make sure that the SliderInput labels get formatted the way you want. (Showing Date/Time as opposed to numbers.) I typically put any tags$head() styling code inside SideBarPanel() and it has worked.
You will also need a Javascript function that takes in the input$number and returns a valid date/time. Link with code: This JQuery post has a javascript function that you should be able use (with DatePicker)
Hope that helps.

Styling footnotes for markdown

I've been using footnotes in markdown pages as mentioned in this post on DaringFireball, but I can't seem to figure out how to get them styled the way I want. Adding .footnotes {} to my style sheet allows me to style the footnote text, but I'm missing two things:
In Gruber's post, his footnote's backlink is given a style "a.footnoteBackLink," but my page simply produces "a href="link" rev="footnote". I don't know how to call this in CSS and I have no idea how I'd change it so that my markdown page outputs any differently. My backlink goes to a separate line, and I'd like to have it on the same line. Perhaps this is an issue with the markdown engine; I'm using Maruku (I think), and I could probably figure out how to change it if I knew which one I should use instead.
No matter what I put in the footnote brackets, the page outputs numbered footnotes. How can I tell it to use asterisks or other symbols? Most pages with footnotes will have only one or two, and symbols are generally correct when there are less than seven footnotes, so I'd like to do things proper.
I probably shouldn't even say this, but I've been teaching myself web development for the past couple of months and I absolutely could not have done it without SO. This is the first time I haven't found my answer here, so it's my first time asking. I love you don't get mad at me please.
There is a great variety of conversion tools out there. Each may have a different way of handling this. I found remarkable a good choice for your issue. It adds the class "footnote-item" to each footnote.
Check the live demo and inspect the HTML Output.

How do you make the longer line of a two line title appear on the bottom and the shorter on top with CSS?

Is this possible or am I just thinking wishfully?
What I want to get away from:
Title example here. It's a really long one, and I don't
like it...
What I actually want the text to do:
Title example
here. It's a really long one, and I hope it's possible.
I do know that I could split the title with PHP and insert a break, but if someone has a better solution that would be amazing.
Thanks!
jQuery can do this, but it's the same as using a conditional statement in PHP and it's putting resource work on the client. As PeeHaa said, no css can do this so it's your choice wether to do it client-side or server-side.

Resources