Skip to content

Server-side syntax highlighting in R using prism.js

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

ropensci/prismjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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")

About

Server-side syntax highlighting in R using prism.js

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Code of conduct

Stars

Watchers

Forks

Packages

No packages published