CrossClj is a very cool project and I probably didn't look at it enough (yet) but there's a reason people publish Codox documentation and don't link to their respective CrossClj pages.
cljdoc's goal is to make it super easy for everyone publishing documentation for their Clojure/Script library (see rationale).
Since you seem to be the CrossClj author: is the code open source somewhere? Would be very curious to take a peek at your data model etc :)
Thanks for the reference, however the idea behind CrossClj is not "make people link to their CrossClj page".
In fact, CrossClj autonomously discovers published projects and makes use of all available data (mainly, the source code), to automatically publish documentation. The automation part is relevant: at the moment 9700+ clojure projects are indexed, and only a small fractions have published codox documentation; IMO requiring all these authors to explicitly take action is difficult, and hopefully not necessary. If no codox metadata is present in the source code, CrossClj still publish available metadata (eg. var doc strings), and even in the case no documentation is provided, CrossClj published both the outline of the documentation and the fully cross-referenced source code. For example, if you have an undocumented fn in a project, you can still look for all the usages of that fn in all the 9700+ projects, with link to usages in their source, sorted by project popularity. In the end, you can browse all 9700+ projects as a single code base, by jumping from an identifier to its definition (even if it's on another project), and by searching for all uses of each defined var.
FWIW, I personally welcome any effort in this area, such as cljdoc; CrossClj is also a no-profit, pro-bono effort; I am offering these comments on this thread simply because I think it's useful to be aware of the state of the art and discuss trade-offs when proposing alternatives. For this reason, CrossClj provides links to other documentation projects, for example in the pages of the vars of clojure/core, such as:
Regarding the source code: I have no real reason for not making it available, except that is a very old codebase (actually the first application I wrote in clojure), it's not "aesthetically pleasant" by my current standards, it would need some cleanup (eg. moving credentials data outside from the actual source code...). At the moment I have no bandwidth for this, but I would consider the effort if there is some interest.
I absolutely agree that having library authors take action here won't work. It needs to be fully automated and I will get there eventually.
Linking to usages from a function and similar stuff sounds great and is something I'd explore for cljdoc as well.
I appreciate you making me aware of the state of the art but with CrossClj being closed-source and there not being any clear path towards contributing there is very little I can do with that awareness :-) I strongly believe that a platform like this can only thrive if it is open source and contributions are welcome.
Please consider open-sourcing it or helping to build cljdoc. I would certainly appreciate your experience with storing this data, analyzing sources etc. If that's any less work I'd also be happy to receive a .zip with the code.
...which produces a very detailed AST http://clojure.github.io/tools.analyzer/spec/quickref.html where you can find, for each symbol in your source code, both the position in the source code itself, and the fully qualified reference (ie. var, local binding...)
with this information, you can choose a global "coordinate system" for your cross-referenced entities, eg. <group, project, version, namespace, var> and resolve the project-local qualified names into the full coordinates (eg. you look at project.clj to resolve the actually used libraries)
once you've done that you can a) decorate your source code, b) index the data (CrossClj uses Lucene which is very good also for fulltext search), c) use for whatever you want (ie. statistics, static analysis)
clj and cljs live in separated spaces, so it's enough to use the correct analyzer (based on the source file extension); I don't know the details about cljc because at the time (2013) it did not exist, but I think tools.reader support it; I think you will have to parse cljc files twice (one for each language)
When I say "parse" I actually mean read+eval (which is what tools.analyzer does). Eval includes macro expansion, which preserves metadata.
My analysis code is very rough, since at that time there were no documentation on the AST format for tools.analyzer! however you simply traverse the AST top-down and collect the metadata on the symbols
7
u/mklappstuhl May 24 '18
The idea is to expand beyond API docs and also include guides, examples and other stuff: see Reitit for a more complex scenario: https://cljdoc.xyz/d/metosin/reitit/0.1.1/doc/introduction/
Eventually, I would also like to package docsets for documentation browsers like Dash (https://kapeli.com/) & Zeal (https://zealdocs.org/).
CrossClj is a very cool project and I probably didn't look at it enough (yet) but there's a reason people publish Codox documentation and don't link to their respective CrossClj pages.
cljdoc's goal is to make it super easy for everyone publishing documentation for their Clojure/Script library (see rationale).
Since you seem to be the CrossClj author: is the code open source somewhere? Would be very curious to take a peek at your data model etc :)