Skip to contents

Format and print milestone entries from the milestones database as text, HTML, markdown, or enhanced CLI output, including all associated information (authors, references, keywords, subjects, aspects, media).

Usage

print_milestone(
  ms,
  result = c("text", "html", "md", "markdown", "cli"),
  include = c("authors", "keywords", "subjects", "aspects", "media", "references"),
  show_images = TRUE
)

Arguments

ms

A data frame from the milestone() table (one or more rows), or a numeric vector of milestone IDs (mid) to look up

result

Output format: "text" for plain text (default), "html" for HTML formatted output, "md"/"markdown" for markdown format, or "cli" for enhanced console output with clickable links

include

Character vector specifying which sections to include. Options: "authors", "keywords", "subjects", "aspects", "media", "references". Default is all sections.

show_images

Logical; if TRUE, show image information in output. Default is TRUE. For text format, shows filenames only.

Value

For "text", "html", and "md" formats: a character vector with the formatted milestone entries (invisibly). For "cli" format: NULL (invisibly). The formatted entries are printed to the console in all cases.

Details

The function formats milestones following the structure of the datavis.ca/milestones website, including header information (date, authors, tag), description, and optional sections for keywords, subjects, aspects, media items, and references.

If multiple milestones are provided (either as multiple rows or multiple IDs), each milestone is printed separately with a blank line (or visual separator for CLI).

The "cli" format uses the cli package to provide enhanced console output with clickable hyperlinks, better visual structure, and improved formatting.

Examples

if (FALSE) { # \dontrun{
# Get milestones and print one
ms <- milestone()
print_milestone(ms[1, ])

# Print by milestone ID
print_milestone(53)

# Print multiple milestones
print_milestone(c(53, 54, 55))

# Print as HTML
print_milestone(53, result = "html")

# Print as markdown
print_milestone(53, result = "md")

# Print with enhanced CLI formatting (clickable links)
print_milestone(53, result = "cli")

# Print with only selected sections
print_milestone(53, include = c("authors", "references"))
} # }