Parameter to detect gitbook format

I am writing a document in (a variant of) Bookdown, and would like some text to appear only in the gitbook format, not in other formats. I would therefore like a parameter that is TRUE when knitting to gitbook and FALSE otherwise.

Currently I am using knitr::pandoc_to("html"), which almost does the job, except that it is TRUE when knitting to plain html as well as gitbook. The obvious alternative, knitr::pandoc_to("gitbook"), does nothing. Is there a parameter – or a way to define a parameter – that is TRUE only when knitting to gitbook, and not for other html-based formats?

1 Like

I don't think we have a function for that. I have opened a feature request to track the idea

1 Like

Thanks! Obviously not the answer I wanted, but it's really useful to have confirmation that there isn't a function for it.

1 Like

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.