Home / Function/ generate_renamed_section_items() — fastapi Function Reference

generate_renamed_section_items() — fastapi Function Reference

Architecture documentation for the generate_renamed_section_items() function in mkdocs_hooks.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  2007df4a_6adb_2384_a345_15bd16e50f60["generate_renamed_section_items()"]
  566dbae4_46de_4e4a_0ed4_0c59e40fbcf8["mkdocs_hooks.py"]
  2007df4a_6adb_2384_a345_15bd16e50f60 -->|defined in| 566dbae4_46de_4e4a_0ed4_0c59e40fbcf8
  fef0cf63_79b1_2b79_db6c_e7f1f3cbae4f["on_nav()"]
  fef0cf63_79b1_2b79_db6c_e7f1f3cbae4f -->|calls| 2007df4a_6adb_2384_a345_15bd16e50f60
  style 2007df4a_6adb_2384_a345_15bd16e50f60 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/mkdocs_hooks.py lines 107–129

def generate_renamed_section_items(
    items: list[Union[Page, Section, Link]], *, config: MkDocsConfig
) -> list[Union[Page, Section, Link]]:
    new_items: list[Union[Page, Section, Link]] = []
    for item in items:
        if isinstance(item, Section):
            new_title = item.title
            new_children = generate_renamed_section_items(item.children, config=config)
            first_child = new_children[0]
            if isinstance(first_child, Page):
                if first_child.file.src_path.endswith("index.md"):
                    # Read the source so that the title is parsed and available
                    first_child.read_source(config=config)
                    new_title = first_child.title or new_title
            # Creating a new section makes it render it collapsed by default
            # no idea why, so, let's just modify the existing one
            # new_section = Section(title=new_title, children=new_children)
            item.title = new_title.split("{ #")[0]
            item.children = new_children
            new_items.append(item)
        else:
            new_items.append(item)
    return new_items

Domain

Subdomains

Called By

Frequently Asked Questions

What does generate_renamed_section_items() do?
generate_renamed_section_items() is a function in the fastapi codebase, defined in scripts/mkdocs_hooks.py.
Where is generate_renamed_section_items() defined?
generate_renamed_section_items() is defined in scripts/mkdocs_hooks.py at line 107.
What calls generate_renamed_section_items()?
generate_renamed_section_items() is called by 1 function(s): on_nav.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free