One

One()

A section of the documentation that outputs to one file.

See the design for an explanation of the design of One. See the guide on how to set up custom styles and sections. See Config for more details on the top-level settings and Content for more details on the content items.

Attributes

output_path : Optional[RelativePath]

The output path for the section relative to Config.output_dir. Can be None when a style outputs to the terminal such as when using view().

contents : list[Content]

List of content items to include in this section. See Content for more details about what to include. If more than one content item is included, they will be concatenated in the order provided, so that the output_path file will contain the output of the rendered Jinja2 templates for each content item, appended one after the other.

Examples

import seedcase_flower as fl
from pathlib import Path

# A section that contains only the package and contributors content items,
# saved to the `package.qmd` file.
section = fl.One(
    output_path=Path("package.qmd"),
    contents=[
        fl.Content(
            jsonpath="$",
            template_path=Path("package.qmd.jinja"),
            jinja_variable="package",
        ),
        fl.Content(
            jsonpath="$.contributors",
            template_path=Path("contributors.qmd.jinja"),
            jinja_variable="contributors",
        ),
    ],
)