Custom font for source code in flexdashboard

The bslib type definition apparently doesn’t have any effect on the source code section in the flexdashboard. But except the source code section, this definition is working fine.

output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    source_code: embed
    theme:
      version: 4
      base_font: "Cambria"
      code_font: "Consolas"

Can you suggest a solution to alter the font for the source code section? Thank you.

I was using for tests a slightly modified example: ggplotly geoms.

The only real change I made was the YAML header:

---
title: "ggplotly geoms using custom fonts"
author: "(adapted from Carson Sievert)"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    # social: menu
    source_code: embed
    theme:
      version: 4
      base_font: "Cambria"
      code_font: "Cambria"
---

It is working on a windows machine as the Cambria (serif) font is included by default.

Note: a short code snippet was commented out starting with stuff <- ggplot_build(p) , but the next ggplotly(p) was kept.

On the other hand, after the bslib definitions are added to the YAML header, I am receiving a mysterious warning message, but the output was always created.

Output created: flexdashboard_ggplotly_custom.html
Warning message:
In file(con, "r") :
  file("") only supports open = "w+" and open = "w+b": using the former

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.