carpentries / carpentries/pegboard

Div fences immediately following lists (no newline) are swallowed by the list

Open
#84 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
R
Stars
6
Forks
5
PR merge metrics
No merged PRs in 30d

Description

I noticed that this div was causing a build to fail at the validation step with this diagnostic:

```
── Validating Fenced Divs ──────────────────────────────────────────────────────
Error: Error in .x[[1]] : subscript out of bounds
Calls: ... get_linestart -> get_pos -> gsub -> is.factor ->
Execution halted
```

It turns out that the closing fence for this div was being interpreted as part of the previous list item:

https://github.com/MCMaurer/Rewrite-R-ecology-lesson/blob/b23e42e4a876ce4aff65cf38ad98753f72719eba/episodes/01-visualizing-ggplot.Rmd#L401-L412

Here's a simplified use case:

``` r
tmp <- tempfile()
writeLines("text\n\n::: callout\n- list item\n - list item 2\n:::\n\n text", tmp)
ep <- pegboard::Episode$new(tmp)
ep$show()
#> text
#>
#> ::: callout
#>
#> - list item
#> - list item 2
#> :::
#>
#> text
ep$label_divs()$get_divs()
#> $`div-1-callout`
#> {xml_nodeset (0)}
```

Created on 2022-03-14 by the [reprex package](https://reprex.tidyverse.org) (v2.0.1)

Contributor guide

Open the contributing guide

Research direction

Start with the simplified reproduction using pegboard::Episode$new(), show(), label_divs(), and get_divs(). Trace how a div fence immediately following a list is parsed, using the linked lesson example as a reference. Done means the closing fence is not treated as part of the list and label_divs() recognizes the div.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.