% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/markdown-style.R
\name{markdown_style}
\alias{markdown_style}
\title{A style for markdown rendering}
\usage{
markdown_style(base = NULL, css = NULL, ...)
}
\arguments{
\item{base}{\code{NULL} (default) for the built-in defaults, the name
of a bundled preset such as \code{"github"}, or an existing
\code{markdown_style} to extend.}

\item{css}{A stylesheet: CSS text, or a path to a \code{.css} file.
Read as a file when it names one.}

\item{...}{Named tag overrides, each an \code{\link{md_style}}. Use a
leading dot for a class, e.g. \code{.note = md_style(...)}.}
}
\value{
An object of class \code{gridmicrotex_markdown_style}.
}
\description{
Builds the style used by \code{\link{markdown_box_grob}} and
\code{\link{markdown_grob}}: a small CSS cascade over the markdown
tags. One constructor covers creating a style, starting from a preset,
and extending an existing one. For the properties themselves, and
which are honoured where, see \code{\link{md_style}}.
}
\details{
Tags are named as in HTML, so a stylesheet reads the way a CSS author
expects: \code{body} (the document root, which every other tag
inherits from --- and which also styles the box itself, see
\code{\link{md_style}}), \code{p}, \code{h1} ... \code{h6}, \code{ul},
\code{ol}, \code{li}, \code{blockquote}, \code{pre} (a code block),
\code{code} (an inline code span), \code{strong} and \code{em} (what
markdown's \code{**} and \code{*} produce), \code{table}, \code{tr},
\code{td}, \code{th}, \code{hr}, \code{img}, \code{a} (a link),
\code{math} (a paragraph that is nothing but \code{$$...$$}),
\code{footnote}, \code{div} and \code{span}.

The table tags nest as they do in HTML: \code{tr}, \code{td} and
\code{th} inherit through \code{table}, so \code{table \{ color: \}}
reaches the cells. \code{background} on \code{tr} fills the row, on
\code{td}/\code{th} the individual cell.

Four things can style a document, and they resolve in CSS's own order:
the built-in defaults, then a type selector (\code{h1}), then a class
selector (\code{.note}), then an inline \code{style} attribute. Ties
are broken by document order, so a later rule wins. Inheritable
properties (\code{color}, the \code{font-*} family,
\code{line-height}, \code{text-align}) fall through into nested
containers, so \code{blockquote \{ color: grey40 \}} greys everything
quoted; box properties (margins, padding, borders) do not.

The supported CSS is a deliberately small subset: type selectors,
class selectors and selector lists (\code{h1, h2}). Combinators,
pseudo-classes, attribute selectors, \code{#id} and at-rules are
skipped rather than raised, so an existing stylesheet can be handed
over and the parts that apply still take effect.
}
\examples{
markdown_style()
markdown_style("github", h1 = md_style(color = "firebrick"))
markdown_style(css = "h1 { color: steelblue } .note { padding-left: 2em }")
}
\seealso{
\code{\link{md_style}}, \code{\link{markdown_box_grob}}
}
