Tuesday, August 27, 2013

Rstylizer - Shiny, Stata HTML Syntax Highlighter

I have released a shiny app through the Rstudio Spark server that allows for users to copy and paste Stata code into the app and it returns html formatted code.  The syntax structure is very easy to modify and I am looking forward to updating it when I have time, permitting extensions of the app to other languages as well as allowing users to customize the particular aspects of of the formatting such as making some commands bold or changing the color or how comments are identified.  In addition, I also hope to include an input field for users to add to language definitions, allowing for the creation of custom definitions.

[[The app can be found at: http://spark.rstudio.com/fsmart/RStylizer/]]

The git can be found at: https://github.com/EconometricsBySimulation/Rstylizer

In general the html generated is not very efficient since tags are repeated when css embedded styles is probably the preferred option.  However, since it makes very little difference in terms of load time, I figure this should work fine.  In addition, Blogger's gui seems to handle the tags better than embedded style sheets.

(I created an outdated git: https://github.com/EconometricsBySimulation/RFormatter as well but could not figure out how to change names so sorry for the messiness.)


  1. This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! Keep up the good work.

  2. To fix this, run the IIS Manager, right-click your machine name, choose Properties, and navigate your way to this dialog box:html coder