(
title: str,
description: str,
position: int,
*,
sidebar_title: str | None = None,
slug: str | None = None,
normalize: TextNormalizer = identity,
)
| 40 | |
| 41 | |
| 42 | def frontmatter( |
| 43 | title: str, |
| 44 | description: str, |
| 45 | position: int, |
| 46 | *, |
| 47 | sidebar_title: str | None = None, |
| 48 | slug: str | None = None, |
| 49 | normalize: TextNormalizer = identity, |
| 50 | ) -> str: |
| 51 | lines = ["---", f"title: {quote_yaml_string(title, normalize=normalize)}"] |
| 52 | if sidebar_title is not None: |
| 53 | lines.append(f"sidebar-title: {quote_yaml_string(sidebar_title, normalize=normalize)}") |
| 54 | if slug is not None: |
| 55 | lines.append(f"slug: {quote_yaml_string(slug, normalize=normalize)}") |
| 56 | lines.extend( |
| 57 | [ |
| 58 | f"description: {quote_yaml_string(description, normalize=normalize)}", |
| 59 | f"position: {position}", |
| 60 | "---", |
| 61 | ] |
| 62 | ) |
| 63 | return "\n".join(lines) + "\n" + MDX_SPDX_COMMENT + "\n" |
| 64 | |
| 65 | |
| 66 | def display_path(path: Path, *, cwd: Path | None = None, resolve: bool = False) -> str: |
no test coverage detected