Example of syntax highlighting with Hugo
Using markdown to highlight code
The following code is a fragment of the communication between R and a Python library, using the reticulate
package. To have the code highlighted, the text must be surrounded by triple simple quotes “`” followed by the name of the language, “R” in this case. The example shows how the model for a series of first-order kinetic transformations can be described in the Antimony language used by the tellurium program:
#install.package("reticulate")
library(reticulate)
use_virtualenv("chem")
te <- import("tellurium", as="te", convert=T)
np <- import("numpy", as="np", convert=T)
temodel_string <- c("
model rnadeg1
$T -> PA1; kS*T
PA1 -> PA2; kA*PA1
PA1 -> ; kD*PA1
PA2 -> PA3; kA*PA2
PA2 -> ; kD*PA2
PA3 -> ; kD*PA3
T=100
PA1 = 0
PA2 = 0
PA3 = 0
kS = 0.5
kA = 0.1
kD = 0.5
end
")
rt <- te$loada(temodel_string)
# this is the tellurium model that we can manipulate
nbpoints <- as.integer(10)