Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellga committed Mar 5, 2024
1 parent 5e4e7f4 commit 13f843a
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 3 deletions.
1 change: 1 addition & 0 deletions .docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.quarto/
19 changes: 19 additions & 0 deletions .docs/_quarto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
project:
type: website

website:
title: ".docs"
navbar:
left:
- href: index.qmd
text: Home
- about.qmd

format:
html:
theme: cosmo
css: styles.css
toc: true



5 changes: 5 additions & 0 deletions .docs/about.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: "About"
---

About this site
37 changes: 37 additions & 0 deletions .docs/functions.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: Functions
---

## generate_docs

`generate_docs(files, folder_name = "docs", gh_url = "", run_examples = FALSE)` \

Generate a quarto website from lines starting with `###` or `///` that are right above function declarations. \
The website folder is created in the current working directory. \
The first line of the block is important, since the name of the variable will be used to group functions into the
same one-worded section. This is useful, for example, when working using an OOP approach. For now, to avoid any
bugs, it is important that all grouped functions are on the same file. \
The user is free to create its headings, line breaks and make use of all other markdown utilities. \
All R code identified by "```r" will be evaluated in a separate R session. If you don't want a certain part of the
code to be run, it will be needed to comment it or avoid the "```r" representation. If you don't want to evaluate
the code at all, use `run_examples = FALSE`, which is the default. \

#### Arguments

* `files` \
The files that will be used to create the `.qmd` documentation.
* `folder_name` \
Name of the folder which will store the website. \
* `gh_url` \
A github url indicating where the documented files will be stored. It will create a link to the source code for each
function. The default value will not create such links. \
* `run_examples` \
If `TRUE`, All R code identified in an r code block will be evaluated in a separate R session. If you don't want a certain part
of the code to be run, it will be needed to comment it or avoid the r code representation in markdown. \


#### Examples

```r
rdocs::generate_docs(files = "./rdocs/R/main.R", folder_name = "docs", gh_url = "https://github.com/daniellga/rdocs/tree/main/rdocs/R", run_examples = FALSE)
```
7 changes: 7 additions & 0 deletions .docs/index.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: ".docs"
---

This is a Quarto website.

To learn more about Quarto websites visit <https://quarto.org/docs/websites>.
1 change: 1 addition & 0 deletions .docs/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* css styles */
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rdocs"
version = "0.1.16"
version = "0.1.17"
edition = "2021"
repository = "https://github.com/daniellga/rdocs/"

Expand Down
2 changes: 1 addition & 1 deletion rdocs/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: rdocs
Title: Create Quarto documentation for R files from comments
Version: 0.1.16
Version: 0.1.17
Authors@R:
person("Daniel", "Gurgel", , "[email protected]", role = c("aut", "cre"))
Description: Generate R documentation in Quarto format based on comments in R scripts.
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ fn quarto_process(folder_name: &str, folder_name_hidden: &str) {
let _ = Command::new("quarto")
.args([
"render",
folder_name,
folder_name_hidden,
"--output-dir",
output_path.to_str().unwrap(),
])
Expand Down

0 comments on commit 13f843a

Please sign in to comment.