Skip to content

Commit

Permalink
Add style vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Apr 29, 2024
1 parent affddce commit 3ae115f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.httr-oauth
.DS_Store
.quarto
inst/doc
5 changes: 4 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ Imports:
vctrs
Suggests:
ggplot2,
knitr,
patchwork,
rmarkdown,
rsvg
Remotes:
r-lib/systemfonts,
r-lib/textshaping#40
r-lib/textshaping
URL: https://github.com/thomasp85/marquee
BugReports: https://github.com/thomasp85/marquee/issues
VignetteBuilder: knitr
2 changes: 2 additions & 0 deletions vignettes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.html
*.R
29 changes: 29 additions & 0 deletions vignettes/marquee_style.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "Marquee Styling"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Marquee Styling}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```

```{r setup}
library(marquee)
```

As we discussed in the Marquee Syntax article, most of the syntax in markdown is semantic, meaining that it concerns itself with the nature of what it encodes, rather than the look of it. The other side of the coin, how it looks, will be dealt with in this article. Note that this division between semantics and style is also seen in HTML5 where the looks is fully relegated to CSS and the tags are all semantic.

## A slightly less cascading style

HTML has CSS to take care of styling for it, and that has over the years morphed into a sprawling and powerful language of it's own. Both too complicated to support for something like marquee, and too complicated to be needed for styling markdown (after all it's main goal is to style full webpages, not documents). Marquee instead defines it's own limited styling system which is simple enough to reason about, and powerful enough to support what is needed for markdown text. Many concepts are borrowed from CSS so if you are used to that you should feel pretty much at home.

### A style

In marquee, a style defines the full specification for how an element (block or span) should visually appear. It holds `r length(formals(style))` different settings concerning everything from font rendering, to spacing, coloring, and alignment. Rather than going through all here, I'll point towards the documentation for the `style()` function.

0 comments on commit 3ae115f

Please sign in to comment.