Skip to content

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

Description

@zkamvar

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: <Anonymous> ... get_linestart -> get_pos -> gsub -> is.factor -> <Anonymous>
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:

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 (v2.0.1)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions