Read rmarkdown format from metadata: rmd_format
diff --git a/R/util.R b/R/util.R
new file mode 100644
index 0000000..9c29ddb
--- /dev/null
+++ b/R/util.R
@@ -0,0 +1,20 @@
+#' Rmarkdown Format
+#'
+#' @description If the export format of the Rmarkdown document exist,
+#'
+#' @importFrom rmarkdown metadata
+#'
+#' @export
+
+rmd_format <- function(){
+ rmd_output_metadata <- metadata$output
+ rmd_fmt <- ifelse(
+ is.null(rmd_output_metadata),
+ "markdown", ifelse(
+ rmd_output_metadata %in% c("html_document", "rmarkdown::html_vignette"),
+ "html",ifelse(
+ rmd_output_metadata %in% c("pdf_document", "rmarkdown::tufte_handout"),
+ "latex", "markdown"
+ )))
+ return(rmd_fmt)
+}