Skip to content

Commit

Permalink
add tests and update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Oct 11, 2024
1 parent 9037c21 commit 05f81d7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Suggests:
curl,
testthat,
xml2
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
Roxygen: list(markdown = TRUE)
Language: en-US
Encoding: UTF-8
3 changes: 2 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
1.9.3
1.9.4
- Apply upstream PR https://github.com/github/cmark-gfm/pull/362
- Require double-tilde `~~` for the strikethrough extension, for consistency with Pandoc's Markdown

1.9.1
- Update libcmark-gfm to 0.29.0.gfm.13
Expand Down
2 changes: 1 addition & 1 deletion R/extensions.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' Currently the following extensions are supported:
#'
#' - **table** support rendering of tables: [gfm-spec section 4.10](https://github.github.com/gfm/#tables-extension-)
#' - **strikethrough** via `~sometext~` syntax: [gfm-spec section 6.5](https://github.github.com/gfm/#strikethrough-extension-)
#' - **strikethrough** via `~~sometext~~` syntax: [gfm-spec section 6.5](https://github.github.com/gfm/#strikethrough-extension-)
#' - **autolink** automatically turn URLs into hyperlinks: [gfm-spec section 6.9](https://github.github.com/gfm/#autolinks-extension-)
#' - **tagfilter** blacklist html tags: `title` `textarea` `style` `xmp` `iframe`
#' `noembed` `noframes` `script` `plaintext`: [gfm-spec section 6.11](https://github.github.com/gfm/#disallowed-raw-html-extension-)
Expand Down
2 changes: 1 addition & 1 deletion man/extensions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions tests/testthat/test-extensions.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@ test_that("embedded images do not get filtered", {
expect_equal(md, markdown_html(md))
expect_equal(md, markdown_commonmark(md))
})

test_that("strikethrough", {
md <- "~Hello~ ~~world~~!"
expect_equal(markdown_html(md), "<p>~Hello~ ~~world~~!</p>\n")
expect_equal(markdown_html(md, extensions = "strikethrough"), "<p>~Hello~ <del>world</del>!</p>\n")
})

0 comments on commit 05f81d7

Please sign in to comment.