Skip to content

Commit

Permalink
Change the code-folding button text from "Code" to "Show" (#2489)
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui authored May 26, 2023
1 parent 151de7e commit 38391b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ rmarkdown 2.22

- Fix an issue with YAML header ending with a commented line containing incomplete yaml (thanks, @keithnewman, #2483).

- When code folding is enabled in `html_document()`, the text on the button to show the content has been changed from "Code" to "Show", because the content to show is not necessarily code, e.g., yihui/knitr#2227.


rmarkdown 2.21
================================================================================

Expand Down
4 changes: 2 additions & 2 deletions inst/rmd/h/navigation-1.1/codefolding.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ window.initializeCodeFolding = function(show) {
$(this).detach().appendTo(div);

// add a show code button right above
var showCodeText = $('<span>' + (showThis ? 'Hide' : 'Code') + '</span>');
var showCodeText = $('<span>' + (showThis ? 'Hide' : 'Show') + '</span>');
var showCodeButton = $('<button type="button" class="btn btn-default btn-xs btn-secondary btn-sm code-folding-btn pull-right float-right"></button>');
showCodeButton.append(showCodeText);
showCodeButton
Expand All @@ -57,7 +57,7 @@ window.initializeCodeFolding = function(show) {
// * Change text
// * add a class for intermediate states styling
div.on('hide.bs.collapse', function () {
showCodeText.text('Code');
showCodeText.text('Show');
showCodeButton.addClass('btn-collapsing');
});
div.on('hidden.bs.collapse', function () {
Expand Down

0 comments on commit 38391b0

Please sign in to comment.