cljdoc

lread 2022-04-23T17:22:48.480349Z

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.

martinklepsch 2022-04-23T17:29:40.379719Z

woaaah - the search is amazing!

🎉 1
martinklepsch 2022-04-23T17:29:59.520659Z

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

martinklepsch 2022-04-23T19:01:15.496159Z

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

☝️ 1
🎉 3
Cora (she/her) 2022-04-23T19:49:22.602419Z

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

💜 1
lread 2022-04-23T21:18:53.437209Z

@corasaurus-hex 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) 2022-04-23T21:21:38.614889Z

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) 2022-04-23T21:22:19.216369Z

something must have changed because it did work at one point

Cora (she/her) 2022-04-23T21:22:43.436869Z

or maybe it only works on some fraction of documents

lread 2022-04-23T21:26:38.356029Z

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) 2022-04-23T21:29:35.769639Z

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

Cora (she/her) 2022-04-23T21:32:05.243659Z

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

Cora (she/her) 2022-04-23T21:32:20.222349Z

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

lread 2022-04-23T21:32:34.018109Z

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?

lread 2022-04-23T21:34:03.148619Z

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) 2022-04-23T21:35:18.152459Z

header 1.1.1 would be a match

👍 1
Cora (she/her) 2022-04-23T21:36:03.288269Z

I have it to match all headers

Cora (she/her) 2022-04-23T21:36:30.398119Z

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

Cora (she/her) 2022-04-23T21:36:59.667039Z

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

Cora (she/her) 2022-04-23T21:37:23.120379Z

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

lread 2022-04-23T21:42:00.803489Z

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) 2022-04-23T21:43:48.562539Z

well then

Cora (she/her) 2022-04-23T21:46:43.409479Z

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

Cora (she/her) 2022-04-23T21:49:12.405749Z

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

😎 1
lread 2022-04-23T21:50:00.150459Z

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.

lread 2022-04-23T21:51:08.842409Z

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

Cora (she/her) 2022-04-23T21:51:37.848349Z

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

Cora (she/her) 2022-04-23T21:54:12.816449Z

also concerned about how to represent the name of the doc

Cora (she/her) 2022-04-23T21:54:43.416659Z

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

Cora (she/her) 2022-04-23T21:54:55.379019Z

or do you just use h3 text

lread 2022-04-23T21:57:22.676239Z

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

Cora (she/her) 2022-04-23T21:57:44.734219Z

that's what I was thinking

lread 2022-04-23T21:58:21.553699Z

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

Cora (she/her) 2022-04-23T21:58:57.420099Z

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

lread 2022-04-23T21:59:41.092539Z

ya, same!

lread 2022-04-23T22:00:25.332569Z

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

Cora (she/her) 2022-04-23T22:01:25.976179Z

totally possible

lread 2022-04-23T22:02:25.396859Z

Want me to take a REPL run at it?

lread 2022-04-23T22:03:16.978989Z

(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) 2022-04-23T22:03:19.138969Z

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

Cora (she/her) 2022-04-23T22:03:23.844199Z

I'd love it

lread 2022-04-23T22:06:31.585279Z

Coolio, will get to it sometime quite soon!

💜 1
🎉 1
lread 2022-04-23T22:32:49.856469Z

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) 2022-04-23T22:33:44.461489Z

oh wow

Cora (she/her) 2022-04-23T22:33:51.246299Z

well, it's an easy fix?

Cora (she/her) 2022-04-23T22:35:16.069979Z

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

lread 2022-04-23T22:35:23.684179Z

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) 2022-04-23T22:36:47.072559Z

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

lread 2022-04-23T22:37:46.772239Z

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

lread 2022-04-23T22:42:37.411239Z

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) 2022-04-23T22:45:31.548559Z

do you want to make the adoc fix, too?

Cora (she/her) 2022-04-23T22:46:15.543939Z

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

lread 2022-04-23T22:47:49.839719Z

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) 2022-04-23T22:54:11.963209Z

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

Cora (she/her) 2022-04-23T22:55:24.158659Z

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

lread 2022-04-23T23:04:39.380759Z

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

💜 1
lread 2022-04-24T02:32:36.628439Z

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) 2022-04-24T02:52:19.593439Z

I figured it needed a whole different way for adoc

lread 2022-04-24T22:15:49.953719Z

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

🎉 1
lread 2022-04-25T02:54:12.458499Z

At the test phase now. Very cool!

Cora (she/her) 2022-04-25T03:02:54.132389Z

yesssss

lread 2022-04-25T03:16:51.087419Z

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) 2022-04-25T03:39:20.181069Z

looks awesome and I love the doc improvements 💜

lread 2022-04-25T03:45:49.780939Z

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

lread 2022-04-25T04:09:28.939299Z

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) 2022-04-23T19:49:44.852669Z

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