return_heading {accessrmd}R Documentation

Return a HTML p tag formatted to resemble a heading tag.

Description

Returns a HTML heading p tag formatted with inline css to appear like of any of the available levels (h1, h2, h3 and so on). This approach is in response to review comments regarding headings that contained no text potentially confusing screen reader users. The class selectors applied will always include "toc-ignore", but an additional selector may be included within the class parameter. If an object of length zero is passed to the txt parameter, NULL is returned, allowing for vectorised usage.

Usage

return_heading(txt, lvl, class, font_weights = c(h1 = 38, h2 = 30, h3 = 24))

Arguments

txt

The text to be used as the 'heading' text.

lvl

A number indicating the heading level. 1 == tags$h1() and so on.

class

A character string to use as the first class attribute. Do not include "toc-ignore", this will be added.

font_weights

A named character vector. Names are heading levels & numeric values to apply as font weight.

Value

null if txt is length 0 or p tag styled to appear as required heading level with class attr applied.


[Package accessrmd version 1.0.0 Index]