Skip to content

Conversation

@helins
Copy link
Contributor

@helins helins commented Sep 28, 2022

The first commit describes how var linking has been generalized and made more reliable by eschewing memo and using analysis data. Eventually, the last commit provides support for [[var]] as discussed on Clojurians.

Seems to behave well with my docs although I use that wikilinks syntax. I quickly tried with a few backticks and it seems to work as well but please give it a try first :)

This commit introduces a significant change in how var linking is
performed:

- MD sections are anchored with stringified qualified symbols
- Munging down while generating TOC is gone
- A map of `namespace` -> `#{vars}` is prepared
- During var linking, that map is used to detect if a value should be
  linked to a namespace or a var
The core `quickdoc` function was indeed applying defaults using the
`:or` construct in destructuring. However, raw options were then passed
to inner functions, resulting in defaults not being enforced downstream.
Introduces a new option `:var-pattern` deciding how vars are detected in
docstrings. Set to `:backticks` by default. Users can also choose
`:wikilinks` (aka double brackets) so that is behave like Codox and
Cljdoc.
@borkdude
Copy link
Owner

Tried this out on fs here: https://github.com/babashka/fs/blob/fs-quickdoc/API.md#babashka.fs/real-path

Looks good I think!

We should really be starting to think about tests though :-)

@borkdude borkdude merged commit 7bc7d67 into borkdude:main Sep 28, 2022
@helins
Copy link
Contributor Author

helins commented Sep 28, 2022

I thought it would be a good idea eventually doing it in 2 phases: synthesize Clj-kondo analysis into a hiccup-like structure resembling the MD output and then pass it through a formatter whose job is printing the file.

That way testing the synthesis phase will be easy and formatting can be pluggable. For instance, another incoming PR will be about little cosmetic changes and might be more a matter of taste.

@borkdude
Copy link
Owner

Yeah, that sounds good: analysis -> data -> md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants