pkl icon indicating copy to clipboard operation
pkl copied to clipboard

How to generate stdlib documentation?

Open sin-ack opened this issue 2 months ago • 2 comments

I'm trying to use pkl-doc to generate documentation from a local branch I have of pkl, but when trying to point pkl-doc at stdlib/, I get:

 » pkl-doc/build/executable/pkldoc-linux-amd64 stdlib/*.pkl --output-dir stdlib-docs
–– Pkl Error ––
External members can only be defined by standard library modules.

175 | external function run(): BenchmarkResult
      ^^^^^^^^
at pkl.Benchmark#Microbenchmark (file:///home/agni/repos/third-party/pkl/stdlib/Benchmark.pkl, line 175)

How can I generate a local copy of the stdlib docs? DEVELOPMENT.adoc doesn't mention it either.

sin-ack avatar Oct 01 '25 15:10 sin-ack

You need to use the lower-level API to do this; i.e. call into org.pkl.doc.DocGenerator with the standard library as one of the packages arguments. You'd collect the schemas with the Pkl evaluator's evaluateSchema method, passing in each of the stdlib modules.

But: the stdlib documentation already exists here: https://pkl-lang.org/package-docs/pkl/current/index.html. Why are you looking to generate docs for the stdlib?

bioball avatar Oct 16 '25 23:10 bioball

The package-docs currently doesn't contain documentation built regularly from main, and we're currently internally using a branch on top of main (binary parser/renderer + some Pkldoc fixes) which makes Pkldoc output links to "0.30.0-dev". I wanted to include stdlib documentation in our internal docs site as well to make cross-links to stdlib types work.

sin-ack avatar Oct 18 '25 23:10 sin-ack