Search code examples
rgithubknitrgithub-linguist

How one can make github linguist take *.Rnw files into account of repository language statistics?


I've got many repos containing files written with LaTeX and R with knitr so the filenames' extensions are "Rnw". Files with these extensions are not taken into account by github linguist. How can we fix that?

Tangling all the files to extract R code chunks into separate files and commit and push them is not the case, isn't it?

I've researched through linguist guidelines but haven't found the case.

I want them to be accounted as a mixture of TeX and R, if it is possible for linguist to parse the files, count bytes of R code in knitr chunks and bytes of TeX.


Solution

  • What you want to do is not currently possible with Linguist (v5.0.8). Linguist can only count a file towards the statistics of a single language.

    As a side note:

    • If you want to change the language detected, you can use Linguist overrides.
    • If your issue was with the highlighting of the source file, you could define a special grammar for .Rnw files, with support for both R and TeX.