Open krlmlr opened 4 years ago
I don't know. It could be a breaking change (even if we only mark the .md
file as read-only without inserting the comment). If we provide this feature, I think it needs to be an option for users to opt-in rather than opt-out.
I don't understand "mark as read-only". Are you suggesting to set the file status to read-only? I'd rather not do that.
The message in RStudio is triggered by the presence of the magic words "do not edit by hand" in the first line of the file. We can either:
.md
file starts with the first non-empty line in the .Rmd
, so that users can add the line themselvesRegarding the issue with github_document()
format introducing an empty line, I believe this is because of our custom template
https://github.com/rstudio/rmarkdown/blob/main/inst/rmarkdown/templates/github_document/resources/default.md
There is a lot of newlines introduced and even when everything is false in the template before the body there will be one empty line introduced https://github.com/rstudio/rmarkdown/blob/745c1477d02708938febb7065b85b552c7dc420f/inst/rmarkdown/templates/github_document/resources/default.md#L10-L12
This should probably be included in one of the if. In this case, adding
<!-- README.md is generated from README.Rmd. Please edit that file -->
as first line in the body, or as header-includes
---
output: github_document
header-includes: |
<!-- README.md is generated from README.Rmd. Please edit that file -->
---
would work.
Would it be better this way ?
emit a line of this form
Regarding this solution, are you suggestion for github_document()
only ? for all md_document()
? or for all output ?
So that they show as "read only" in RStudio and perhaps other editors.
Perhaps an option to the default document formats? Can this do any harm?
We can't include this in the
.Rmd
(yet), because the first generated line is empty: https://github.com/r-lib/pillar/blame/dfbb6f74823ab17b0a12fabdfb77ac377100d390/README.md#L1.By filing an issue to this repo, I promise that
xfun::session_info('rmarkdown')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('rstudio/rmarkdown')
.I understand that my issue may be closed if I don't fulfill my promises.