A validator based on the pegboard::Lesson class cached with this_lesson()
that will provide line reports for fenced divs, links, images, and heading
structure. For details on the type of validators avaliable, see the
pegboard article Validation of Lesson Elements
Arguments
- path
the path to the lesson. Defaults ot the current directory
- headings
If
TRUE
, headings will be checked and validated. Currently set toFALSE
as we are re-investigating some false positives.- quiet
if
TRUE
, no messages will be issued, otherwise progress messages will be issued for each test
Value
a list with the results for each test as described in pegboard::Lesson
Details
Headings
We expect the headings to be semantic and informative. Details of the tests
for headings can be found at pegboard::validate_headings()
Internal Links and Images
Internal links and images should exist and images should have alt text.
Details for these tests can be found at pegboard::validate_links()
Fenced Divs (callout blocks)
Callout Blocks should be one of the expected types. Details for this test
can be found at pegboard::validate_divs()
Examples
tmp <- tempfile()
lsn <- create_lesson(tmp, open = FALSE)
#> → Creating Lesson in /tmp/RtmpsPBux1/file1a883c4c133d...
#> ℹ No schedule set, using Rmd files in episodes/ directory.
#> → Creating Lesson in /tmp/RtmpsPBux1/file1a883c4c133d...
#> → To remove this message, define your schedule in config.yaml or use `set_episodes()` to generate it.
#> → Creating Lesson in /tmp/RtmpsPBux1/file1a883c4c133d...
#> ────────────────────────────────────────────────────────────────────────
#> → Creating Lesson in /tmp/RtmpsPBux1/file1a883c4c133d...
#> ℹ To save this configuration, use
#>
#> set_episodes(path = path, order = ep, write = TRUE)
#> → Creating Lesson in /tmp/RtmpsPBux1/file1a883c4c133d...
#> ✔ First episode created in /tmp/RtmpsPBux1/file1a883c4c133d/episodes/introduction.Rmd
#> → Creating Lesson in /tmp/RtmpsPBux1/file1a883c4c133d...
#> ℹ Workflows up-to-date!
#> → Creating Lesson in /tmp/RtmpsPBux1/file1a883c4c133d...
#> ℹ Consent to use package cache provided
#> → Creating Lesson in /tmp/RtmpsPBux1/file1a883c4c133d...
#> → Searching for and installing available dependencies
#> * Discovering package dependencies ... Done!
#> * Copying packages into the library ... Done!
#> → Recording changes in lockfile
#> The following package(s) will be updated in the lockfile:
#>
#> # RSPM ===============================
#> - R6 [* -> 2.5.1]
#> - base64enc [* -> 0.1-3]
#> - bslib [* -> 0.4.2]
#> - cachem [* -> 1.0.6]
#> - cli [* -> 3.6.0]
#> - digest [* -> 0.6.31]
#> - ellipsis [* -> 0.3.2]
#> - evaluate [* -> 0.20]
#> - fastmap [* -> 1.1.0]
#> - fs [* -> 1.6.0]
#> - glue [* -> 1.6.2]
#> - highr [* -> 0.10]
#> - htmltools [* -> 0.5.4]
#> - jquerylib [* -> 0.1.4]
#> - jsonlite [* -> 1.8.4]
#> - knitr [* -> 1.42]
#> - lifecycle [* -> 1.0.3]
#> - magrittr [* -> 2.0.3]
#> - memoise [* -> 2.0.1]
#> - mime [* -> 0.12]
#> - rappdirs [* -> 0.3.3]
#> - renv [* -> 0.16.0]
#> - rlang [* -> 1.0.6]
#> - rmarkdown [* -> 2.20]
#> - sass [* -> 0.4.5]
#> - stringi [* -> 1.7.12]
#> - stringr [* -> 1.5.0]
#> - tinytex [* -> 0.43]
#> - vctrs [* -> 0.5.2]
#> - xfun [* -> 0.36]
#> - yaml [* -> 2.3.7]
#>
#> The version of R recorded in the lockfile will be updated:
#> - R [*] -> [4.2.2]
#>
#> * Lockfile written to '/tmp/RtmpsPBux1/file1a883c4c133d/renv/profiles/lesson-requirements/renv.lock'.
#> ✔ Lesson successfully created in /tmp/RtmpsPBux1/file1a883c4c133d
#> → Creating Lesson in /tmp/RtmpsPBux1/file1a883c4c133d...
validate_lesson(lsn, headings = TRUE)
#> ── Validating Headings ─────────────────────────────────────────────────
#> ── Validating Fenced Divs ──────────────────────────────────────────────
#> ── Validating Internal Links and Images ────────────────────────────────