cljdoc

olttwa 2022-10-31T06:38:09.294909Z

Cljdoc orders functions within a namespace alphabetically. Can this be overridden to be in order of the file? Jumbled API-docs are difficult to make sense of IMO I went through the for-library-authors but couldn't find a workaround for this. Can someone help?

lread 2022-10-31T13:52:56.887769Z

Hiya @akshat.iitj! There is no support for this yet, but there is an old open https://github.com/cljdoc/cljdoc/issues/89. If we were to add this feature, at this point, since we've been sorting alphabetically for so long, we'd still default to that, but could allow to switch to sorting by line number through some ui control. Is that what you were hoping for?

olttwa 2022-10-31T14:45:49.744539Z

Hey @lee Thanks for responding. I'm looking for 2 things, 1st is must have, 2nd is nice to have. 1. Sort functions by line number within a namespace 2. Define an ordering for namespaces in the side-column

olttwa 2022-10-31T14:45:51.959389Z

> allow to switch to sorting by line number through some ui control This config should be baked into code & not in the hands of the users. Reason being, custom ordering helps authors provide a coherent story-line for their users.

lread 2022-10-31T16:00:21.146419Z

@akshat.iitj thanks for taking the time to elaborate! Note: there are no "must haves" in open source simple_smile Cljdoc has been sorting vars alphabetically for some years now. We should take into account that some people might prefer that, regardless of a library author's preference. I think you are suggesting that sorting vars by line number is very important to some library authors and should be the configurable default for a library, perhaps in cljdoc.edn. Custom sorting of namespaces, to my knowledge, has not come up yet as a feature request. If enough folks really want this, we could maybe consider it, but let's focus on var/fn sorting for now.

olttwa 2022-10-31T20:45:19.048659Z

> there are no "must haves" in open source Ofcourse. By must/nice haves I was communication my need/priority of requirements. Sorry for the incorrect wording > We should take into account that some people might prefer alphabetical sorting I see cljdoc as a wiki/presentation, (ofc the source code should also be presentable). In a presentation, I feel ordering should be left to presenter. > let's focus on var/fn sorting for now We have a difference of opinion on who does sorting? How do we go about resolving that?

lread 2022-11-01T01:44:18.672489Z

The way I see it, users might become confused if one library has vars sorted one way and another library has vars sorted a different way. The inconsistency would confuse me, for example. A user might not also agree with the library author's sorting choice. Even if that library author has very strong opinions on the matter. 😉 > ofc the source code should also be presentable I'm not sure what you mean here. Are you suggesting cljdoc should also present the library's source code?

olttwa 2022-11-01T05:26:01.302099Z

> users might become confused if one library has vars sorted one way and another library has vars sorted a different way Alrighty then. Sorting from UI based on user preference it is > ofc the source code should also be presentable Can be ignored. I was meaning to say a clean code file leads to a clean documentation

olttwa 2022-11-02T07:03:17.291959Z

@lee how do we take this forward?

lread 2022-11-02T13:07:14.562879Z

I've gone as far as updating the https://github.com/cljdoc/cljdoc/issues/89.

olttwa 2022-11-02T13:08:59.210379Z

Would cljdoc need cookies consent to retain user preference globally?

lread 2022-11-02T13:17:08.314289Z

If I remember correctly we are using local storage to remember recently visited libs. And... indexed db... to support client-side docset searching. So we'd probably use local storage or cookies.

olttwa 2022-11-02T13:17:59.897009Z

I was never asked for a cookie consent, so asked if our design would change UX. Seems like it won't

lread 2022-11-02T13:19:03.015489Z

Oh. Maybe that's an advantage of using local storage instead of cookies?

lread 2022-11-02T13:22:41.672539Z

Also feel free to chime in on the issue if you have ideas or see any issues with my initial proposal.

1
lread 2022-11-02T13:26:15.862109Z

We'll also have to figure out how to elegantly add the UI control to change this sort option.

olttwa 2022-11-02T13:26:50.359269Z

