This is a Mastodon thread. The original thread is available here:
This thread explains the {quartodon} R π¦ (see https://quartodon.opens.science).
The #rstats quartodon π¦ allows you to post a Mastodon thread from a plain text file (e.g., a blog post from a Quarto, {blogdown}, or {distill} website, another Quarto or R Markdown file, or just a plain text file).
This effectively allows you to post blog posts to Mastodon in a thread of toots πβ‘οΈπͺβ‘οΈπππ
The {quartodon} package comes with an RStudio addin with two commands
π βExtract and preview all tootsβ
π βExtract and post all tootsβ
These take the currently active document, extract all toots, add thread counters, and do some preparation and checking (toot lengths, image sizes, and alt texts) ππ§
When previewing, the thread will be shown in the viewer with character counts and showing any errors πͺ
When posting, the thread will be posted to Mastodon π¬
The basic use of {quartodon} is very simple.
1οΈβ£ You set up your credentiasl with {rtoot} in an environment variable π
2οΈβ£ You structure your blog post as a thread of toots π§΅π
3οΈβ£ You preview the toot thread and double check everything β β
4οΈβ£ You post your thread, et voila π
The first post will be posted as βpublicβ π
The other posts will be replies to each other, and will be posted as βunlistedβ π
Some details about how it works (this describes the default settings, most are customizable):
π€ Basics π«
π The text is separated into toots by looking for lines containing only β-----
β (five dashes).
π The first fragment (before the first five dashes) is ignored, allowing you to add stuff to your post that wonβt be part of the toot thread.
π It automatically adds thread counters to the end of every toot, like this one π
π€ Images π«
π It checks whether images can be found, and I didnβt implement a check for URLs yet, so images have to be local for now.
π Image alt texts are checked for minimum lenght (currently, 10 characters)
π For now, only one image can be included (if multiple are included, only the first one is retained
π€ Cleaning π«
π All headings will be removed (all lines starting with #)
π All backticks will also be removed (since Markdown uses that to display code, but Mastodon doensβt).
π All strings of more than three consequtive newline characters will be replaced by two newline characters
π€ URLs π«
π {quartodon} replaces all URLs with their title, which means that hyperlinks where the title (the part between the square brackets in Markdown) isnβt the URL will just disappear in the toot.
π Note that relative URLs will not work from Mastodon; all URLs have to start with βhttps?://
β, because {quartodon} processes the raw .qmd
, .rmd
, or .md
file, before {Quarto}
(or {rmarkdown}
or {knitr}
) did any replacement work.
π€ Toot character counts π«
π When counting toot lengths, {quartodon} counts all URLs as 23 characters, conform the Mastodon defaults.
π When counting toot lengths, it also corrects usernames, stripping the instance information (i.e., the last @
and everything following it (see https://docs.joinmastodon.org/user/posting/).
You can find the {quartodon}
documentation at https://quartodon.opens.science
The vignette from which this Mastodon thread was extracted and posted is located at https://quartodon.opens.science/articles/quartodon_intro.html
If you would like to check out the GitLab repo with the source code, check https://gitlab.com/r-packages/quartodon
Finally, you can check out the Quarto blog post with the same information at https://gjyp.nl/posts/2023-01-converting-a-quarto-blog-post-to-a-mastodon-thread-and-posting-it.html
For now - have fun!
These are the basics. Of course, this is the first version of the package: who knows what we can add in the future? π
This package was fun to create, and will hopefully be useful. Hopefully many others can use this to let Quarto (or other) blog posts do double duty as threads of toots posted to Mastodon π
At the same time Iβm not sure how much time Iβll have to extend and maintain this, so if this seems like a fun project to you, please drop a line!