Skip to content

nbdev_mkdocs_docs

nbdev_mkdocs.mkdocs.nbdev_mkdocs_docs(root_path: str, refresh_quarto_settings: bool = False, use_relative_doc_links: bool = False, no_mkdocs_build: bool = False) -> None ¤

Prepare mkdocs documentation

Parameters:

Name Type Description Default
root_path str

The root path of the project

required
refresh_quarto_settings bool

Flag to refresh quarto yml file. This flag should be set to True if this function is called directly without calling prepare.

False
use_relative_doc_links bool

If set to True, relative links are added to symbol references in generated documentation. Else, the value set in doc_host in settings.ini is added to symbol references in generated documentation. This flag should be set to False if this function is called directly without calling preview.

False
no_mkdocs_build bool

If set to True, then the mkdocs build will be skipped. This flag should be set to False if this function is called directly without calling preview.

False

Note

The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)

Source code in nbdev_mkdocs/mkdocs.py
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
def nbdev_mkdocs_docs(
    root_path: str,
    refresh_quarto_settings: bool = False,
    use_relative_doc_links: bool = False,
    no_mkdocs_build: bool = False,
) -> None:
    """Prepare mkdocs documentation

    Args:
        root_path: The root path of the project
        refresh_quarto_settings: Flag to refresh quarto yml file. This flag should be set to `True`
            if this function is called directly without calling prepare.
        use_relative_doc_links: If set to True, relative links are added to symbol references in generated
            documentation. Else, the value set in doc_host in settings.ini is added to symbol references in
            generated documentation. This flag should be set to `False` if this function is called directly
            without calling preview.
        no_mkdocs_build: If set to True, then the mkdocs build will be skipped. This flag should be set to
            `False` if this function is called directly without calling preview.

    !!! note

        The above docstring is autogenerated by docstring-gen library (https://github.com/airtai/docstring-gen)
    """
    with set_cwd(root_path):
        if refresh_quarto_settings:
            refresh_quarto_yml()

        _copy_cname_if_needed(root_path)

        _copy_docs_overrides(root_path)

        lib_name = get_value_from_config(root_path, "lib_name")
        lib_path = get_value_from_config(root_path, "lib_path")

        cache_path = proc_nbs(force=True)
        nbdev_lookup = NbdevLookup(incl_libs=lib_name.replace("_", "-"))
        docs_versioning = get_value_from_config(root_path, "docs_versioning")
        lib_version = get_value_from_config(root_path, "version")
        _fix_sym_links_in_nbs(
            root_path,
            cache_path,
            nbdev_lookup,
            docs_versioning,
            lib_version,
            use_relative_doc_links,
        )

        _build_summary(root_path, lib_path, cache_path)

        if not no_mkdocs_build:
            cmd = f"mkdocs build -f \"{(Path(root_path) / 'mkdocs' / 'mkdocs.yml').resolve()}\""
            _sprun(cmd)