4.10 Venndir Markdown Support
By virtue of using marquee (Pedersen and Mitáš 2025), several labels in Venndir can be customized using markdown syntax, specifically following CommonMark.
The main features are:
- support for font styles (bold, italic, underline)
- forced new-lines by ending a line with two spaces, or adding
'\n'
- inline marquee styles
- inline images
- inline R graphics objects
Other styles are recognized by marquee, such as {.super }
and
{.sub }
.
For example, using venn_meme()
:
venndir::venn_meme(c(
"*italics*",
"_under_-\n_line_",
"in\n**bold**"))
venndir::venn_meme(jitter_color=0, jitter_cex=0,
c(
"This\nis{.sup super}",
"\n`This`\n`is`\n`code`",
"This\nis {.sub sub}"))


Figure 4.16: Venn Meme showing markdown formatted items (left), and inline styles (right).
4.10.1 Inline styles
The **marquee* R package supports inline styles, using this
syntax '{.style text}'
, where 'style' is the name of a
pre-defined style from marquee::style()
, and 'text'
is any valid text or markdown text, or even other inline styles.
Venndir defines marquee::classic_style()
for use by any labels,
which supports a large number of the most common HTML-like styles,
including:
base, body, ul, ol, li, hr, h1, h2, h3, h4, h5, h6, cb, p, qb, em, str, a, code, u, del, img, sub, sup, out
Argument 'marquee_styles'
for venndir()
accepts an optional list
with additional styles, which are added to the set of recognized styles.
The marquee style specification includes very many customizations:
font family, weight, width, size, color, lineheight, background, border,
padding, and many more. Any detailed customization not already provided
in Venndir should be attempted by creating a new marquee style, then
applying it as an inline style.
Creating a new style is straightforward, shown below. Each style inherits attributes of the existing style. For example, it continues using the same font family, size, and color until any attribute is modified. The examples below change the font family, force it to have normal weight/width (not bold), and enlarge by 1.5 relative to the existing font size.
ms <- list(
chalk=marquee::style(
family="Chalkduster",
weight="normal", width="normal",
size=marquee::relative(1.5)),
cursive=marquee::style(
family="Above The Sky",
weight="normal", width="normal",
size=marquee::relative(1.5)),
gothic=marquee::style(
family="AcademyEngravedLetPlain",
weight="normal", width="normal",
size=marquee::relative(1.5)))
# create labels
il <- split(LETTERS, rep(letters[1:3], c(10, 10, 6)))
names(il) <- c("{.chalk A-J}",
"{.gothic K-T}", "{.cursive U-Z}")
# apply inline markup around each set of labels
il[[1]] <- paste0("{.chalk ", il[[1]], "}")
il[[2]] <- paste0("{.gothic ", il[[2]], "}")
il[[3]] <- paste0("{.cursive ", il[[3]], "}")
# draw the rest of the owl
vm <- venn_meme(il, item_buffer=-0.05, marquee_styles=ms,
expand_fraction=0.02,
fontfamily="Chalkduster",
show_labels="Ni", draw_legend=TRUE,
legend_headers=c(Set="{.cursive Sets}", Size="{.chalk Sizes}"),
main="{.chalk Custom} {.gothic Text} {.cursive Styles}")

Figure 4.17: Example using inline styles to customize every conceivable field in Venndir: set name, main title, item labels, legend setlist, legend headers, legend count font.
Inline styles could be useful for other common operations:
- Slightly larger or smaller font size.
- Custom font family.
- Left- or right-aligned text.
- Custom font color.
- Color fill background, border, border radius.
4.10.2 Inline Images
Inline images can be added using markdown syntax, which looks like this:

The path/to/image
can be the path to a local file, a web URL address,
for example:

Further, inline R graphics can be added, in this form,
where Robject
is the name of an R graphical object,
such as a ggplot2
or grid
object.

Figure 4.18 shows a simple Venn diagram with
an image used in the center, using the Venndir transparent logo.
The function marquee::marquee_glue()
was used as a convenient
way to form the image tag. The example also shows how to change
the color of item labels, for example: '{.gold3 Venn}'
to make
the word 'Venn' dark-gold.
img <- system.file(package="venndir",
"images", "venndir-transparent.png")
imgtag <- marquee::marquee_glue("")
vm <- venn_meme(c("{.gold3 Venn}", "{.#6799AC dir}", imgtag),
item_cex_factor=c(1.5, 1.5, 7),
innerborder.lwd=1, outerborder.lwd=1,
poly_alpha=0.5,
set_colors=c("#EEDD79", "#87B9CC"))

Figure 4.18: Venn diagram with image provided as an item label.
Similarly, a ggplot2
or grid
graphical object can be
provided, and it will be displayed the same way as the image
in Figure 4.18.
Each image or plot is sized relative to the line height of the
corresponding text field. The example above used item_cex_factor
to scale the center item to 7 times higher than normal.
In order to enforce a specific size, either adjust the corresponding
font size with item_cex
and item_cex_factor
, or define
an inline style with specific font size, or specific line height.