I've set this gist up to illustrate an issue with Scribble docs.
In my package, I have the structure shown below. The actual files are also included in the gist below, but for the diagram I’ve stripped them down to their essential elements:
mole/main.rkt══════════════════════════╗
║ ║
║(require mole/func) ║
║ ║
║(provide (all-from-out mole/func)) ║
╚══════════════════════════════════════╝
▲
│
mole/func.rkt═══════════════════════════╗
║ ║
║ (require mole/private/text) ║
║ (provide ║
║ [contract-out (cloak (-> ...))]) ║
╚═══════════════════════════════════════╝
▲
│
mole/private/text.rkt═══════════════════╗
║ (provide cloak) ║
║ ║
║ (define (cloak ...)) ║
║ ║
╚═══════════════════════════════════════╝
The Scribble docs are set up this way:
mole.scrbl──────────────────────────────────────────┐
│ │
│ @defmodule[mole] │
│ │
│ @include-section["tutorial.scrbl"] │
│ @include-section["reference.scrbl"] │
│ │
└───────────────────────────────────────────────────┘
reference.scrbl─────────────────────────────────────┐
│ │
│ @(require [for/label mole]) │
│ │
│ @defmodule[mole/func] │
│ │
│ These bindings also provided by │
│ @racktetmodname[mole]. │
│ │
│ │
│ @defproc[(cloak ...)]{...} │
└───────────────────────────────────────────────────┘
- No warnings when built with
raco setup
- No warnings when built with
scribble +m ...
- (stretch goal)
cloak
is documented as being provided from bothmole
andmole/func
Running raco setup
works fine:
$ raco setup mole
[...]
raco setup: --- creating launchers --- [14:02:21]
raco setup: --- installing man pages --- [14:02:21]
raco setup: --- building documentation --- [14:02:21]
raco setup: running: <pkgs>/mole/scribblings/mole.scrbl
raco setup: rendering: <pkgs>/mole/scribblings/mole.scrbl
raco setup: --- installing collections --- [14:02:22]
raco setup: --- post-installing collections --- [14:02:22]
However, when rendering separately with scribble
there are warnings:
$ scribble +m -l mole/scribblings/mole.scrbl
[Output to mole.html]
Warning: some cross references may be broken due to undefined tags:
(dep ((lib "mole/main.rkt") cloak))
(dep ((lib "mole/main.rkt") uncloak))
Functions in reference.scrbl
are shown as being provided by mole/func
but not mole
:

Note
It looks like in order to get multiple module paths to show up in that tooltip, I might need to do something similar to
what the Racket Reference docs do
with make-collect-element
etc. I'm unable to find any documentation on the use of (collect-put! ci `(racket-extra-lib ,'lib) ...)
except some notes on the collect-info
struct that indicate it's not intended for public use.
The intent here is that private/
contains implementation modules without contracts, func
re-exports a subset of all functions in the package with contracts, and main
re-exports everything with contracts.
In actual packages where I have this issue, there is more than one module alongside func
in that middle layer. Ideally all of their functions would also appear in the docs as being provided from both the
Here are some things I've done that have had no effect.
; mole.scrbl
-@defmodule[mole]
+@defmodule[mole #:use-sources (mole/private/text)]
; reference.scrbl
-@defmodule[mole/func]
+@defmodule[mole/func #:use-sources (mole/private/text)]
I've also tried all permutations of including mole
and/or mole/func
alongside mole/private/text
in either
or both of these files. Sometimes the result is that scribble
no longer reports any warnings, but then raco setup
does report warnings.
For example, leaving the line in mole.scrbl
as defmodule[mole]
and changing reference.scrbl
:
; reference.scrbl
-@defmodule[mole/func]
+@defmodule[mole/func #:use-sources (mole/func mole/private/text)]
…results in no warnings from scribble +m …
but then warnings appear in raco setup
:
raco setup: running: <pkgs>/mole/scribblings/mole.scrbl
raco setup: WARNING: undefined tag in <pkgs>/mole/scribblings/mole.scrbl:
raco setup: (def ((lib "mole/main.rkt") cloak))
raco setup: (def ((lib "mole/main.rkt") uncloak))
From mflatt on Discord today:
Ah, my guess is that the difference is whether you refer to the documentation via
raco scribble
as a filesystem path or a collection-based path using-l
. When raco setup renders documentation, it refers to them via collection paths, and so relative paths like"../some-path-to-module.rkt"
are also collection-relative. But if you use a filesystem path to refer to the document, then the relative path is also a filesystem path, and so there's a disconnect with a collection-based module name used elsewhere.
However, I finbd that the result is the same whether I use scribble +m mole.scrbl
or
scribble +m -l mole/scribblings/mole.scrbl
.