Fork me on GitHub
#cljdoc
<
2022-04-23
>
lread17:04:48

I think I’ve mostly finished my cljdoc article styling efforts for now. It was mostly an effort to fill in the gaps for AsciiDoc articles (and close some issues I had opened almost 3 years ago!) Things look mucho better to me, but please do let me know if you find something that is not rendering as you would expect.

martinklepsch17:04:40

woaaah - the search is amazing!

🎉 1
martinklepsch17:04:59

is there a tweet or something i could retweet? this is really cool

martinklepsch19:04:15

Wow it even seems to search within articles? that’s amazing!

🎉 3
☝️ 1
Cora (she/her)19:04:22

it's supposed to break down articles by section and deep-link but I broke that somehow

💜 1
lread21:04:53

@U02N27RK69K when you get your 2nd (3rd? nth?) wind, lemme know. Maybe I can help to make those sections easier to find for both adoc and md.

💜 1
Cora (she/her)21:04:38

the problem itself isn't particularly difficult. we need to find all the header tags with ids and the text between the headers is paired with the header before it

Cora (she/her)21:04:19

something must have changed because it did work at one point

Cora (she/her)21:04:43

or maybe it only works on some fraction of documents

lread21:04:38

I’m sure we could make it less brittle. I think you were looking at resulting HTML to find sections? Are you just wanting to breakdown by toplevel sections or are you looking at nested sections too?

Cora (she/her)21:04:35

nested sections? and yeah I was using the rendered html because I need whatever the library generates for the header id

Cora (she/her)21:04:05

if there's a better way I'm here for it

Cora (she/her)21:04:20

also a ton of this could be cached but I've avoided doing that, too

lread21:04:34

By nested mean like: • header1 ◦ some content ◦ header1.1 (nested) ▪︎ moar content • header1.1.1 (nested) ◦ more stuff • header2 ◦ header2 content If I search for stuff, would I match header1.1.1 or header1?

lread21:04:03

Yeah, caching can come when we see a need for it, I guess. Cljdoc does what seems to me a ton of rework for repeated requests. But maybe we don’t care at this point.

Cora (she/her)21:04:18

header 1.1.1 would be a match

👍 1
Cora (she/her)21:04:03

I have it to match all headers

Cora (she/her)21:04:30

I don't see why people shouldn't get to as close as possible to what they searched

Cora (she/her)21:04:59

about caching, I do, at least, cache client-side for a day

Cora (she/her)21:04:23

we could cache longer without causing much issue now that we also have a version number

lread21:04:00

Hmmm… I just recently added https://github.com/cljdoc/cljdoc/pull/601… Just looking at how these currently render today: md:

<h2><a href="#formatting-marks" id="formatting-marks" class="md-anchor">Formatting marks</a></h2>
adoc:
<h2 id="_formatting_marks"><a class="link" href="#_formatting_marks">Formatting marks</a></h2>

Cora (she/her)21:04:43

ok yeah I get it off of the anchor not the header

Cora (she/her)21:04:12

I don't remember writing that code but that's pretty slick

😎 1
lread21:04:00

that md-anchor for class md is a https://github.com/cljdoc/cljdoc/blob/7fc7f513a94785d2247b673ff9db4cc6d667dffe/src/cljdoc/render/rich_text.clj#L98…. If adding some markers would make it easier to do what you need to do, I think we could do that.

lread21:04:08

But maybe you have enough to go on? Header tag that contains an anchor tag…

Cora (she/her)21:04:37

I think that's enough to go on? I just don't know why it isn't working

Cora (she/her)21:04:12

also concerned about how to represent the name of the doc

Cora (she/her)21:04:43

like do you go "h1 text > h2 text > h3 text"

Cora (she/her)21:04:55

or do you just use h3 text

lread21:04:22

Yeah, good question. Next release could start with h3 text. Then refine if necessary?

Cora (she/her)21:04:44

that's what I was thinking

lread21:04:21

I glanced at your elegant code, but would need to fire up a REPL to see what’s what.

Cora (she/her)21:04:57

any time it's loop/recur it's like that 😂

lread21:04:41

ya, same!

lread22:04:25

could be a jsoup nuance tho too.. maybe..

Cora (she/her)22:04:25

totally possible

lread22:04:25

Want me to take a REPL run at it?

lread22:04:16

(if you need another set of eyes) (or are burnt out on search!) happy to do it if it would be helpful

Cora (she/her)22:04:19

if you'd like! I'm at family stuff all weekend so can't really do much with it

lread22:04:31

Coolio, will get to it sometime quite soon!

🎉 1
💜 1
lread22:04:49

Oh I see… your elegant code is not being invoked https://github.com/cljdoc/cljdoc/blob/7fc7f513a94785d2247b673ff9db4cc6d667dffe/src/cljdoc/render/api_searchset.clj#L100-L103 (:cljdoc.doc/type doc) will always return nil because that key is down under a doc’s :attrs.

Cora (she/her)22:04:51

well, it's an easy fix?

Cora (she/her)22:04:16

as much as I'm proud of this code I'm not proud of those function names

lread22:04:23

Ya, I expect! I’ll fiddle and see. Not sure why we have that :attrs subkey… but that’s a question for another day!

Cora (she/her)22:04:47

I'm sure there's a good historical reason 😊

lread22:04:46

Yeah… maybe! Maybe not! simple_smile It is what is and that’s OK.

lread22:04:37

Yep, your code is breaking down .md by sections with a wee fix. And it would not take much more for it to also handle .adoc, (now that we have that recent change).

Cora (she/her)22:04:31

do you want to make the adoc fix, too?

Cora (she/her)22:04:15

otherwise I anticipate having more energy this next week (I hope)

lread22:04:49

Yeah I could take a crack at it, unless the fix would bring you some pleasure/fun/joy? (I’d not want to steal that from you, but am also at the same time, happy to help!) If if do this, should I bump some client version cache thingy, to force a client-side update?

Cora (she/her)22:04:11

oh, no, I mostly care that people benefit from it so go for it!!

Cora (she/her)22:04:24

you could bump this version if you want but the cache only is around for a day so it's nbd if not https://github.com/cljdoc/cljdoc/blob/master/js/single-docset-search.tsx#L11

lread23:04:39

Ok, cool, I’ll give it a go!

💜 1
lread02:04:36

Ok started to take a peek. A little complication is that the html for adoc sections is nested. Ex. sect3 div is within sect2 div is within sect1 div. This is not the case for html for md which has a flat structure. I’m sure I can sort it out. I’ll take another peek tomorrow.

💜 1
Cora (she/her)02:04:19

I figured it needed a whole different way for adoc

lread22:04:49

Ya, you were right! Taking another swing at it now. Getting there, I think! simple_smile

🎉 1
lread02:04:12

At the test phase now. Very cool!

lread03:04:51

I hope I have not trounced too badly on your beautiful code! I’m a little bleary eyed, so won’t merge just yet. https://github.com/cljdoc/cljdoc/pull/616?

Cora (she/her)03:04:20

looks awesome and I love the doc improvements 💜

lread03:04:49

Thanks! That was me just wrapping my head around stuff and jotting notes.

lread04:04:28

And thanks for the PR review, mucho appreciated! I'll merge tomorrow, I don't have enough pep left tonight to recover should anything go sideways!

1
Cora (she/her)19:04:44

haven't had the energy to spend on it, though