highlightVariables function
Remove curly braces and underline variables in a code example
Implementation
String highlightVariables(String line, Ansi ansi) {
return line
.split("}}")
.map((s) {
final i = s.split("{{");
i.length > 1 ? i[1] = ansi.underline(i[1]) : null;
return i.join("{{");
})
.join("}}")
.replaceAll(RegExp("{{|}}"), "");
}