Fork me on GitHub
#cljdoc
<
2022-10-31
>
olttwa06:10:09

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?

lread13:10:56

Hiya @U03HVBGMRJ5! 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?

olttwa14:10:49

Hey @UE21H2HHD 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

olttwa14:10:51

> 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.

lread16:10:21

@U03HVBGMRJ5 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.

olttwa20:10:19

> 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?

lread01:11:18

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?

olttwa05:11:01

> 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

olttwa07:11:17

@UE21H2HHD how do we take this forward?

olttwa13:11:59

Would cljdoc need cookies consent to retain user preference globally?

lread13:11:08

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.

olttwa13:11:59

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

lread13:11:03

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

lread13:11:41

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

gratitude-thank-you 1
lread13:11:15

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

olttwa13:11:50

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

lread13:11:38

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

👍 1
lread13:11:36

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

lread13:11:24

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)13:11:17

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

Cora (she/her)13:11:25

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)13:11:25

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)13:11:37

so there's likely something I'm missing

Cora (she/her)13:11:49

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

lread13:11:07

I'll let @U03HVBGMRJ5 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 @U050TNB9F felt this was interesting too as he raised the initial issue.

lread13:11:40

Personally, I do the story telling in the docs.

Cora (she/her)13:11:55

yeah, it seems a better fit for prose

lread13:11:27

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)13:11:59

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

Cora (she/her)13:11:42

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

olttwa13:11:45

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)13:11:19

I usually read clojure files in reverse order

Cora (she/her)13:11:49

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

olttwa13:11:53

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

Cora (she/her)13:11:10

because in a user interface that is predictable

Cora (she/her)13:11:19

there was no search then

Cora (she/her)13:11:19

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

olttwa13:11:24

> 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

lread13:11:27

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

Cora (she/her)13:11:04

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
lread13:11:16

I like that

olttwa13:11:05

> 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)13:11:07

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

lread13:11:27

I don't think cljdoc is a wiki

Cora (she/her)13:11:32

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

olttwa13:11:03

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

Cora (she/her)13:11:32

I understand the desire for control over your documentation

Cora (she/her)14:11:13

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)14:11:32

nothing too very involved

Cora (she/her)14:11:56

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

Cora (she/her)14:11:23

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

Cora (she/her)14:11:31

two authors have wanted it now

Cora (she/her)14:11:00

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

Cora (she/her)14:11:53

I think having search now makes this more palatable

Cora (she/her)14:11:25

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

lread14:11:28

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

olttwa14:11:41

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

lread14:11:54

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 @U03HVBGMRJ5?

olttwa14:11:54

Thanks for your valuable time & insights 😄

💜 1
olttwa14:11:11

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

olttwa14:11:32

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

lread14:11:49

Ok, that's fine, just checking.

lread14:11:11

Thanks for chiming in @U02N27RK69K, much appreciated!

💜 1
Cora (she/her)14:11:44

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)14:11:12

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

Cora (she/her)14:11:56

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

Cora (she/her)14:11:53

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)14:11:46

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

1