Handling of conditional content

Dear community,

I have several RMarkdown gitbook content that I would like to "annotate" for internal usage. I searched online and found one stackoverflow post: here.

I like the suggestion to use child documents as that's very clean and allows a lot of options. It is not pratical for just adding a sentance here or there in a huge document. I am not a fan of the option to convert content as text.

Then I remembered about the block2 features. It works fine for basic markdown content.

```{block2, type="comment", echo = show_comment}
My content is here \alpha + \beta.

Of course this work with:

  • show_comment is a variable I initialize in my setup chunk
  • comnent is a css class that does nothing for my HTML rendering
  • I added \newenvironment{comment}{} in my latex template for my PDF rendering. One could use the preamble for the same effect.

So my questions are:

  • Do you know of better or more elegant solutions?
  • How would you handled "block" that also contains R chunk or inline R?



This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.