It is traditional, when tinkering with a new blogging tool that you just made and will almost certainly abandon within a week, to write a “hello world” style post that serves as a quick check that the tool is working. This tradition almost certainly developed because nobody bothers to write unit tests for code that isn’t supposed to be used in the wild. This blog is no exception.
Unnumbered lists, with nesting.
Numbered lists, also with nesting.
Markdown syntax for italics is supported, as is boldface, and strikethrough.
State | Code | Capital | Population |
---|---|---|---|
New South Wales | NSW | Sydney | 8,484,357 |
Victoria | VIC | Melbourne | 6,981,352 |
Queensland | QLD | Brisbane | 5,586,322 |
Western Australia | WA | Perth | 2,965,159 |
South Australia | SA | Adelaide | 1,878,029 |
Tasmania | TAS | Hobart | 575,366 |
Code blocks without syntax highlighting:
var printText = $('.text').data('text');
var contentArray = printText.split('/n');
Code blocks with language specified for highlighting:
var printText = $('.text').data('text');
var contentArray = printText.split('/n');
$.each(contentArray, function(index, newLine) {
$('.text').append('<span style="display:block;" id="'+index+'"></span>');
var lineID = index;
var self = $(this);
setTimeout(function () {
$.each(self, function(index, chunk){
setTimeout(function () {
$('#'+lineID).append("<span>"+chunk+"</span>");
$('body, html').scrollTop($(document).height());
}, index*5);
});
}, index*100);
});
Block quotes:
And in her mind saw again the line of desert hills beyond the stone balustrade of the hotel room balcony, and the faint crease of dawn-light above, suddenly swamped by the stuttering pulses of silent fire from beyond the horizon. She had watched – dazed and dazzled and wondering – as that distant eruption of annihilation had lit up the face of her lover
It has traditionally1 been considered a necessity that any blog worthy of the name be overrun by a hedonistic number of footnotes that the author2 uses to go on pointless tangents, and it is therefore important that this blog support this worthy activity. Margin comments are supported (on the left and the right). You can float quotes (or whatever) to the left or the right
A thing on the right, why not? It can be anything, though I doubt the full text of Moby Dick would be a good choice
I am a blockquote that has been floated to the right of the page. The author was so preoccupied with whether or not she could, she didn’t stop to think if she should.
I … cannot think of anything except evil3 applications.
Oh well.
Such a shame.
Moving on.
Inline equations work for simple expressions like \(x^2\), but it’s better to switch to display mode for more complex expressions. If I wanted to illustrate that a Maclaurin series expansion is a Taylor series expansion of \(f(x)\) around \(x = 0\), I’d do this:
$$ f(0) + \frac{f^\prime(0)}{1!} x + \frac{f^{\prime\prime}(0)}{2!} x^2 + \frac{f^{\prime\prime\prime}(0)}{3!} x^3 + \ldots $$
(12 ^ 2) / 3.14
#> [1] 45.85987
library(stringr)
library(ggplot2)
library(tibble)
library(dplyr)
msg <- "hello cruel world"
msg |>
str_to_upper() |>
str_view("WORLD")
#> [1] │ HELLO CRUEL <WORLD>
The litedown package defaults to xfun::record_print()
for printing data frames and tibbles, which in turn uses xfun::md_table()
to render the object as a markdown table. That produces results like this:
starwars |>
select(name:homeworld, species) |>
filter(species == "Human")
name | height | mass | hair_color | skin_color | eye_color | birth_year | sex | gender | homeworld | species |
---|---|---|---|---|---|---|---|---|---|---|
Luke Skywalker | 172 | 77.0 | blond | fair | blue | 19.0 | male | masculine | Tatooine | Human |
Darth Vader | 202 | 136.0 | none | white | yellow | 41.9 | male | masculine | Tatooine | Human |
Leia Organa | 150 | 49.0 | brown | light | brown | 19.0 | female | feminine | Alderaan | Human |
Owen Lars | 178 | 120.0 | brown, grey | light | blue | 52.0 | male | masculine | Tatooine | Human |
Beru Whitesun Lars | 165 | 75.0 | brown | light | blue | 47.0 | female | feminine | Tatooine | Human |
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
Raymus Antilles | 188 | 79.0 | brown | light | brown | male | masculine | Alderaan | Human | |
Finn | black | dark | dark | male | masculine | Human | ||||
Rey | brown | light | hazel | female | feminine | Human | ||||
Poe Dameron | brown | light | brown | male | masculine | Human | ||||
Captain Phasma | none | none | unknown | female | feminine | Human |
You can specify your own print options to change this behaviour, or you can just call print()
explicitly:
starwars |>
select(name:homeworld, species) |>
filter(species == "Human") |>
print()
#> # A tibble: 35 × 11
#> name height mass hair_color skin_color eye_color birth_year sex gender
#> <chr> <int> <dbl> <chr> <chr> <chr> <dbl> <chr> <chr>
#> 1 Luke Sk… 172 77 blond fair blue 19 male mascu…
#> 2 Darth V… 202 136 none white yellow 41.9 male mascu…
#> 3 Leia Or… 150 49 brown light brown 19 fema… femin…
#> 4 Owen La… 178 120 brown, gr… light blue 52 male mascu…
#> 5 Beru Wh… 165 75 brown light blue 47 fema… femin…
#> 6 Biggs D… 183 84 black light brown 24 male mascu…
#> 7 Obi-Wan… 182 77 auburn, w… fair blue-gray 57 male mascu…
#> 8 Anakin … 188 84 blond fair blue 41.9 male mascu…
#> 9 Wilhuff… 180 NA auburn, g… fair blue 64 male mascu…
#> 10 Han Solo 180 80 brown fair brown 29 male mascu…
#> # ℹ 25 more rows
#> # ℹ 2 more variables: homeworld <chr>, species <chr>