Some things that need to be added in typst docs

Hi everyone. Recently I ran into two problems with typst, and I found that typst documentation lacks clear explanations, so I’m sharing them here.

  1. In function, the documentation format of the function is not explained (nor is it explained in the ‘comments’). It wasn’t until I wrote a plugin that VS code’s autocomplete prompted me to comment with three slashes like this:
/// ...
///
/// - arg (...): ...
/// -> ...
#let func(arg) = {}
  1. In functions, unpacking is not explicitly stated. When I write an oral arithmetic practice document, I need to pass the value of array into the table. typst’s documentation also doesn’t give a clear explanation until AI helps me this time:
#table(
columns: (1fr, 1fr),
.. range(50).map(i=>{
str(a.at(i)) "   " str(b.at(i)) " ="
})
)

I’ve never seen a two-point explanation in the documentation for unpacking, so I’ve made a lot of stupid attempts, including trying to define a list and then adding elements to it (there is no such method), or using a for-loop directly in the definition of a table (and then giving an error).

In the Grid Function – Typst Documentation

And in Arguments Type – Typst Documentation

2 Likes

Oh, I really didn’t notice this place. I’ve been trying to search for ‘unpack’ instead of ‘spread’, maybe because my python writes too much :joy:

1 Like

Typst does not yet have an official documentation comment syntax. The current approach was created by the community, and there are plans to standardize and eventually integrate it into Typst.

1 Like

Documentation is indeed subpar. If you try to seach “spreading”, you don’t seem to find any proper results because spreading does not show up in thje search results directly. I think all the basic language features should be more searchable. Now you find hints of them in other documentation pages.

1 Like

For searching, there is Improve the documentation search · Issue #449 · typst/webapp-issues · GitHub.

In addition to the documentation syntax explanation of @flokl: it is mainly used for the tidy package (which is really neat if you are a package author) and the language tinymist also supports it.