R/util_other.R

Defines functions fenced_div_depth

fenced_div_depth = function(x) {
  checkmate::assert_class(x, "rmd_fenced_div")

  if (length(x$content) == 0)
    return(1)

  max(purrr::map_int(
    x$content,
    function(y) {
      if (inherits(y, "rmd_fenced_div")) {
        fenced_div_depth(y)
      } else {
        0
      }
    }
  )) + 1
}

Try the parsermd package in your browser

Any scripts or data that you put into this service are public.

parsermd documentation built on Aug. 21, 2025, 5:27 p.m.