bookdown::render_book vs. rmarkdown::render_site to build all outputs










1















I've got a Bookdown book for which I'd like to build a GitBook site as well as PDF and EPUB downloads. I will use Travis to build all 3 outputs, and the PDF and EPUB will be available for download from the GitBook site.



The bookdown-demo calls bookdown::render_book once for each output in _build.sh.



However, according to the logs in RStudio, the Build Book button, when building All Formats, uses rmarkdown::render_site(encoding = 'UTF-8') to build all outputs in a single command.



I'd like to ensure what happens on my CI server is exactly what happens in my IDE, so it seems like I should have Travis call rmarkdown::render_site rather than several invocations of bookdown::render_book as is done by the bookdown-demo. However, Yihui is the expert, and he has chosen to use the latter approach.



So, my question: what is the best script to invoke on a continuous integration server like Travis when multiple outputs will be built?










share|improve this question




























    1















    I've got a Bookdown book for which I'd like to build a GitBook site as well as PDF and EPUB downloads. I will use Travis to build all 3 outputs, and the PDF and EPUB will be available for download from the GitBook site.



    The bookdown-demo calls bookdown::render_book once for each output in _build.sh.



    However, according to the logs in RStudio, the Build Book button, when building All Formats, uses rmarkdown::render_site(encoding = 'UTF-8') to build all outputs in a single command.



    I'd like to ensure what happens on my CI server is exactly what happens in my IDE, so it seems like I should have Travis call rmarkdown::render_site rather than several invocations of bookdown::render_book as is done by the bookdown-demo. However, Yihui is the expert, and he has chosen to use the latter approach.



    So, my question: what is the best script to invoke on a continuous integration server like Travis when multiple outputs will be built?










    share|improve this question


























      1












      1








      1








      I've got a Bookdown book for which I'd like to build a GitBook site as well as PDF and EPUB downloads. I will use Travis to build all 3 outputs, and the PDF and EPUB will be available for download from the GitBook site.



      The bookdown-demo calls bookdown::render_book once for each output in _build.sh.



      However, according to the logs in RStudio, the Build Book button, when building All Formats, uses rmarkdown::render_site(encoding = 'UTF-8') to build all outputs in a single command.



      I'd like to ensure what happens on my CI server is exactly what happens in my IDE, so it seems like I should have Travis call rmarkdown::render_site rather than several invocations of bookdown::render_book as is done by the bookdown-demo. However, Yihui is the expert, and he has chosen to use the latter approach.



      So, my question: what is the best script to invoke on a continuous integration server like Travis when multiple outputs will be built?










      share|improve this question
















      I've got a Bookdown book for which I'd like to build a GitBook site as well as PDF and EPUB downloads. I will use Travis to build all 3 outputs, and the PDF and EPUB will be available for download from the GitBook site.



      The bookdown-demo calls bookdown::render_book once for each output in _build.sh.



      However, according to the logs in RStudio, the Build Book button, when building All Formats, uses rmarkdown::render_site(encoding = 'UTF-8') to build all outputs in a single command.



      I'd like to ensure what happens on my CI server is exactly what happens in my IDE, so it seems like I should have Travis call rmarkdown::render_site rather than several invocations of bookdown::render_book as is done by the bookdown-demo. However, Yihui is the expert, and he has chosen to use the latter approach.



      So, my question: what is the best script to invoke on a continuous integration server like Travis when multiple outputs will be built?







      r r-markdown knitr bookdown






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 '18 at 22:03







      Jeff Hammerbacher

















      asked Nov 14 '18 at 21:56









      Jeff HammerbacherJeff Hammerbacher

      3,38822532




      3,38822532






















          1 Answer
          1






          active

          oldest

          votes


















          1














          In bookdown projects, they usually don't make a difference, because rmarkdown::render_site() eventually calls bookdown::render_book() to render your book. Feel free to use either way.



          The only exception is when your index.Rmd does not contain the field site: bookdown::bookdown_site. In that case, rmarkdown::render_site() won't work, because it doesn't know this is supposed to be a bookdown project.



          BTW, to render all output formats with bookdown::render_book(), you can use the argument output_format = 'all'.






          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53309328%2fbookdownrender-book-vs-rmarkdownrender-site-to-build-all-outputs%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            In bookdown projects, they usually don't make a difference, because rmarkdown::render_site() eventually calls bookdown::render_book() to render your book. Feel free to use either way.



            The only exception is when your index.Rmd does not contain the field site: bookdown::bookdown_site. In that case, rmarkdown::render_site() won't work, because it doesn't know this is supposed to be a bookdown project.



            BTW, to render all output formats with bookdown::render_book(), you can use the argument output_format = 'all'.






            share|improve this answer



























              1














              In bookdown projects, they usually don't make a difference, because rmarkdown::render_site() eventually calls bookdown::render_book() to render your book. Feel free to use either way.



              The only exception is when your index.Rmd does not contain the field site: bookdown::bookdown_site. In that case, rmarkdown::render_site() won't work, because it doesn't know this is supposed to be a bookdown project.



              BTW, to render all output formats with bookdown::render_book(), you can use the argument output_format = 'all'.






              share|improve this answer

























                1












                1








                1







                In bookdown projects, they usually don't make a difference, because rmarkdown::render_site() eventually calls bookdown::render_book() to render your book. Feel free to use either way.



                The only exception is when your index.Rmd does not contain the field site: bookdown::bookdown_site. In that case, rmarkdown::render_site() won't work, because it doesn't know this is supposed to be a bookdown project.



                BTW, to render all output formats with bookdown::render_book(), you can use the argument output_format = 'all'.






                share|improve this answer













                In bookdown projects, they usually don't make a difference, because rmarkdown::render_site() eventually calls bookdown::render_book() to render your book. Feel free to use either way.



                The only exception is when your index.Rmd does not contain the field site: bookdown::bookdown_site. In that case, rmarkdown::render_site() won't work, because it doesn't know this is supposed to be a bookdown project.



                BTW, to render all output formats with bookdown::render_book(), you can use the argument output_format = 'all'.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 21 '18 at 20:07









                Yihui XieYihui Xie

                20.6k11108290




                20.6k11108290





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53309328%2fbookdownrender-book-vs-rmarkdownrender-site-to-build-all-outputs%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Use pre created SQLite database for Android project in kotlin

                    Darth Vader #20

                    Ondo