Learn R Programming

prettifyAddins

RStudio addins to prettify JavaScript / HTML / CSS / Markdown / C++ and more.

JavaScript example:

The Markdown prettifier also prettifies the code blocks:

NEWS

  • As of version 1.0.0, there are six addins:

The 'shiny' addins are the ones you can see on the above GIFs. The other ones are not interactive. The 'Prettify C/C++/Java' addin requires clang-format (it is possible to reindent C/C++/Java (and more) with the 'Indent (shiny)' addin).

  • As of version 2.0.0, there are five new addins:
    • 'Indent (PhantomJS)': allows to reindent code for some languages which
    were supported by the 'Indent (shiny)' addin only, whereas this addin does not run a Shiny app; these languages are C, C++, Java, Fortran, Julia, Python, SAS, Scala, Shell, and SQL. This addin requires phantomjs (the package provides a function to install this software).
    • 'Prettify LaTeX': to prettify LaTeX code; works for Sweave code. It
    requires latexindent, which is included in MikTeX and TeX Live distributions.
    • 'Prettify Julia': to prettify Julia code. It requires Julia.
    • 'Prettify Python': to prettify Python code. It requires
    black.
    • 'Prettify (formatCodeApi)': to prettify Java, JSON, and Ruby.

Moreover, this version exports the functions used to prettify/reindent. For example:

code <- c(
  "function f(x){",
  "return x+1",
  "}"
)
cat(prettify_V8(code, "javascript"))

gives

function f(x) {
  return x + 1;
}

Copies of license agreements

The 'prettifyAddins' package as a whole is distributed under GPL-3 (GNU GENERAL PUBLIC LICENSE version 3).

It includes other open source software components:

Full copies of the license agreements used by these components are included in the file LICENSE.note.

Copy Link

Version

Install

install.packages('prettifyAddins')

Monthly Downloads

130

Version

2.6.1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Stc3<a9>phane Laurent

Last Published

September 14th, 2023

Functions in prettifyAddins (2.6.1)

getPrettifiableLanguages

Prettifiable languages
prettifyAddins

Prettify Addins
prettifyCLANG

Prettify C, C++, Java
prettify_V8

Prettify code using V8
prettifyJulia

Prettify Julia
reindent_Shiny

Reindent code using Shiny
reindent_PhantomJS

Reindent code using PhantomJS
prettifyXML

Prettify XML
prettify_FCA

Prettify Java, JSON or Ruby
prettifyHTML

Prettify HTML
prettifyAddins-imports

Install PhantomJS
prettifyLaTeX

Prettify LaTeX
prettifyPython

Prettify Python
prettify_Shiny

Prettify code using Shiny
reindent_V8

Reindent code using V8
reindent_chromote

Reindent code using chromote
wordWrap

Word wrap using V8