-
-
Notifications
You must be signed in to change notification settings - Fork 879
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
Inline code chunks are broken by linebreaks #655
Comments
should be fixed now; please test the current development version: https://github.com/yihui/knitr#readme |
Doesn't seem to work, see commit above in https://github.com/krlmlr/knitr-examples/tree/655-inline-linebreak |
Interesting. It works for me. |
Well, just tested with fresh code from your
Cleaned the cache up front, too... |
I see. That is an R script for spin(), not really an Rmd file. An Rmd file should be this:
|
example for inline expression spanning several lines (yihui/knitr#655)
It works for my source code, and example 107 -- but only if the \n does NOT fall exactly after the `r at the start of the inline code.
doesn't work. |
@aammd Now I remember why I disallowed line breaks in the past; that is because sometimes we may write a plain R code block
which is not supposed to be evaluated. In this case, allowing line breaks for inline expressions can be troublesome, because such a code block may be identified as an inline expression when you have a space after
Anyway, I think it should be reasonable to support line breaks inside an inline expression, but not in the beginning of an expression. @krlmlr I believe unit tests are more appropriate, instead of writing examples for each document format, because the examples are very short. |
Unfortunately, most automatic word wrappers don't know about this specialty, and would also wrap just after Also, what about |
Looking behind is certainly possible, but it will probably make R Markdown an exception in the parser, because I'll have to use Perl regular expressions. I do not have much brain power to think about this at the moment, for reasons that you know :) |
I'm still getting this error, apparently a couple years after the fix. |
@isomorphisms A minimal reproducible example please. This works for me:
|
Does not flag code chunks as inline when a line starts with three backticks
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
When a .Rmd file is written in a text editor that wraps lines at a ruler, sometimes a linebreak falls in the middle of an inline code chunk. This causes an error when the document is knit. Is it possible to modify knitr to ignore linebreaks in inline code chunks?
Also see http://stackoverflow.com/q/19819972/559676
The text was updated successfully, but these errors were encountered: