Links in package.elm-lang.org to the source code of every function

Hi! I think it would be nice to see links in https://package.elm-lang.org/ from the documentation of every function to the source code of it. Long ago there was an issue about it and I’ve seen there was some work done in 2015 (https://github.com/elm/compiler/pull/1017) but it never got merged and everything has changed so much that it probably is not usable anymore.The thing is that I’m reading the code to see if it’s possible adding this info to the site. Not that I know a lot of Haskell, but I’m learning it and if it’s possible I’d like to see if I can do it. My problem is that I don’t know where does the info of the packages come from and where it is generated. Any hint or mentoring to do this would be very welcome.

7 Likes

As described in this old pull request, the info would not really be added to the site, but to the package documentation, which is then used by the package web site to render the package specific page.

Here are a few pointers:

If you want to explore this feature, you could try to add line numbers to the compiled package documentation in the compiler, patch the documentation decoding library to get them, then to test more easily, you could use for example a custom version of elm-doc-preview (which includes a forked version of the package.elm-lang.org frontend) to add links to source code per function/declaration (on GitHub). Finally, once this works, you could port the patch to package.elm-lang.org frontend.

So at the end, you would need at least 3 patches:

Good luck, you will most likely be on your own, as there is not much documentation except for the project-metadata-utils package. There is also no guaranty that it would be merged.

2 Likes

Thank you so much for all this info!! It’s just what I needed to begin with it.

At least, I think I’ll learn a lot from trying. I’ll see what I can do.

Thank you again,

David Gil

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.