---
title: "Check your post"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{checks-guidance}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

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

Functions to be run on the path to your blog post (rendered, not the Rmd).

## Best practice

`ro_lint_md()` should identify some potential problems and enforce: 

* the use of (possibly empty) alternative descriptions for image;

* the use of Title Case for the title;

* the use of Sentence case for other headings;

* the absence of "click here" as text for links;

* the proper case (lowerCamelCase) for rOpenSci name;

* the use of Hugo shortcodes for figures;

* the use of relative links for links to rOpenSci website.

You need to run `render_one` on the path to the Markdown file. 
Some Markdown examples and the corresponding messages below.

---

```{r lint, results = "asis", echo = FALSE}
render_one <- function(path) {
  result <- as.character(suppressMessages(roblog::ro_lint_md(path)))
  glue::glue_collapse(
    c(
      details::details(path, lang = "Markdown", summary = path),
      "",
      result
    ),
    sep = "\n"
  )
}

glue::glue_collapse(
  purrr::map_chr(
    dir(system.file("examples", package = "roblog"), full.names = TRUE),
    render_one
  ),
  sep = "\n\n----\n\n"
)

```

## URL validity

`ro_check_urls()` will identify possibly broken URLs.


```{r urls}
path1 <- system.file(file.path("examples", "bad-no-alt.md"), package = "roblog")

roblog::ro_check_urls(path1)
```
