deathau / cm-editor-syntax-highlight-obsidian

A plugin for [Obsidian](https://obsidian.md) which allows syntax highlighting for code blocks in the editor.
501 stars 38 forks source link

R highlight syntax not working when using {r} in Edit mode #75

Open AlfonsoRReyes opened 1 year ago

AlfonsoRReyes commented 1 year ago

First, congratulations and thanks for this great package. This is one of the first packages I install with any new vault I create.

I am using Obsidian to document code chunks, like a library of code that does something I require from time to time. I am using Editor Syntax Highlight in addition to another Obsidian extension Execute code, which enables Obsidian to run live code directly from the note.

There is just a little thing that is annoying and it is that syntax highlight doesn't work in Edit mode when the block has this form {r}.

Example this block will not render syntax highlighting in Edit mode:

```{r warning=FALSE}
library(factoextra)

pca <- prcomp(iris[,1:4], center = T, scale = T)

plot1 <- fviz_pca(pca, repel = T, labelsize = 3) +
    labs(title = "Biplot of iris data")

plot(plot1)

While this other block, will render nicely (please, see attached screenshot):

```r
library(factoextra)

pca <- prcomp(iris[,1:4], center = T, scale = T)

plot1 <- fviz_pca(pca, repel = T, labelsize = 3) +
    labs(title = "Biplot of iris data")

plot(plot1)

Is there any way to make code chunks of the form {r} work in Edit mode?

Thank you very much!

image

roey-angel commented 9 months ago

Yeah, this is really annoying. Have you found a workaround?