diff --git a/NEWS.md b/NEWS.md index f22f7609ae..c07d1d7982 100644 --- a/NEWS.md +++ b/NEWS.md @@ -16,6 +16,8 @@ rmarkdown 2.4 - For the output format `pdf_document`, the option `fig_crop` will not be enabled unless both the programs `pdfcrop` and `ghostscript` are found (thanks, @dalupus, yihui/knitr#954). +- Fixed a bug that a chunk with a class `fold-hide` hides the rest of the chunks even the output format setting `html_document(code_folding = "show")` (thanks, @atusy, #1906). + rmarkdown 2.3 ================================================================================ diff --git a/inst/rmd/h/navigation-1.1/codefolding.js b/inst/rmd/h/navigation-1.1/codefolding.js index f228797a89..1e16fde9f8 100644 --- a/inst/rmd/h/navigation-1.1/codefolding.js +++ b/inst/rmd/h/navigation-1.1/codefolding.js @@ -22,21 +22,21 @@ window.initializeCodeFolding = function(show) { // create a collapsable div to wrap the code in var div = $('
'); - show = (show || $(this).hasClass('fold-show')) && !$(this).hasClass('fold-hide'); - if (show) div.addClass('in'); + var showThis = (show || $(this).hasClass('fold-show')) && !$(this).hasClass('fold-hide'); + if (showThis) div.addClass('in'); var id = 'rcode-643E0F36' + currentIndex++; div.attr('id', id); $(this).before(div); $(this).detach().appendTo(div); // add a show code button right above - var showCodeText = $('' + (show ? 'Hide' : 'Code') + ''); + var showCodeText = $('' + (showThis ? 'Hide' : 'Code') + ''); var showCodeButton = $(''); showCodeButton.append(showCodeText); showCodeButton .attr('data-toggle', 'collapse') .attr('data-target', '#' + id) - .attr('aria-expanded', show) + .attr('aria-expanded', showThis) .attr('aria-controls', id); var buttonRow = $('
');