carpentries / workbench

Repository for Discussions and Materials about The Carpentries Workbench
https://carpentries.github.io/workbench/
Creative Commons Attribution 4.0 International
17 stars 7 forks source link

closing fences cannot exceed 80 characters #62

Open tobyhodges opened 1 year ago

tobyhodges commented 1 year ago

I tried to add a long closing fence to an Instructor Note block (following the recommendation we put into the Style guide) and found that pegboard raises an error when a closing fence is more than 80 colons in length. Here's the error output:

── Validating Fenced Divs ─────────────────────────────────────────────────────────────────────────────────────────────────────
✖ A section (div) tag mis-match was detected.
✖ There are not enough close tags (5) for the number of open tags (7).
<error/purrr_error_indexed>
Error in `purrr::map()`:
ℹ In index: 22.
ℹ With name: 22-reflecting.md.
Caused by error:
! Missing close section (div) tag in /Users/hodges/Documents/Carpentries/lesson-development-training/episodes/22-reflecting.md.
Here is a list of all the tags in the file:
/Users/hodges/Documents/Carpentries/lesson-development-training/episodes/22-reflecting.md:8 | tag: objectives
/Users/hodges/Documents/Carpentries/lesson-development-training/episodes/22-reflecting.md:15    | tag:   [close]
/Users/hodges/Documents/Carpentries/lesson-development-training/episodes/22-reflecting.md:17    | tag: questions
/Users/hodges/Documents/Carpentries/lesson-development-training/episodes/22-reflecting.md:21    | tag:   [close]
/Users/hodges/Documents/Carpentries/lesson-development-training/episodes/22-reflecting.md:32    | tag: challenge
/Users/hodges/Documents/Carpentries/lesson-development-training/episodes/22-reflecting.md:39    | tag:   [close]
/Users/hodges/Documents/Carpentries/lesson-development-training/episodes/22-reflecting.md:48    | tag: instructor
/Users/hodges/Documents/Carpentries/lesson-development-training/episodes/22-reflecting.md:61    | tag: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/Users/hodges/Documents/Carpentries/lesson-development-training/episodes/22-reflecting.md:63    | tag: discussion
/Users/hodges/Documents/Carpentries/lesson-development-training/episodes/22-reflecting.md:80    | tag:   [close]
/Users/hodges/Documents/Carpentries/lesson-development-training/episodes/22-reflecting.md:99    | tag: keypoints
/Users/hodges/Documents/Carpentries/lesson-development-training/episodes/22-reflecting.md:104   | tag:   [close]
---
Backtrace:
     ▆
  1. └─httpuv (local) `<fn>`(`<externalptr>`, FALSE, "{\"pathname\":\"/\"}")
  2.   ├─base::try(handler(binary, message))
  3.   │ └─base::tryCatch(...)
  4.   │   └─base (local) tryCatchList(expr, classes, parentenv, handlers)
  5.   │     └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
  6.   │       └─base (local) doTryCatch(return(expr), name, parentenv, handler)
  7.   └─servr (local) handler(binary, message)
  8.     ├─ws$send(...)
  9.     ├─base::tryCatch(...)
 10.     │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
 11.     │   └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
 12.     │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
 13.     ├─jsonlite::toJSON(...)
 14.     │ └─base::force(x)
 15.     └─servr (local) build(fromJSON(message))
 16.       └─sandpaper (local) handler(c(f3, na.omit(f5)))
 17.         └─sandpaper::build_lesson(f, preview = FALSE, quiet = quiet)
 18.           └─sandpaper::validate_lesson(path, quiet = quiet)
 19.             └─lesson$validate_divs()
 20.               └─purrr::map(...)
 21.                 └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
 22.                   ├─purrr:::with_indexed_errors(...)
 23.                   │ └─base::withCallingHandlers(...)
 24.                   ├─purrr:::call_with_cleanup(...)
 25.                   └─pegboard (local) .f(.x[[i]], ...)
 26.                     └─x$validate_divs(warn = FALSE)
 27.                       └─pegboard:::validate_divs(self)
 28.                         └─pegboard:::make_div_table(yrn)
 29.                           └─yrn$label_divs()
 30.                             └─pegboard:::label_div_tags(self)
 31.                               └─pegboard:::make_div_pairs(nodes, path = path, yaml = yaml)
 32.                                 └─pegboard:::raise_div_error(res, path, yaml, type = labels$message)
 33.                                   └─base::stop(msg, call. = FALSE)

Here's the output of sessionInfo():

R version 4.3.0 (2023-04-21)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.3.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/Berlin
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] utf8_1.2.3        generics_0.1.3    xml2_1.3.4        tinkr_0.2.0       digest_0.6.31     magrittr_2.0.3   
 [7] evaluate_0.21     fastmap_1.1.1     jsonlite_1.8.4    rprojroot_2.0.3   processx_3.8.1    whisker_0.4.1    
[13] promises_1.2.0.1  ps_1.7.5          purrr_1.0.1       fansi_1.0.4       cli_3.6.1         crayon_1.5.2     
[19] rlang_1.1.1       commonmark_1.9.0  withr_2.5.0       xslt_1.4.4        cachem_1.0.8      yaml_2.3.7       
[25] tools_4.3.0       sandpaper_0.11.17 memoise_2.0.1     dplyr_1.1.2       httpuv_1.6.11     credentials_1.3.2
[31] assertthat_0.2.1  mime_0.12         vctrs_0.6.2       R6_2.5.1          lifecycle_1.0.3   fs_1.6.2         
[37] varnish_0.2.16    pkgconfig_2.0.3   desc_1.4.2        callr_3.7.3       later_1.3.1       pkgdown_2.0.7    
[43] pillar_1.9.0      glue_1.6.2        Rcpp_1.0.10       servr_0.27        gert_1.9.2        xfun_0.39        
[49] tibble_3.2.1      tidyselect_1.2.0  rstudioapi_0.14   sys_3.4.1         knitr_1.42        htmltools_0.5.5  
[55] rmarkdown_2.21    pegboard_0.5.2    compiler_4.3.0    downlit_0.4.2     askpass_1.1       openssl_2.0.6   
zkamvar commented 1 year ago

Oh ho! It turns out that, no matter how much I advocate for not placing arbitrary regulations on what the author can write, I have ended up placing arbitrary regulations on the number of colons for the closing div tags 😮‍💨.

I've opened https://github.com/carpentries/pegboard/issues/128 to track the issue and I will discuss the solution with @carpentries/workbench-maintainers

zkamvar commented 1 year ago

I've also opened https://github.com/carpentries/sandpaper-docs/pull/147 to clarify the wording in the style guide.