Skip to content

Conversation

@YDX-2147483647
Copy link
Contributor

@YDX-2147483647 YDX-2147483647 commented Aug 2, 2025

This PR will uncover doubly nested definitions, which were previously hidden.
Resolves #234

Example

  1. outline is a function.
  2. outline.entry is a function nested in outline
  3. outline.entry.indented is a function doubly nested in outline.

Currently, indented, prefix, and other definitions under outline.entry are missing in https://typst-jp.github.io/docs/reference/model/outline/. The last part on that page is fill, which is a parameter of outline.entry.

This PR will add those definitions.

Preview

Tips for reviewers

Please check the translation https://github.com/typst-jp/typst-jp.github.io/pull/238#discussion_r2250468953

Definitions of entry

LLM and translators suggest:

entryの定義

In Chinese, entry的定義 is better (的 = の). But in Japanese, I don't know…

The scope has at most two levels

You can verify it by searching assets/docs.json with ripgrep.

$ rg '"scope": \[$' docs.json --after-context 3
…
--
13505:                "scope": [
13506-                  {
13507-                    "path": [
13508-                      "outline"
--
13571:                    "scope": [
13572-                      {
13573-                        "path": [
13574-                          "entry"
--
13967:                "scope": [
13968-                  {
13969-                    "path": [
13970-                      "par"
--
14925:                "scope": [
14926-                  {
14927-                    "path": [
14928-                      "table"

There are still broken links due to an upstream bug

In the section Styling the outline > Building an Entry, the links to indented, prefix, and inner all point to outline.entry, but they are expected to point to outline.entry.{indented,prefix,inner}, respectively.

These links are generated by typst-docs, and can hardly be fixed here.
I've fixed the bug in the upstream, but it won't take effect before typst-jp merges the uptream.
Considering that this page has not been translated yet, you can deal with this issue later.

In spite of it, links in 目次 and 引数 will behave normally, as they are generated by typst-jp.

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 fixes the issue where doubly nested function definitions were not being displayed on documentation pages. The change modifies the FuncTemplate component to recursively render nested function definitions using a new ScopedDefinitions component, ensuring that all levels of nested definitions (like outline.entry.indented) are properly shown in the documentation.

Key changes:

  • Extract definition rendering logic into a reusable ScopedDefinitions component
  • Add recursive rendering for nested function scopes
  • Update heading IDs and labels to reflect the nesting hierarchy

Copy link
Member

@kimushun1101 kimushun1101 left a comment

Choose a reason for hiding this comment

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

It worked fine on the outline page. LGTM!

Copy link
Contributor

@gomazarashi gomazarashi left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! It works perfectly on my end.

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, thanks!

@3w36zj6 3w36zj6 merged commit b1e96d5 into typst-jp:main Aug 7, 2025
5 checks passed
@YDX-2147483647 YDX-2147483647 deleted the nested branch August 7, 2025 03:47
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.

Definitions under outline.entry are missing in the website

5 participants