r-for-educators / flair

decorate your R code
https://r-for-educators.github.io/flair/index.html
Other
211 stars 21 forks source link

[FR]: Only add flair to code; don't flair in comments #26

Open francisbarton opened 4 years ago

francisbarton commented 4 years ago

In RMarkdown, flair by default decorates the pattern everywhere it is found within the chunk, including in inline comments. I'm wondering if this is intended behaviour, or if there could be an easy option to not decorate within comments.

I thought it could be done with a regex, but the only way I could think of was to start a regex with (?<!#.*) which of course doesn't work because a look-behind pattern match needs a bounded maximum length.

So then I was wondering if there was a way of filtering flair out at the level of CSS classes (ie .hljs-comment).

This is a seriously minor feature request but I thought I might as well suggest it in case you think it's a nice thing to add 🙏🏼