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/RtmpUWqX2P/file18807b74f146...
#> ℹ No schedule set, using Rmd files in episodes/ directory.
#> → Creating Lesson in /tmp/RtmpUWqX2P/file18807b74f146...
#> → To remove this message, define your schedule in config.yaml or use `set_episodes()` to generate it.
#> → Creating Lesson in /tmp/RtmpUWqX2P/file18807b74f146...
#> ────────────────────────────────────────────────────────────────────────
#> → Creating Lesson in /tmp/RtmpUWqX2P/file18807b74f146...
#> ℹ To save this configuration, use
#>
#> set_episodes(path = path, order = ep, write = TRUE)
#> → Creating Lesson in /tmp/RtmpUWqX2P/file18807b74f146...
#> ✔ First episode created in /tmp/RtmpUWqX2P/file18807b74f146/episodes/introduction.Rmd
#> → Creating Lesson in /tmp/RtmpUWqX2P/file18807b74f146...
#> ℹ Workflows up-to-date!
#> → Creating Lesson in /tmp/RtmpUWqX2P/file18807b74f146...
#> ℹ Consent to use package cache provided
#> → Creating Lesson in /tmp/RtmpUWqX2P/file18807b74f146...
#> - The project is out-of-sync -- use `renv::status()` for details.
#> → Searching for and installing available dependencies
#> The following packages were discovered:
#>
#> # ~/work/_temp/Library -------------------------------------------------------
#> - R6 2.5.1
#> - base64enc 0.1-3
#> - bslib 0.5.1
#> - cachem 1.0.8
#> - cli 3.6.1
#> - digest 0.6.33
#> - ellipsis 0.3.2
#> - evaluate 0.21
#> - fastmap 1.1.1
#> - fontawesome 0.5.2
#> - fs 1.6.3
#> - glue 1.6.2
#> - highr 0.10
#> - htmltools 0.5.6
#> - jquerylib 0.1.4
#> - jsonlite 1.8.7
#> - knitr 1.44
#> - lifecycle 1.0.3
#> - magrittr 2.0.3
#> - memoise 2.0.1
#> - mime 0.12
#> - rappdirs 0.3.3
#> - rlang 1.1.1
#> - rmarkdown 2.25
#> - sass 0.4.7
#> - stringi 1.7.12
#> - stringr 1.5.0
#> - tinytex 0.46
#> - vctrs 0.6.3
#> - xfun 0.40
#> - yaml 2.3.7
#>
#> They will be copied into the project library.
#>
#> - Copying packages into the project library ... Done!
#> - Hydrated 31 packages in 0.29 seconds.
#> - The project is out-of-sync -- use `renv::status()` for details.
#> → 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.5.1]
#> - cachem [* -> 1.0.8]
#> - cli [* -> 3.6.1]
#> - digest [* -> 0.6.33]
#> - ellipsis [* -> 0.3.2]
#> - evaluate [* -> 0.21]
#> - fastmap [* -> 1.1.1]
#> - fontawesome [* -> 0.5.2]
#> - fs [* -> 1.6.3]
#> - glue [* -> 1.6.2]
#> - highr [* -> 0.10]
#> - htmltools [* -> 0.5.6]
#> - jquerylib [* -> 0.1.4]
#> - jsonlite [* -> 1.8.7]
#> - knitr [* -> 1.44]
#> - lifecycle [* -> 1.0.3]
#> - magrittr [* -> 2.0.3]
#> - memoise [* -> 2.0.1]
#> - mime [* -> 0.12]
#> - rappdirs [* -> 0.3.3]
#> - renv [* -> 1.0.3]
#> - rlang [* -> 1.1.1]
#> - rmarkdown [* -> 2.25]
#> - sass [* -> 0.4.7]
#> - stringi [* -> 1.7.12]
#> - stringr [* -> 1.5.0]
#> - tinytex [* -> 0.46]
#> - vctrs [* -> 0.6.3]
#> - xfun [* -> 0.40]
#> - yaml [* -> 2.3.7]
#>
#> The version of R recorded in the lockfile will be updated:
#> - R [* -> 4.3.1]
#>
#> - Lockfile written to "/tmp/RtmpUWqX2P/file18807b74f146/renv/profiles/lesson-requirements/renv.lock".
#> ✔ Lesson successfully created in /tmp/RtmpUWqX2P/file18807b74f146
#> → Creating Lesson in /tmp/RtmpUWqX2P/file18807b74f146...
validate_lesson(lsn, headings = TRUE)
#> ── Validating Headings ─────────────────────────────────────────────────
#> ── Validating Fenced Divs ──────────────────────────────────────────────
#> ── Validating Internal Links and Images ────────────────────────────────