Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design suggestion for generated docs #3429

Merged
merged 11 commits into from
Oct 19, 2019
Merged

Design suggestion for generated docs #3429

merged 11 commits into from
Oct 19, 2019

Conversation

Rocknest
Copy link
Contributor

I played with styles and made this draft. Dark mode is broken at the moment.

@andrewrk
Copy link
Member

I played with this a bit. The improvements to light mode look nice.

Here are 2 issues I found:

Screenshot_2019-10-10_13-45-08

The underscore is hidden by the hyperlink here.

Screenshot_2019-10-10_13-44-19

The error names and descriptions layout is jumbled here.

I'd be happy to merge this if the above things are fixed and:

  • remove the old css class and commented out styles
  • add dark mode

@andrewrk andrewrk added the work in progress This pull request is not ready for review yet. label Oct 10, 2019
@Rocknest
Copy link
Contributor Author

@andrewrk page for readFileAlloc is empty in 0.5.0+6cbb732b
image
Docs generated using this command: zig build-lib lib/zig/std/std.zig -fgenerate-docs

Additionally introduces css variables
@andrewrk
Copy link
Member

Docs generated using this command: zig build-lib lib/zig/std/std.zig -fgenerate-docs

you'll want to use the test command so that more declarations get referenced

@Rocknest
Copy link
Contributor Author

Ready for review

@andrewrk andrewrk removed the work in progress This pull request is not ready for review yet. label Oct 11, 2019
Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

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

I apologize, the reason I've been putting off merging this PR so far is that you're using all these advanced CSS things that I've never seen before, which is cool, but I want to make sure that we can rely on these features being widely available. I'm willing to do the work of figuring this stuff out on my own, but if you're willing to hold my hand a little bit it would expedite the merging process.

body {
font-family: system-ui, -apple-system, Roboto, "Segoe UI", sans-serif;
max-width: 60em;
:root {
Copy link
Member

Choose a reason for hiding this comment

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

I don't recognize this CSS feature. What is it called, and is it supported everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its "root element selector", it overrides html selector.

Chrome 1+, Firefox 1+, Safari 1+.

max-width: 60em;
:root {
font-size: 1em;
--ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
Copy link
Member

Choose a reason for hiding this comment

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

Same here, what's with the -- ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are "css custom properties" aka "css variables".

Chrome 49+, Firefox 31+, Safari 9+.
IE no support at all.

overflow: hidden;
margin: 0;
padding: 0;
font-family: var(--ui);
Copy link
Member

Choose a reason for hiding this comment

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

same thing here. I'm worried about widespread compatibility. Is this available everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here - css variables.

overflow-x: auto;

.flex-main {
display: flex;
Copy link
Member

Choose a reason for hiding this comment

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

same question

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Flexbox works in Chrome 29+, Safari 9+ and in Firefox since v20 with some minor bugs (for advanced stuff).

height: 100vh;

.flex-left {
width: 12rem;
Copy link
Member

Choose a reason for hiding this comment

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

what is rem?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"root" em. Not affected by changing target element's font-size.

Chrome 4+, Firefox 3.6+, Safari 5+.

box-shadow: 0 0.3em 1em 0.125em var(--search-sh-color);
}

.docs .search::placeholder {
Copy link
Member

Choose a reason for hiding this comment

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

same question regarding ::

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pseudo-element selector that allows to apply styles to <input>'s placeholder attribute (its not affected by other means and does not inherit from <input>).

Chrome 57+, Firefox 51+, Safari 10+.
(Should be silently ignored if not supported)

@andrewrk
Copy link
Member

Thanks for walking me through this stuff! I'll take one more peek at it and then press that big green button :)

@andrewrk andrewrk merged commit 6948d7f into ziglang:master Oct 19, 2019
@andrewrk
Copy link
Member

Looks great! Thanks!

@Rocknest
Copy link
Contributor Author

What can be done next to improve generated docs? Should it be optimised for mobile or PC is enough?

@andrewrk
Copy link
Member

Here are some related issues:

And finally, multibuilds. Multibuilds is a big topic, but as far as std lib documentation for the near term, I'm in the middle of implementing a tool in zig that merges multiple semantic analysis dumps into one, which will make the std lib documentation aware of multiple targets rather than only the one active during documentation generation.

I would like to note that this semantic analysis dump also paves the way for third party integrations, for example the language server protocol. I don't plan on doing any work on this until the self-hosted compiler, but if any community members are interested in taking a stab at it, there is now a nice big juicy JSON formatted dump of all the semantic analysis the compiler has done, and pretty straightforward JavaScript code showing you how to take advantage of it.

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