Preview the toots as they would be posted.
preview_toot_df.Rd
The function creates an HTML file with a preview of the toots that would
be posted if x
would be passed to post_thread_from_df()
instead.
Arguments
- x
A
toot_df
as produced by a call toprep_and_check_toot_df()
orappend_thread_counter()
; or the object produced by a call tosplit_to_toots()
, or thetoot_df
contained in such an object (in$df
).- select
Optionally, the number(s) of the toot(s) to select to preview.
- embed
Whether to only return the HTML code to be included in a
<body>
tag of an existing HTML file. Ifembed=TRUE
, nothing is shown in the viewer and no files are written.- filename
The file to write the HTML with the preview to.
- encoding
The encoding to use when writing the file.
Examples
### Get example post directory
examplePostDir <-
system.file("example-post",
package = "quartodon");
### Get an example text (see the intro vignette)
exampleText <-
readLines(
file.path(examplePostDir, "quartodon.Rmd"),
encoding = "UTF-8"
);
### Extract the toots
extractedToots <- quartodon::split_to_toots(
exampleText
);
### Append the thread counters
toot_df <- quartodon::append_thread_counter(
extractedToots
);
### Prepare and check the toots (for length, existing
### images, etc)
toot_df <- quartodon::prep_and_check_toot_df(
toot_df,
postsPath = examplePostDir
);
### Preview the thread in the viewer
previewFile <- quartodon::preview_toot_df(
toot_df
);