aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/rl-next/repl-doc-command.md
diff options
context:
space:
mode:
authorLunaphied <lunaphied@lunaphied.me>2024-03-17 18:01:05 -0600
committerLunaphied <lunaphied@lunaphied.me>2024-04-03 13:47:22 -0600
commit7a1054fa5f223126833718fc3f332579dba5f0f7 (patch)
tree790daae10628ec42436d79c943dcbcd8d7168fd6 /doc/manual/rl-next/repl-doc-command.md
parent56c7dfd65290dea957de6fad4e2df26f1630e407 (diff)
repl: improve `:doc` builtin repl command to support lambdas.
For a long time `nix repl` has supported displaying documentation set on builtins, however, it has long been convention to use Markdown comments on Nix functions themselves for documentation. This exposes that information to `nix repl` users in a nice and formatted way. NixOS/rfcs#145 doc-comments are primarily what this feature is intended to consume, however, support for lambda documentation in the repl is experimental. We do our best effort to support the RFC here. These changes are based on [the nix-doc library](https://github.com/lf-/nix-doc) and are licensed under the terms described in the relevant source files. Change-Id: Ic6fe947d39a22540705d890737e336c4720b0a22
Diffstat (limited to 'doc/manual/rl-next/repl-doc-command.md')
-rw-r--r--doc/manual/rl-next/repl-doc-command.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/manual/rl-next/repl-doc-command.md b/doc/manual/rl-next/repl-doc-command.md
new file mode 100644
index 000000000..84aaa0802
--- /dev/null
+++ b/doc/manual/rl-next/repl-doc-command.md
@@ -0,0 +1,13 @@
+---
+synopsis: Experimental REPL support for documentation comments using `:doc`
+cls: 564
+---
+
+Using `:doc` in the REPL now supports showing documentation comments when defined on a function.
+
+Previously this was only able to document builtins, however it now will show comments defined on a lambda as well.
+
+This support is experimental and relies on an embedded version of [nix-doc](https://github.com/lf-/nix-doc).
+
+The logic also supports limited Markdown formatting of doccomments and should easily support any [RFC 145](https://github.com/NixOS/rfcs/blob/master/rfcs/0145-doc-strings.md)
+compatible documentation comments in addition to simple commented documentation.