Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
- Added `prqlc debug json-schema` command to auto-generate JSON Schema
representations of commonly exposed IR types such as PL and RQ. (@kgutwin,
#4698)
- Add documentation comments to the output of the documentation generator.
(@vanillajonathan, #4729)

**Fixes**:

Expand Down
14 changes: 8 additions & 6 deletions prqlc/prqlc/src/cli/docs_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ use prqlc::pr::{ExprKind, Stmt, StmtKind, TyKind, VarDefKind};
// var_def.name, var_def.name
// ));

// //if let Some(docComment) = vardef.DocComment {
// // docs.push_str(&format!(" <p>{docComment}</p>\n"));
// //}
// if let Some(doc_comment) = stmt.doc_comment {
// docs.push_str(&format!(" <p>{doc_comment}</p>\n"));
// }

// if let Some(expr) = &var_def.value {
// match &expr.kind {
Expand Down Expand Up @@ -261,9 +261,9 @@ Generated with [prqlc](https://prql-lang.org/) {}.

docs.push_str(&format!("### {}\n", var_def.name));

//if let Some(docComment) = vardef.DocComment {
// docs.push_str(&format!("{docComment}\n"));
//}
if let Some(doc_comment) = stmt.doc_comment {
docs.push_str(&format!("{}\n", doc_comment.trim_start()));
}
docs.push('\n');

if let Some(expr) = &var_def.value {
Expand Down Expand Up @@ -319,6 +319,7 @@ mod tests {
#[test]
fn generate_markdown_docs() {
let input = r"
#! This is the x function.
let x = arg1 arg2 -> c
let fn_returns_array = -> <array> array
let fn_returns_bool = -> <bool> true
Expand Down Expand Up @@ -354,6 +355,7 @@ mod tests {
* foo

### x
This is the x function.

#### Parameters
* *arg1*
Expand Down