Skip to content
Open
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
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,21 @@ test-coverage:
opam exec -- dune build @test
yarn test --coverage

.PHONY: inject-docs
inject-docs:
node scripts/inject-docs.js

.PHONY: restore-docs
restore-docs:
node scripts/inject-docs.js --restore

.PHONY: docs
docs:
docs: inject-docs
opam exec -- dune build @doc
$(MAKE) restore-docs

.PHONY: docs-no-inject
docs-no-inject:
opam exec -- dune build @doc

.PHONY: docs-serve
Expand Down
26 changes: 25 additions & 1 deletion docs/Developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,31 @@ We welcome contributions, bug fixes, features requests (or implementations), doc

### Documentation

One way you can help is by improving the quality of documentation. We aim for consistency within our docs. For the best output, doc comments in code should look like:
One way you can help is by improving the quality of documentation. We aim for consistency within our docs.

#### Documentation Injection for Extension Modules

Relude uses a documentation injection system to work around an odoc limitation where documentation is lost when using `include` statements with module functors. The `scripts/inject-docs.js` script automatically:

- **Auto-discovers** documented functions from extension modules
- **Dynamically detects** which modules include these extensions
- **Temporarily injects** documentation comments during the build process
- **Preserves** original files with a backup/restore mechanism

This ensures that functions from extension modules (like `Relude_Extensions_Foldable`) have proper documentation in the generated HTML, even when included via functor application.

To test the documentation injection:
```sh
# Run the documentation injection test suite
> node scripts/test-inject-docs.js

# Build docs with injection (automatically runs during `make docs`)
> make docs
```

#### Documentation Style Guidelines

For the best output, doc comments in code should look like:

```reason
/**
Expand Down
Loading
Loading