diff --git a/DESCRIPTION b/DESCRIPTION index 01c9737..8a80935 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -21,6 +21,7 @@ License: MIT + file LICENSE URL: https://altdoc.etiennebacher.com, https://github.com/etiennebacher/altdoc BugReports: https://github.com/etiennebacher/altdoc/issues Imports: + brio, cli, desc, evaluate, diff --git a/R/import_readme.R b/R/import_readme.R index e6872d7..a57b2f9 100644 --- a/R/import_readme.R +++ b/R/import_readme.R @@ -26,13 +26,6 @@ "md" } - if (readme_type != "qmd" && tool == "quarto_website") { - cli::cli_abort( - "Quarto websites require a README.qmd file in the root of the package directory.", - call = NULL - ) - } - src_file <- fs::path_join( c(src_dir, grep(paste0("\\.", readme_type, "$"), readme_files, ignore.case = TRUE, value = TRUE)) ) @@ -67,14 +60,6 @@ "qmd" = { pre <- fs::path_join(c(src_dir, "altdoc/preamble_vignettes_qmd.yml")) pre <- tryCatch(.readlines(pre), warning = function(w) NULL, error = function(e) NULL) - # copy to quarto file - if (tool == "quarto_website") { - fs::file_copy( - src_file, - fs::path_join(c(tar_dir, "index.qmd")), - overwrite = TRUE - ) - } # process in-place for use on Github # TODO: preambles inserted in the README often break Quarto websites. It's # not a big problem to omit the preamble, but it would be good to @@ -87,16 +72,19 @@ } ) - if (tool == "quarto_website") { - tar_file <- fs::path_join(c(tar_dir, "index.md")) - } else { - tar_file <- fs::path_join(c(tar_dir, "README.md")) - } - + tar_file <- fs::path_join(c(tar_dir, "README.md")) src_file <- fs::path_join(c(src_dir, "README.md")) fs::file_copy(src_file, tar_file, overwrite = TRUE) .check_md_structure(tar_file) + # Add the index page which includes README.md + if (tool == "quarto_website") { + brio::write_lines( + "{{< include README.md >}}", + fs::path_join(c(tar_dir, "index.md")) + ) + } + tmp <- fs::path_join(c(src_dir, "README.markdown_strict_files")) if (fs::dir_exists(tmp)) { cli::cli_alert("We recommend using a `knitr` option to set the path of your images to `man/figures/README-`. This would ensure that images are properly stored and displayed on multiple platforms like CRAN, Github, and on your `altdoc` website.")