diff --git a/NEWS.md b/NEWS.md index 96961d20b..33fda6962 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,14 @@ # sandpaper 0.11.18 (unreleased) +## BUG FIX + +* Callout block anchor links now point to the correct ID of the block derived + from the title of the block (as opposed to the generic ID). + (reported: @debpaul, + https://github.com/datacarpentry/OpenRefine-ecology-lesson/issues/292 and + @bencomp, #454; fixed: @zkamvar, #467) + + ## MISC * The internal function `sandpaper:::render_html()` now explicitly sets the diff --git a/R/utils-xml.R b/R/utils-xml.R index f8be4d5ce..b9a50072f 100644 --- a/R/utils-xml.R +++ b/R/utils-xml.R @@ -88,8 +88,22 @@ fix_callouts <- function(nodes = NULL) { h3 <- xml2::xml_find_all(callouts, "./div/h3") xml2::xml_set_attr(h3, "class", "callout-title") inner_div <- xml2::xml_parent(h3) + # remove the "section level3 callout-title" attrs xml2::xml_set_attr(inner_div, "class", "callout-inner") - add_anchors(h3, xml2::xml_attr(callouts, "id")) + # Get the heading IDS (because we use section headings, the IDs are anchored + # to the section div and not the heading element) + #
Here is an example of a callout block
+How do you write markdown divs?
+preeeee
+