Skip to content

Conversation

@3w36zj6
Copy link
Member

@3w36zj6 3w36zj6 commented Oct 29, 2025

close #23

This pull request standardizes the styles across the library pages and fixes any broken designs.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors UI components to simplify styling and improve markup structure. The changes focus on removing unnecessary styling, restructuring heading layouts to properly wrap flex containers, and cleaning up the function path generation logic.

  • Simplified genPath function to use native join() instead of manual concatenation
  • Restructured heading elements to wrap flex containers in a div for proper layout
  • Removed excessive styling from various UI components (borders, backgrounds, padding)

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/components/ui/genPath.ts Simplified path generation logic to use join(".") directly
src/components/ui/FunctionParameters.tsx Removed styling from parameter containers and examples, restructured heading flex layout
src/components/ui/FunctionDisplay.tsx Simplified example display styling and color scheme
src/components/ui/FunctionDefinition.tsx Refactored to use semantic HTML (<pre><code>), added conditional dot rendering, restructured to use span elements
src/components/templates/TypeTemplate.tsx Wrapped heading flex content in divs for proper layout
src/components/templates/GroupTemplate.tsx Wrapped heading flex content in divs for proper layout
src/components/templates/FuncTemplate.tsx Wrapped heading flex content in divs, removed indentation and borders from scoped definitions
src/components/templates/CategoryTemplate.tsx Changed oneliner rendering from plain div to paragraph element

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@YDX-2147483647 YDX-2147483647 left a comment

Choose a reason for hiding this comment

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

It's a great work to systematically refactor the styling!

However, contents on pages are quite diverse, and there are a few edge cases that seem confusing now… Please see the comments below for details.

Maybe we should a keep a memo of edge cases and add links to the official and typst-jp website, like the one on editing docs?

Besides, I notice that you've organized lots of hard-coded colors into typ-* classes. It's helpful and even paves the way for future support of dark mode.

return (
<div
key={method.name}
class="mb-8 pb-6 border-b border-gray-100 last:border-0"
Copy link
Member

Choose a reason for hiding this comment

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

Here you've removed the border.
See outline.entry.{inner,body,page}. These border lines lines help distinguish the functions.

图片

↓ After the removal, body seems to be a parameter of inner?

I suggest adding the border back.
If you just don't like the border, please increase the spacing here.

Copy link
Member Author

Choose a reason for hiding this comment

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

We plan to add decorative elements to the headings, so we will put this proposal on hold.

);
})}
</div>
<div>
Copy link
Member

Choose a reason for hiding this comment

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

I think the new style is less readable than the old style or the official style.

I can hardly distinguish headings from descriptions…

图片

Maybe adjusting spacings or font weights?

Copy link
Member Author

Choose a reason for hiding this comment

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

We plan to add decorative elements to the headings, so we will put this proposal on hold.

@3w36zj6
Copy link
Member Author

3w36zj6 commented Nov 1, 2025

Thank you for reviewing this PR despite the large number of changes. I will make the necessary corrections to each part later.

By the way, regarding the headings, I am planning to introduce explicit styles in #26. What do you think about this approach?

@netlify
Copy link

netlify bot commented Nov 2, 2025

Deploy Preview for typst-docs-web ready!

Name Link
🔨 Latest commit 71044f4
🔍 Latest deploy log https://app.netlify.com/projects/typst-docs-web/deploys/690d5c5509ab010008302339
😎 Deploy Preview https://deploy-preview-28--typst-docs-web.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@3w36zj6
Copy link
Member Author

3w36zj6 commented Nov 4, 2025

Syntax highlighting is now enabled for inline code as well, which makes things look a bit livelier.

I personally prefer having inline code highlighted too, but what do you think?

@YDX-2147483647
Copy link
Member

Could you rebase/merge main? #27 is likely to affect the style.

@3w36zj6
Copy link
Member Author

3w36zj6 commented Nov 7, 2025

If #26 is merged, do we have any remaining issues?

@3w36zj6
Copy link
Member Author

3w36zj6 commented Nov 7, 2025

It feels odd to see an h4 heading appear directly after an h2 section heading, as seen in /reference/foundations/arguments/. The official docs were structured the same way.

<HtmlBlock html={block.content} />
</div>
);
case "example":
Copy link
Member

@YDX-2147483647 YDX-2147483647 Nov 7, 2025

Choose a reason for hiding this comment

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

For consecutive examples (e.g., par.line.numbering), the spacing is still too large, because there's an empty <div> between them..

Image

Deleting the empty <div> will fix the spacing:

Image

This might be an upstream bug in typst-docs CLI.
The official docs does not have the empty <div> here, but in docs.json, there is:

                        "details": [
                          {
                            "kind": "html",
                            "content": "<p>How to number each line. Accepts a\n<a href=\"/reference/model/numbering/\">numbering pattern or function</a> taking a single number.</p>"
                          },
                          {
                            "kind": "example",
                            "content": {
                              "body": "<div class=\"previewed-code\">…</div>",
                              "title": null
                            }
                          },
                          {
                            "kind": "html",
                            "content": ""
                          },
                          {
                            "kind": "example",
                            "content": {
                              "body": "<div class=\"previewed-code\">…</div>",
                              "title": null
                            }
                          }
                        ],

(Ha, an immediate use case of #35)

Created typst/typst#7323

@YDX-2147483647
Copy link
Member

I think the only problem now is the style of parameters. Compared with border lines, === occupies a big space, but the separation is not very clear.

图片 图片

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.

Annotations to scoped functions in GroupTemplate are inconsistent with those in FuncTemplate

3 participants