From ae160d7e860b48f434997fda2d5e6a1e235407c6 Mon Sep 17 00:00:00 2001 From: atusy <30277794+atusy@users.noreply.github.com> Date: Mon, 26 Feb 2024 09:23:18 +0900 Subject: [PATCH] fix(ast): avoid error on HorizontalRule with a fallback and a warning fixes(#97) --- R/pandoc.R | 1 + inst/lua/horizontal-rule.lua | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 inst/lua/horizontal-rule.lua diff --git a/R/pandoc.R b/R/pandoc.R index 4ecdf4e..7479ddf 100644 --- a/R/pandoc.R +++ b/R/pandoc.R @@ -14,6 +14,7 @@ lua_filters <- function(.sep = "\n\n") { c( lua("smart.lua"), lua("inline-code.lua"), + lua("horizontal-rule.lua"), if (rmarkdown::pandoc_available("2.7.3")) { c( lua("math.lua"), diff --git a/inst/lua/horizontal-rule.lua b/inst/lua/horizontal-rule.lua new file mode 100644 index 0000000..e8c0a62 --- /dev/null +++ b/inst/lua/horizontal-rule.lua @@ -0,0 +1,7 @@ +function HorizontalRule(el) + warn( + "HorizontalRule is unsupported and fallbacks to three hyphens (---) " + .. "regardless of the input string (e.g., `-------`, `***`, and `_ _ _`)" + ) + return pandoc.Para({ pandoc.Str("---") }) +end