Is there a UI-person in the maintainers of cljdoc we can ask?

lread 2022-11-02T13:34:38.941199Z

I'm OK at this kind of stuff, but always appreciate the feedback/opinions of @corasaurus-hex. She just started a new job, so might not be available.

👍 1
lread 2022-11-02T13:35:36.246789Z

If there are any other UI-smart cljdoc developers lurking, please feel free to chime in.

lread 2022-11-02T13:40:24.110429Z

Initial thought: I think the control should be near the vars it is affecting. I feel it should be subtle but also not hard to discover.

Cora (she/her) 2022-11-02T13:45:17.596209Z

could someone sell me on this? I'm trying to imagine the value and finding it wanting.

Cora (she/her) 2022-11-02T13:46:25.305929Z

are people really going to the var listing for a story? wouldn't that be better served by a document where you can elaborate more fully, provide context, and fully control formatting and order?

Cora (she/her) 2022-11-02T13:47:25.490879Z

I only have my own context for what I want out of a var listing: predictability so that I can find things. I use search if I'm not quite sure

Cora (she/her) 2022-11-02T13:47:37.994289Z

so there's likely something I'm missing

Cora (she/her) 2022-11-02T13:48:49.280459Z

I'd be super down for it if it was an unambiguous win but it sounds to me, personally, like complication we need to maintain for not much benefit

lread 2022-11-02T13:49:07.796339Z

I'll let @akshat.iitj elaborate, but it is my understanding that some lib authors will order the vars in such a way to tell the story of how to use their lib. It seems @martinklepsch felt this was interesting too as he raised the initial issue.

lread 2022-11-02T13:49:40.668149Z

Personally, I do the story telling in the docs.

Cora (she/her) 2022-11-02T13:49:55.287079Z

yeah, it seems a better fit for prose

lread 2022-11-02T13:51:27.935109Z

But... maybe certain APIs would be better served by line sort order. Especially when the API is always used in a certain order.

Cora (she/her) 2022-11-02T13:51:59.974069Z

would there be a way to make this minimally disruptive to the codebase?

Cora (she/her) 2022-11-02T13:52:42.506009Z

maybe set the preference in a cookie and use that? would it need to be by project? cookies have a max size.

olttwa 2022-11-02T13:52:45.438549Z

I view the detailed namespace page as a story-teller in text & params, without the code. So, just like how a source-code file tell a story as you read it from top-to-bottom, I expect cljdoc to narrate the story in same order. Take an example of dead-jobs namespace of Goose. As an author, I would rather have size -> find -> replay -> delete.

Cora (she/her) 2022-11-02T13:53:19.518029Z

I usually read clojure files in reverse order

Cora (she/her) 2022-11-02T13:53:49.545459Z

usually the stuff at the top is more helper-y, functions that support stuff later in the file, I've found

olttwa 2022-11-02T13:53:53.029349Z

Going back to first principles, I'd like to understand why alphabetical ordering was chosen over order by line-number?

Cora (she/her) 2022-11-02T13:54:10.967389Z

because in a user interface that is predictable

Cora (she/her) 2022-11-02T13:54:19.810049Z

there was no search then

Cora (she/her) 2022-11-02T13:55:19.028579Z

moreover is follows other api docs in this regard, and making ui predictable by following common patterns helps users, especially ones dealing with accessibility issues

olttwa 2022-11-02T13:55:24.806459Z

> I usually read clojure files in reverse order So if cljdocs are ordered alphabetically, this convenience will disappear. Hence, my requirement for sort by line number

lread 2022-11-02T13:55:27.689019Z

And it is also the defacto for doc tools, codox, autodoc, quickdoc.,

Cora (she/her) 2022-11-02T13:57:04.395869Z

also I want to be totally clear here, I am completely unheated in this conversation and not trying to just shut something down because it's different. I'm really coming at it from a value and cost perspective

🙌 1
lread 2022-11-02T13:57:16.086659Z

