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
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
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)