0
Q:

RMarkdown bold figure caption text

# Assuming the document is being rendered as html, javascript can be run
# when the document is loaded that boldens the figure label. Simply add
# the following code block within the .Rmd file.

```{js, results='as.is', echo=FALSE}

$(document).ready(function(){
  $('p.caption').each(function(x){
    let cap = $(this).text();
    var re = new RegExp('Figure \\d\.\\d:', 'g');
    let figLabel = cap.match(re);
    $(this).html(cap.replace(re, '<b>'+ figLabel +'</b>'));
  });
});

```
0

New to Communities?

Join the community