haddock
haddock copied to clipboard
Enable quickjump for local documentation
As I suggested here: https://github.com/haskell/cabal/pull/5236#issuecomment-376610195
We can get around xhr limitations by loading the data locally with a tag instead or the like, which lets us keep the benefits of the separate file approach while also allowing local usage. For hackage, producing a json file is still better though, so maybe we can have a flag that is toggled? Or maybe there's a single "best of both worlds" solution with a little cleverness... hmm...
@gbaz Isn't this fixed? I seem to be successfully generating and using local docs with quickjump.
If it isn't fixed, could you perhaps add some repro instructions?
@harpocrates The problem only occurs when using file://
URIs to view local documentation, since in that case it is not possible for the documentation page to access other resources with file://
URIs (since that would allow a webpage to read all your files). I guess you are using an HTTP server that is running on your machine?
Nope, I'm not running an HTTP server. Proof this works with file://
:

On closer inspection: this must be a recent Firefox feature, since Chrome still fails: "Failed to load file 'doc-index'...". If so, it is a welcome feature!
@harpocrates Okay, that's interesting. I've found the relevant page on MDN documenting the same-origin policy of Firefox for file URIs. It basically allows pages to access files in the same directory and subdirectories. This policy has been in place since Gecko 1.9, which has been released in Firefox 3.0 in 2008, hence this is not a recent Firefox feature. However, I guess that this policy is not mandated by web standards, therefore there is no reason to expect Chrome to adopt a similarly liberal policy in the future.
Somewhat related issue, I can't do "quickjump" locally even when I serve it with python3 -m http.server
. It's asking for a doc-index.json
file but I don't see it in the directory.
Somewhat related issue, I can't do "quickjump" locally even when I serve it with
python3 -m http.server
. It's asking for adoc-index.json
file but I don't see it in the directory.
In the haddock section of ~/.cabal/config you must set quickjump: True
. Probably the error message should have said so
That's extremely useful information! Why is that not the default?
Also haddock --quickjump
can be used!