/usr/lib/R/site-library/highr/doc/highr-custom.html is in r-cran-highr 0.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | <!DOCTYPE html>
<html>
<head>
<title>Customization of the <code>highr</code> package</title>
<meta charset="utf-8">
<meta name="generator" content="knitr" />
<link rel="stylesheet" href="/usr/share/javascript/highlight.js/styles/github.css">
<style type="text/css">
/* Derived from the Docco package by Jeremy Ashkenas: https://github.com/jashkenas/docco/ */
body {
font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
height:100%;
font-size: 16px;
line-height: 24px;
color: #30404f;
margin: 0;
padding: 0;
}
h1, h2, h3, h4, h5, h6 {
color: #112233;
line-height: 1em;
font-weight: normal;
margin: 0 0 15px 0;
}
p {
margin: 0 0 15px 0;
font-size:17px;
}
#footer p{
margin:0;
font-size:12px;
text-align: center;
}
a{
color:#0088cc;
text-decoration:none;
}
a:hover,a:focus{
color:#005580;
text-decoration:underline;
}
#container {
position: relative;
margin: 0;
height:100%;
}
body > #container { height: auto; min-height: 100%; }
table{
width:100%;
border: 0;
outline: 0;
}
td.docs{
width: 50%;
text-align: left;
vertical-align: top;
padding: 10px 25px 1px 50px;
}
td.code{
background: #f5f5ff;
padding: 10px 25px 1px 50px;
overflow-x: hidden;
vertical-align: top;
}
code{
font-size:12px;
margin: 0;
padding: 0;
}
td.docs code{
background: #f8f8ff;
border: 1px solid #dedede;
font-size: 80%;
padding: 0 0.2em;
}
td.docs img{
max-width: 100%;
}
pre code{
padding:2px 4px;
background:#f5f5ff;
}
td.code pre code{
line-height: 18px;
}
.pilwrap {
position: relative;
}
.pilcrow {
font: 12px Arial;
text-decoration: none;
color: rgb(69, 69, 69);
position: absolute;
top: 3px;
left: -20px;
padding: 1px 2px;
opacity: 0;
}
td.docs:hover .pilcrow {
opacity: 1;
}
blockquote {
border-left: 4px solid #DDD;
padding: 0 15px;
color: #777;
}
div.handler{
width: 5px;
padding: 0;
cursor: col-resize;
position: absolute;
z-index: 5;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/7.3/highlight.min.js"></script>
<script type="text/javascript">
hljs.LANGUAGES.r=function(a){var b="([a-zA-Z]|\\.[a-zA-Z.])[a-zA-Z0-9._]*";return{c:[a.HCM,{b:b,l:b,k:{keyword:"function if in break next repeat else for return switch while try tryCatch|10 stop warning require library attach detach source setMethod setGeneric setGroupGeneric setClass ...|10",literal:"NULL NA TRUE FALSE T F Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10"},r:0},{cN:"number",b:"0[xX][0-9a-fA-F]+[Li]?\\b",r:0},{cN:"number",b:"\\d+(?:[eE][+\\-]?\\d*)?L\\b",r:0},{cN:"number",b:"\\d+\\.(?!\\d)(?:i\\b)?",r:0},{cN:"number",b:"\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b",r:0},{cN:"number",b:"\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b",r:0},{b:"`",e:"`",r:0},{cN:"string",b:'"',e:'"',c:[a.BE],r:0},{cN:"string",b:"'",e:"'",c:[a.BE],r:0}]}}(hljs);
</script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="https://yihui.github.io/media/js/center-images.js"></script>
</head>
<body>
<div id="container">
<table><!--table start-->
<tr id="row1"><td class="docs"><div class="pilwrap"><a class="pilcrow" href="#row1">¶</a></div><!--
%\VignetteEngine{knitr::docco_classic}
%\VignetteIndexEntry{Customization of the highr package}
-->
<h1>Customization of the <code>highr</code> package</h1>
<p>If you are not satisfied with the default syntax highlighting commands in
the <strong>highr</strong> package, you can just use your own tags/commands. In this
vignette, we show a brief example.</p>
</td><td class="code"></td></tr><tr id="row2"><td class="docs"><div class="pilwrap"><a class="pilcrow" href="#row2">¶</a></div><p>The default highlighting commands are stored in two internal data frames
<code>cmd_latex</code> and <code>cmd_html</code>:</p></td><td class="code"><pre><code class="r">library(highr)
highr:::cmd_latex
</code></pre>
<pre><code>## cmd1 cmd2
## COMMENT \\hlcom{ }
## FUNCTION \\hlkwa{ }
## IF \\hlkwa{ }
## ELSE \\hlkwa{ }
## WHILE \\hlkwa{ }
## FOR \\hlkwa{ }
## IN \\hlkwa{ }
## BREAK \\hlkwa{ }
## REPEAT \\hlkwa{ }
## NEXT \\hlkwa{ }
## NULL_CONST \\hlkwa{ }
## LEFT_ASSIGN \\hlkwb{ }
## EQ_ASSIGN \\hlkwb{ }
## RIGHT_ASSIGN \\hlkwb{ }
## SYMBOL_FORMALS \\hlkwc{ }
## SYMBOL_SUB \\hlkwc{ }
## SLOT \\hlkwc{ }
## SYMBOL_FUNCTION_CALL \\hlkwd{ }
## NUM_CONST \\hlnum{ }
## '+' \\hlopt{ }
## '-' \\hlopt{ }
## '*' \\hlopt{ }
## '/' \\hlopt{ }
## '^' \\hlopt{ }
## '$' \\hlopt{ }
## '@' \\hlopt{ }
## ':' \\hlopt{ }
## '?' \\hlopt{ }
## '~' \\hlopt{ }
## '!' \\hlopt{ }
## SPECIAL \\hlopt{ }
## GT \\hlopt{ }
## GE \\hlopt{ }
## LT \\hlopt{ }
## LE \\hlopt{ }
## EQ \\hlopt{ }
## NE \\hlopt{ }
## AND \\hlopt{ }
## AND2 \\hlopt{ }
## OR \\hlopt{ }
## OR2 \\hlopt{ }
## NS_GET \\hlopt{ }
## NS_GET_INT \\hlopt{ }
## STANDARD \\hlstd{ }
## STR_CONST \\hlstr{ }
</code></pre></td></tr><tr id="row3"><td class="docs"><div class="pilwrap"><a class="pilcrow" href="#row3">¶</a></div>
<p>This data frame is passed to the <code>markup</code> argument in <code>hilight()</code>, so we are
free to pass a modified version there. Suppose I want to use the command
<code>\my<*></code> instead of <code>\hl<*></code>:</p></td><td class="code"><pre><code class="r">m = highr:::cmd_latex
m[, 1] = sub("\\hl", "\\my", m[, 1], fixed = TRUE)
head(m)
</code></pre>
<pre><code>## cmd1 cmd2
## COMMENT \\mycom{ }
## FUNCTION \\mykwa{ }
## IF \\mykwa{ }
## ELSE \\mykwa{ }
## WHILE \\mykwa{ }
## FOR \\mykwa{ }
</code></pre></td></tr><tr id="row4"><td class="docs"><div class="pilwrap"><a class="pilcrow" href="#row4">¶</a></div>
<p>Then</p></td><td class="code"><pre><code class="r">hilight("x = 1+1 # a comment") # default markup
</code></pre>
<pre><code>## [1] "\\hlstd{x} \\hlkwb{=} \\hlnum{1}\\hlopt{+}\\hlnum{1} \\hlcom{# a comment}"
</code></pre>
<pre><code class="r">hilight("x = 1+1 # a comment", markup = m) # custom markup
</code></pre>
<pre><code>## [1] "\\mystd{x} \\mykwb{=} \\mynum{1}\\myopt{+}\\mynum{1} \\mycom{# a comment}"
</code></pre></td></tr><tr id="row5"><td class="docs"><div class="pilwrap"><a class="pilcrow" href="#row5">¶</a></div>
<p>This allows one to use arbitrary commands around the text symbols in the R
code. See <a href="https://github.com/yihui/highr/blob/master/R/highlight.R">https://github.com/yihui/highr/blob/master/R/highlight.R</a> for how
<code>cmd_latex</code> and <code>cmd_html</code> were generated in <strong>highr</strong>.</p>
</td><td class="code"></td></tr>
</table><!--table end-->
</div>
<script src="/usr/share/javascript/jquery/jquery.min.js"></script>
<script src="https://yihui.github.io/knitr/js/docco-resize.js"></script>
</body>
</html>
|