I like that

olttwa 2022-11-02T13:58:05.891519Z

> it is also the defacto for doc tools, codox, autodoc, quickdoc I view cljdoc as a Wiki. Since you can choose ordering in a Wiki, I think it'll be nice to have it here as well

Cora (she/her) 2022-11-02T13:58:07.653469Z

the cost right now is very hand-wavey and perhaps it's so small that even value for a subset of people is good enough to include it

lread 2022-11-02T13:58:27.279349Z

I don't think cljdoc is a wiki

Cora (she/her) 2022-11-02T13:58:32.430199Z

now that's a super interesting perspective, viewing it as a wiki

olttwa 2022-11-02T13:59:03.864589Z

It aspires to be a wiki, that's why cljdoc.edn & doc folders exist IMO

Cora (she/her) 2022-11-02T13:59:32.785739Z

I understand the desire for control over your documentation

Cora (she/her) 2022-11-02T14:00:13.863939Z

would you be willing to put together a prototype of what you're thinking? like where to put the toggle, where you think changes would need to happen?

Cora (she/her) 2022-11-02T14:00:32.282299Z

nothing too very involved

Cora (she/her) 2022-11-02T14:00:56.690939Z

you don't need to do a full implementation or anything

Cora (she/her) 2022-11-02T14:01:23.168839Z

trying to get a sense of how much effort to create and maintain it

Cora (she/her) 2022-11-02T14:01:31.638969Z

two authors have wanted it now

Cora (she/her) 2022-11-02T14:02:00.652969Z

which isn't a ton, but we're a small enough community that it's a larger percentage

Cora (she/her) 2022-11-02T14:02:53.108299Z

I think having search now makes this more palatable

Cora (she/her) 2022-11-02T14:03:25.704979Z

you don't have to only rely on alphabetic order in order to find vars now

lread 2022-11-02T14:03:28.859729Z

It would be nice to hear from@martinklepsch on this too (if you have a moment Martin, if not that's fine too, https://github.com/cljdoc/cljdoc/issues/89 for ref).

olttwa 2022-11-02T14:04:41.699949Z

> put together a prototype of what you're thinking? like where to put the toggle, where you think changes would need to happen? Sure @corasaurus-hex @lee. Please give me until a week or two.

lread 2022-11-02T14:04:54.058419Z

If you think of API docs as the searchable index (like in the back of a book) and your docs as telling the story, does that make your desire for this feature lessen @akshat.iitj?

olttwa 2022-11-02T14:04:54.422959Z

Thanks for your valuable time & insights 😄

💜 1
olttwa 2022-11-02T14:06:11.138669Z

I view API docs also as a story-teller, hence my need for the feature

olttwa 2022-11-02T14:06:32.652149Z

> I view the detailed namespace page as a story-teller in text & params, without the code.

lread 2022-11-02T14:06:49.754339Z

Ok, that's fine, just checking.

lread 2022-11-02T14:07:11.465689Z

Thanks for chiming in @corasaurus-hex, much appreciated!

💜 1
Cora (she/her) 2022-11-02T14:08:44.106509Z

also pleeease pay special attention to having the setting persist per library, and how to store that for someone, and how to use that. we all know clojure can slice and dice data structures but storing preferences is hard

Cora (she/her) 2022-11-02T14:09:12.499629Z

and also I wonder if storing it in the cookie would mean we need one of those cookie overlays

Cora (she/her) 2022-11-02T14:09:28.106759Z

GDPR is a pain

Cora (she/her) 2022-11-02T14:09:56.107709Z

if we decide to just make it part of the query string, that would be fine, too, I think

Cora (she/her) 2022-11-02T14:11:53.788149Z

but in order to store the preference client-side-only you'd need to store it in local storage and then redirect on page load when the query string is missing and the user has selected that they prefer that order

Cora (she/her) 2022-11-02T14:13:46.278169Z

not storing the preference and making them click the toggle every time would be the 80/20 on this feature

✅ 1