Simple usage
Adding a fenced with with .fragment .highlightword
and the word
you need, plus what any valid CSS style
you want applied. The following div added to this slide
::: {.fragment .highlightword word="LinearRegression()" style="background:yellow;"}
:::
will highlight like so when slides are advanced:
from vetiver import VetiverModel
from vetiver.data import mtcars
from sklearn.linear_model import LinearRegression
model = LinearRegression().fit(mtcars.drop(columns= "mpg" ), mtcars["mpg" ])
v = VetiverModel(model, model_name = "cars_linear" ,
prototype_data = mtcars.drop(columns= "mpg" ))
v.description
Number argument
The first instance of the word will be matched by default. Set number
argument to change that
::: {.fragment .highlightword word="VetiverModel" number=2 style="background:yellow;"}
:::
to have the second instance highlighted
from vetiver import VetiverModel
from vetiver.data import mtcars
from sklearn.linear_model import LinearRegression
model = LinearRegression().fit(mtcars.drop(columns= "mpg" ), mtcars["mpg" ])
v = VetiverModel(model, model_name = "cars_linear" ,
prototype_data = mtcars.drop(columns= "mpg" ))
v.description
chunk argument
The first code chunk will be search by default.
::: {.fragment .highlightword word="VetiverModel" chunk=2 style="background:yellow;"}
:::
chunk 1: Set chunk
argument to change that.
from vetiver import VetiverModel
from vetiver.data import mtcars
from sklearn.linear_model import LinearRegression
chunk 2: notice that we didn’t set number=2
since this is the first instance of the word in this chunk.
model = LinearRegression().fit(mtcars.drop(columns= "mpg" ), mtcars["mpg" ])
v = VetiverModel(model, model_name = "cars_linear" ,
prototype_data = mtcars.drop(columns= "mpg" ))
v.description
fragments
This highlighting is still revealjs fragments , so can change the ordering as well
::: {.fragment .highlightword fragment-index=1 word="VetiverModel" number=2 style="background:yellow;"}
:::
::: {.fragment .highlightword fragment-index=1 word="v.description" number=1 style="background:pink;"}
:::
To make things out of order, or the same time
from vetiver import VetiverModel
from vetiver.data import mtcars
from sklearn.linear_model import LinearRegression
model = LinearRegression().fit(mtcars.drop(columns= "mpg" ), mtcars["mpg" ])
v = VetiverModel(model, model_name = "cars_linear" ,
prototype_data = mtcars.drop(columns= "mpg" ))
v.description