Skip to content

knitr syntax  #69

Open
Open
@rundel

Description

@rundel

I've been working on a parser for RMarkdown documents using Boost's Spirit X3 library. I'm currently using the Rmds available within this repo as a test set to make sure my code is working correctly.

In running my parser I've come across some potential typos and inconsistencies in syntax in the example documents and I wanted to clarify.

Mismatched backticks

Chunk begins with 3 backticks and ends with 4, it seems like knitr is not checking for balance between the backticks as long as there is >= 3. Oddly, for the document below RStudio gives me an unexpected token error via the linter but I don't see a similar error when creating my own test documents.

Chunks missing closing backticks

There are a couple of examples where there are two sequential chunks where the first is missing its closing backticks, but it is immediately followed by the start of a new chunk. The documents compile correctly but this seems wrong to me.

Chunks with engine and name separated by a comma

There are several documents where the chunk has a format that looks like

```{engine, name, opt=val}

my understanding is that the prefered format should be

```{engine name, opt=val}

is the former syntax allowable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions