Package: prismjs 2.1.0
prismjs: Server-Side Syntax Highlighting
Prism <https://prismjs.com/> is a lightweight, extensible syntax highlighter, built with modern web standards in mind. This package provides server-side rendering in R using 'V8' such that no JavaScript library is required in the resulting HTML documents. Over 400 languages are supported.
Authors:
prismjs_2.1.0.tar.gz
prismjs_2.1.0.zip(r-4.5)prismjs_2.1.0.zip(r-4.4)prismjs_2.1.0.zip(r-4.3)
prismjs_2.1.0.tgz(r-4.5-any)prismjs_2.1.0.tgz(r-4.4-any)prismjs_2.1.0.tgz(r-4.3-any)
prismjs_2.1.0.tar.gz(r-4.5-noble)prismjs_2.1.0.tar.gz(r-4.4-noble)
prismjs_2.1.0.tgz(r-4.4-emscripten)prismjs_2.1.0.tgz(r-4.3-emscripten)
prismjs.pdf |prismjs.html✨
prismjs/json (API)
NEWS
# Install 'prismjs' in R: |
install.packages('prismjs', repos = c('https://ropensci.r-universe.dev', 'https://cloud.r-project.org')) |
Bug tracker:https://github.com/ropensci/prismjs/issues
Pkgdown site:https://docs.ropensci.org
On CRAN:prismjs-2.1.0(2025-01-07)
Last updated 2 months agofrom:09af79b5da (on master). Checks:9 OK. Indexed: yes.
Target | Result | Latest binary |
---|---|---|
Doc / Vignettes | OK | Mar 08 2025 |
R-4.5-win | OK | Mar 08 2025 |
R-4.5-mac | OK | Mar 08 2025 |
R-4.5-linux | OK | Mar 08 2025 |
R-4.4-win | OK | Mar 08 2025 |
R-4.4-mac | OK | Mar 08 2025 |
R-4.4-linux | OK | Mar 08 2025 |
R-4.3-win | OK | Mar 08 2025 |
R-4.3-mac | OK | Mar 08 2025 |
Exports:prism_highlight_documentprism_highlight_textprism_languagesprism_process_xmldoc
Citation
To cite package ‘prismjs’ in publications use:
Ooms J (2025). prismjs: Server-Side Syntax Highlighting. R package version 2.1.0, https://github.com/ropensci/prismjs.
Corresponding BibTeX entry:
@Manual{, title = {prismjs: Server-Side Syntax Highlighting}, author = {Jeroen Ooms}, year = {2025}, note = {R package version 2.1.0}, url = {https://github.com/ropensci/prismjs}, }
Readme and manuals
prismjs
Server-side syntax highlighting in R using prism.js
Install
# Download and install prismjs in R
install.packages('prismjs',
repos = c('https://ropensci.r-universe.dev','https://cloud.r-project.org'))
Example
Highlight a single code snippet:
library(prismjs)
input <- "p { color: red }"
html <- prism_highlight_text(input, language = 'css')
cat(html)
## <span class="token selector">p</span> <span class="token punctuation">{</span> <span class="token property">color</span><span class="token punctuation">:</span> <span class="token color">red</span> <span class="token punctuation">}</span>
Or process an entire document:
prism_highlight_document("input.html", output = "output.html")
Help Manual
Help page | Topics |
---|---|
Prism Syntax Highlighter | prismjs prism_highlight_document prism_highlight_text prism_languages prism_process_xmldoc |