ClaudioZandonella / trackdown

R package for collaborative writing and editing of R Markdown (or Sweave) documents in Google Docs.
https://ClaudioZandonella.github.io/trackdown/
GNU General Public License v3.0
214 stars 15 forks source link

[BUG] trackdown wrongly highlights text in between inline chunks that have a `$` in them #65

Open arnaudgallou opened 1 year ago

arnaudgallou commented 1 year ago

For example, in the following case:

```{r}
foo <- list(x = 1, y = 2)

Blah blah r foo$x blah blah r foo$y.


This is because trackdown interprets anything enclosed in a pair of non-escaped `$` as [inline equations](https://github.com/ClaudioZandonella/trackdown/blob/main/R/utils_rich_text.R#L134).

Also, because `\S` consumes a character, trackdown currently only detects inline equations that have at least 3 characters in them.

Considering the following text:

$x$ blah blah ($\sigma$)


trackdown will highlight `$x$ blah blah ($`

I won't have time to do it this week but I can make a pull request the week after to fix it if you want. I could also take the opportunity to simplify/improve some regex.