yihui / knitr

A general-purpose tool for dynamic report generation in R
https://yihui.org/knitr/
2.37k stars 874 forks source link

Fix #2232: Trace chunk location in progress bar #2250

Closed zeehio closed 1 year ago

zeehio commented 1 year ago

On #2232 we discussed a minor inconsistency in chunk names between RStudio and knitr. @yihui suggested to change the progress bar when knitting, so it shows the chunk name and the line number.

Here I do that and I add as well the file name, so we know precisely the location of the chunk even when having child documents. This is how the progress bar now looks with this pull request. Notice that the label in the progress bar includes chunk name @ file name : line -range.

imatge

Download if you like the parent and child Rmd used to create the screenshot: test-rmd-with-child.zip

zeehio commented 1 year ago

Are you okay with making this feature optional? e.g., show the line numbers only when options(knitr.progress.linenums = TRUE). Thanks!

Sure, I guess you would like the default to be FALSE, right?

yihui commented 1 year ago

Right (getOption('knitr.progress.linenums', FALSE)).

zeehio commented 1 year ago

Hi :-)

options(knitr.progress.linenums = TRUE) is implemented and all conflicts due to NEWS entries have been resolved

Feel free to tell me if there is any other suggestion.

Thanks!