% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/markdown-style.R
\name{md_style}
\alias{md_style}
\title{Declarations for one markdown tag}
\usage{
md_style(...)
}
\arguments{
\item{...}{Named declarations.}
}
\value{
An object of class \code{gridmicrotex_md_style}.
}
\description{
A set of CSS declarations, for use as a named argument to
\code{\link{markdown_style}}. Argument names are the CSS property
names with underscores in place of hyphens, so \code{font_size} sets
\code{font-size}.
}
\details{
Lengths accept three forms: a bare number is \code{rem}, a multiple of
the body font size (\code{font_size = 2.5}); a string is whatever CSS
says it is (\code{"2.5em"}, \code{"12pt"}, \code{"150\%"}); and a
\code{\link[grid]{unit}} is absolute.

These are the supported properties, and where each one has an effect.
\emph{Inline} means it also works on a \code{<span>} and in
\code{\link{markdown_grob}}, which has no block layout; \emph{block}
means it needs \code{\link{markdown_box_grob}}.

\tabular{lll}{
\strong{property} \tab \strong{scope} \tab \strong{notes} \cr
\code{color} \tab inline + block \tab \cr
\code{font_size} \tab inline + block \tab \cr
\code{font_family} \tab inline + block \tab \cr
\code{font_weight} \tab inline + block \tab prose blocks only, see below \cr
\code{font_style} \tab inline + block \tab prose blocks only, see below \cr
\code{text_decoration} \tab inline + block \tab \code{underline},
\code{overline}, \code{line-through} \cr
\code{background} \tab inline + block \tab a fill behind the text \cr
\code{border} \tab inline \tab a frame; the inset is fixed \cr
\code{border_style} \tab inline \tab only \code{double} \cr
\code{border_radius} \tab inline \tab rounds the frame \cr
\code{box_shadow} \tab inline \tab \cr
\code{visibility} \tab inline \tab \code{hidden} keeps the space \cr
\code{vertical_align} \tab inline \tab \code{super}, \code{sub},
or a length \cr
\code{transform} \tab inline \tab \code{rotate()}, \code{scale()},
\code{scaleX(-1)} \cr
\code{line_height} \tab block \tab unitless, as \code{gpar()} wants it \cr
\code{margin_top}, \code{margin_bottom} \tab block \tab margins do not
collapse \cr
\code{margin_left}, \code{margin_right} \tab block \tab \cr
\code{padding_left}, \code{padding_right} \tab block \tab \cr
\code{padding_top}, \code{padding_bottom} \tab block \tab \cr
\code{margin}, \code{padding} \tab block \tab the CSS shorthand: one
to four lengths, in CSS's order \cr
\code{text_align} \tab block \tab \code{left}, \code{center},
\code{right} \cr
\code{border_left} \tab block \tab the \code{blockquote} bar \cr
\code{border_top} \tab block \tab the \code{hr} rule \cr
\code{border_bottom} \tab \code{tr} \tab a rule under each table row \cr
\code{border_color} \tab \code{table} \tab colour of the table's rules \cr
\code{table_layout} \tab \code{table} \tab \code{fixed} divides the
width between the columns so a wide table wraps \cr
\code{height} \tab block \tab the band an \code{hr} sits in \cr
\code{bullet} \tab \code{ul} \tab raw LaTeX for the marker glyph \cr
\code{marker_gap} \tab \code{ul}, \code{ol} \tab marker to text \cr
}

\code{font_size} also accepts CSS's keywords --- \code{xx-small} through
\code{xx-large}, plus \code{smaller} and \code{larger} --- taken from the
\code{\\tiny}..\code{\\Huge} ladder MicroTeX implements.

\strong{The \code{body} rule styles the box itself.} On any other tag,
\code{background}, \code{border}, \code{border_radius}, \code{padding}
and \code{margin} apply to that block. On \code{body} they apply to the
whole \code{\link{markdown_box_grob}} --- its fill, its frame, its
corner radius, and the space inside and outside it. That is the only
way to give a \code{\link{element_markdown}} title a background, since
the theme element takes no box arguments of its own:

\preformatted{body \{ background: grey95; padding: 8px;
        border: 1px solid grey60; border-radius: 4px \}}

An explicit \code{box_gp}, \code{padding}, \code{margin} or \code{r}
argument to \code{markdown_box_grob()} wins over the rule, the way an
inline style wins in CSS.

Anything else is an error --- unlike a pasted stylesheet, where an
unknown property is ignored the way a browser ignores it.

\strong{One limitation worth knowing.} \code{font_weight} and
\code{font_style} apply to blocks whose content is prose --- paragraphs,
headings, list items, block quotes, table cells and \code{<div>}s. They
do \emph{not} apply to \code{pre} or an image's alt text, which build
their own LaTeX and impose their own font handling. This is a MicroTeX
constraint rather than a choice: \code{\\text\{\}} resets the font
style, so emphasis has to be decided when the content is generated,
not wrapped around it afterwards.

\strong{What cannot be styled at all.} There is no small-caps
(\code{\\textsc} is not a MicroTeX command), no
\code{font-variant-numeric}, no right-to-left or bidirectional text,
and no padding inside an inline \code{border} --- MicroTeX has no
\code{\\fboxsep}, so that inset is fixed.
}
\examples{
md_style(color = "steelblue", font_size = 2.5, margin_top = 1.2)
}
\seealso{
\code{\link{markdown_style}}, \code{\link{markdown_box_grob}}
}
