EVOLUTION-MANAGER
Edit File: highlight.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Highlight and link a code block</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for highlight {downlit}"><tr><td>highlight {downlit}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Highlight and link a code block</h2> <h3>Description</h3> <p>This function: </p> <ul> <li><p> syntax highlights code </p> </li> <li><p> links function calls to their documentation (where possible) </p> </li> <li><p> in comments, translates ANSI escapes in to HTML equivalents. </p> </li></ul> <h3>Usage</h3> <pre> highlight(text, classes = classes_chroma(), pre_class = NULL, code = FALSE) classes_pandoc() classes_chroma() </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>text</code></td> <td> <p>String of code to highlight and link.</p> </td></tr> <tr valign="top"><td><code>classes</code></td> <td> <p>A mapping between token names and CSS class names. Bundled <code>classes_pandoc()</code> and <code>classes_chroma()</code> provide mappings that (roughly) match Pandoc and chroma (used by hugo) classes so you can use existing themes.</p> </td></tr> <tr valign="top"><td><code>pre_class</code></td> <td> <p>Class(es) to give output <code style="white-space: pre;"><pre></code>.</p> </td></tr> <tr valign="top"><td><code>code</code></td> <td> <p>If <code>TRUE</code>, wrap output in a <code style="white-space: pre;"><code></code> block</p> </td></tr> </table> <h3>Value</h3> <p>If <code>text</code> is valid R code, an HTML <code style="white-space: pre;"><pre></code> tag. Otherwise, <code>NA</code>. </p> <p>A string containing syntax highlighted HTML or <code>NA</code> (if <code>text</code> isn't parseable). </p> <h3>Options</h3> <p>downlit provides a number of options to control the details of the linking. They are particularly important if you want to generate "local" links. </p> <ul> <li> <p><code>downlit.package</code>: name of the current package. Determines when <code>topic_index</code> and <code>article_index</code> </p> </li> <li> <p><code>downlit.topic_index</code> and <code>downlit.article_index</code>: named character vector that maps from topic/article name to path. </p> </li> <li> <p><code>downlit.rdname</code>: name of current Rd file being documented (if any); used to avoid self-links. </p> </li> <li> <p><code>downlit.attached</code>: character vector of currently attached R packages. </p> </li> <li> <p><code>downlit.local_packages</code>: named character vector providing relative paths (value) to packages (name) that can be reached with relative links from the target HTML document. </p> </li> <li> <p><code>downlit.topic_path</code> and <code>downlit.article_path</code>: paths to reference topics and articles/vignettes relative to the "current" file. </p> </li></ul> <h3>Examples</h3> <pre> cat(highlight("1 + 1")) cat(highlight("base::t(1:3)")) # Unparseable R code returns NA cat(highlight("base::t(")) </pre> <hr /><div style="text-align: center;">[Package <em>downlit</em> version 0.4.2 <a href="00Index.html">Index</a>]</div> </body></html>