Skip to content

Conversation

@YDX-2147483647
Copy link
Member

@YDX-2147483647 YDX-2147483647 commented Sep 26, 2025

Resolves #3

Examples:

All parameters with nonempty strings
$ jq '.. | select(type == "object" and has("strings") and (.strings | type == "array" and length > 1)) | .name' public/docs.json --raw-output | sort | uniq
aria-autocomplete
aria-current
aria-haspopup
aria-invalid
aria-live
aria-orientation
aria-relevant
aria-sort
as
autocapitalize
autocomplete
bottom-edge
cap
class
colorspace
command
crossorigin
dash
decoding
enctype
endian
enterkeyhint
fetchpriority
fill-rule
fit
form
format
formenctype
formmethod
formtarget
http-equiv
inputmode
join
kind
linebreaks
loading
method
mode
name
number-type
number-width
numbering-scope
paper
popovertargetaction
referrerpolicy
rel
relationship
relative
role
sandbox
scaling
scope
shadowrootmode
shape
style
target
to
top-edge
type
weight
wrap
Number of possible values for each parameter
jq '[.. | select(type == "object" and has("strings") and (.strings | type == "array" and length > 1)) | { name: .name, n_strings: .strings | length }]' public/docs.json | from json | sort-by n_strings | uniq | to csv
name,n_strings
endian,2
scope,2
linebreaks,2
numbering-scope,2
form,2
number-type,2
number-width,2
to,2
fill-rule,2
mode,2
relative,2
scaling,2
aria-invalid,2
crossorigin,2
loading,2
decoding,2
fetchpriority,2
colorspace,2
shadowrootmode,2
wrap,2
mode,3
bottom-edge,3
style,3
fit,3
cap,3
join,3
aria-autocomplete,3
aria-live,3
aria-orientation,3
aria-sort,3
autocapitalize,3
formenctype,3
formmethod,3
popovertargetaction,3
type,3
enctype,3
method,3
form,4
relationship,4
target,4
shape,4
formtarget,4
name,4
scope,4
form,5
top-edge,5
aria-current,5
aria-haspopup,5
aria-relevant,5
http-equiv,5
type,5
kind,5
format,6
command,6
enterkeyhint,7
inputmode,7
referrerpolicy,8
weight,9
class,10
dash,10
sandbox,13
type,22
as,22
rel,27
autocomplete,61
role,80
style,86
paper,107

We need a PR preview bot. Netlify offers a free one, even for org accounts. See typst-doc-cn/clreq#49 for an example.

@YDX-2147483647 YDX-2147483647 force-pushed the strings branch 2 times, most recently from a70a8ab to 4b1fe49 Compare September 26, 2025 15:44
@YDX-2147483647 YDX-2147483647 marked this pull request as ready for review September 29, 2025 06:49
@YDX-2147483647 YDX-2147483647 requested review from a team and 3w36zj6 as code owners September 29, 2025 06:49
Copy link
Member

@3w36zj6 3w36zj6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@3w36zj6
Copy link
Member

3w36zj6 commented Oct 1, 2025

@typst-community/jp

Could you do a quick review?

@gomazarashi
Copy link

I tested this locally and it behaves as expected. Thank you for implementing this change.

@kimushun1101
Copy link

@YDX-2147483647
Thank you for your contribution. I also checked it.

On this page, the accordion is expanded by default when it loads. Is this the expected behavior?

@YDX-2147483647
Copy link
Member Author

YDX-2147483647 commented Oct 4, 2025

On this page, the accordion is expanded by default when it loads. Is this the expected behavior?

Well, this PR displays all string values as unordered lists (<ul>) in collapsible blocks (<details>).
If there are five or fewer values, then the block is expanded by default; otherwise, it's collapsed by default. (The threshold is selected based on the statistics in the PR description.)
In this sense, that is the expected behaviour.

You may have noticed that the official https://typst.app/docs displays some string values as tables (e.g., eval.mode), and displays others as unordered lists (e.g., page.paper).
However, it's impossible to implement this behaviour in typst-docs-web, because docs.json does not distinguish between these two kinds of string values.
The official typst can do it because it uses the typst-docs crate (lib.rs), but does not use the typst-docs CLI (main.rs).

@kimushun1101
Copy link

Thank you for your kind response. I've now understood the difference in this behavior between typst-docs-web and the official page.

@3w36zj6 3w36zj6 merged commit ba51ebc into typst-community:main Oct 5, 2025
3 checks passed
@ultimatile
Copy link

While I was struggling with checking out the submodule, it was already merged.
I'm sorry I couldn't complete my review on time, but I think it's been thoroughly reviewed now.
This fix should make it more readable. Thank you for addressing the issue.

@YDX-2147483647 YDX-2147483647 deleted the strings branch October 5, 2025 12:25
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.

Make the list of available paper values in /reference/layout/page/ collapsible

5 participants