Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indentation_linter: fenced code blocks inside enumeration in RMarkdown document #1945

Closed
klmr opened this issue Apr 2, 2023 · 1 comment · Fixed by #1949
Closed

indentation_linter: fenced code blocks inside enumeration in RMarkdown document #1945

klmr opened this issue Apr 2, 2023 · 1 comment · Fixed by #1949

Comments

@klmr
Copy link
Contributor

klmr commented Apr 2, 2023

Consider the following RMarkdown document, which has fenced code inside an enumeration:

* An enumeration item with code:

  ```{r}
  "Hello"
  ```

‘lintr’ has the spurious complaint

mwe.rmd:4:2: style: [indentation_linter] Indentation should be 0 spaces but is 2 spaces.
  "Hello"
~^

When removing the indent (which works, but is unconventional) and knitting the document, ‘knitr’ reinserts the indent in the output Markdown document.

@AshesITR
Copy link
Collaborator

AshesITR commented Apr 3, 2023

This is somewhat related to #1043.
In general, we should make a more sane method of extracting R source from RMarkdown - in this case it could auto-detect the markdown indentation by seeing the whitespace in front of ```{r} and trim that accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants