On my page I would like part of a string to be bold, however the string value is created from a Jekyll variable. Effectively, I want to pre-process the string with some function where the jekyll variable is the input.
In my main html file I have:
{% for post in site.posts %}
{% include archive.html %}
{% endfor %}
Inside archive.html I have:
<p> {{ post.var }} </p>
I'm assuming javascript is the way to go about this using a function along the lines of:
function makeSubStrBold(str) {
var substr = "something"
var strRegExp = new RegExp(substr, 'g');
return str.replace(strRegExp, '<b>'+substr+'</b>');
}
So if post.var = "this is something", what gets actually displayed in html is "this is <b> something </b>"
How could I use this javascript function to pre-process the string from the jekyll variable? Is this maybe possible in css?