How to deal with double curly braces in a piece of code?

I am writing Rmdfiles representing a package whisker. And use slidifyto compile it into html slides.

Therefore, it is inevitable to use {{and in the code }}. I wrote the following code in a file Rmd:

```{r}
tpl <- "
<b>Against:</b> {{x.against}}<br/>
<b>Venue:</b> {{x.venue}}<br/>
<b>Match:</b> {{x.type}}<br/>
<b>Score:</b> {{x.score}}<br/>
<b>Result:</b> <span class={{x.result}}>{{x.result}}</span><br/>
{{#x.sr}}<b>Strike Rate:</b> {{x.sr}} {{/x.sr}}
"
```

But in the analyzed file, htmlcurly braces and contents inside are ignored:

<pre><code class="r">tpl &lt;- &quot;
&lt;b&gt;Against:&lt;/b&gt; &lt;br/&gt;
&lt;b&gt;Venue:&lt;/b&gt; &lt;br/&gt;
&lt;b&gt;Match:&lt;/b&gt; &lt;br/&gt;
&lt;b&gt;Score:&lt;/b&gt; &lt;br/&gt;
&lt;b&gt;Result:&lt;/b&gt; &lt;span class=&gt;&lt;/span&gt;&lt;br/&gt;

&quot;
</code></pre>

It is not possible to write html directly in a file Rmdfor codes. Option results='asis'c knitronly affects the output, and not the code fragment.

Is there any solution for working with {{and }}in a code block? Thank.

+4
source share
2

Slidify . , .

--- .RAW

Template

```{r}
{{ myvariable }}
```

, .RAW , .

+2

, knitr? RStudio ( , Rmd, ), ; , , .

RStudio, ?

0

Source: https://habr.com/ru/post/1545346/


All Articles