This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-23
Channels
- # babashka (18)
- # babashka-sci-dev (42)
- # beginners (84)
- # calva (11)
- # cider (5)
- # clj-kondo (11)
- # cljdoc (70)
- # cljs-dev (34)
- # clojure-europe (1)
- # clojurescript (3)
- # conjure (1)
- # core-async (29)
- # data-oriented-programming (10)
- # emacs (13)
- # fulcro (8)
- # gratitude (2)
- # honeysql (1)
- # introduce-yourself (4)
- # kaocha (10)
- # missionary (8)
- # nrepl (4)
- # off-topic (27)
- # portal (32)
- # releases (11)
- # tools-deps (11)
- # xtdb (19)
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.
is there a tweet or something i could retweet? this is really cool
https://twitter.com/corasaurus_hex/status/1516535379528192003?s=21&t=Ou-fG4IXvszRRScubvliJA
it's supposed to break down articles by section and deep-link but I broke that somehow
@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.
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
something must have changed because it did work at one point
or maybe it only works on some fraction of documents
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?
nested sections? and yeah I was using the rendered html because I need whatever the library generates for the header id
if there's a better way I'm here for it
also a ton of this could be cached but I've avoided doing that, too
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?
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.
https://github.com/cljdoc/cljdoc/blob/master/src/cljdoc/render/api_searchset.clj#L10
I have it to match all headers
I don't see why people shouldn't get to as close as possible to what they searched
about caching, I do, at least, cache client-side for a day
we could cache longer without causing much issue now that we also have a version number
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>
well then
https://github.com/cljdoc/cljdoc/blob/master/src/cljdoc/render/api_searchset.clj#L54
ok yeah I get it off of the anchor not the header
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.
I think that's enough to go on? I just don't know why it isn't working
also concerned about how to represent the name of the doc
like do you go "h1 text > h2 text > h3 text"
or do you just use h3 text
that's what I was thinking
any time it's loop/recur it's like that 😂
totally possible
(if you need another set of eyes) (or are burnt out on search!) happy to do it if it would be helpful
if you'd like! I'm at family stuff all weekend so can't really do much with it
I'd love it
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
.
oh wow
well, it's an easy fix?
as much as I'm proud of this code I'm not proud of those function names
Ya, I expect! I’ll fiddle and see.
Not sure why we have that :attrs
subkey… but that’s a question for another day!
I'm sure there's a good historical reason 😊
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).
do you want to make the adoc fix, too?
otherwise I anticipate having more energy this next week (I hope)
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?
oh, no, I mostly care that people benefit from it so go for it!!
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
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.
I figured it needed a whole different way for adoc
yesssss
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?
looks awesome and I love the doc improvements 💜
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!
haven't had the energy to spend on it, though