diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c7fcdc74f7..44b7bb2e3e 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -93,6 +93,8 @@ jobs: working-directory: ./inference_repo - name: Build block docs + env: + LOAD_ENTERPRISE_BLOCKS: "TRUE" run: python -m development.docs.build_block_docs working-directory: ./inference_repo diff --git a/development/docs/build_block_docs.py b/development/docs/build_block_docs.py index 69f69f8c42..6cdde1706d 100644 --- a/development/docs/build_block_docs.py +++ b/development/docs/build_block_docs.py @@ -493,9 +493,17 @@ def _escape_jinja2_dollar_expression(match: re.Match) -> str: def get_source_link_for_block_class(block_class: Type[WorkflowBlock]) -> str: try: - filename = inspect.getfile(block_class).split("inference/core/workflows/")[1] - return f"https://github.com/roboflow/inference/blob/main/inference/core/workflows/{filename}" - except Exception as e: + filepath = inspect.getfile(block_class) + # Resolve the path relative to the `inference` package root so that both + # core blocks (inference/core/workflows/...) and enterprise blocks + # (inference/enterprise/workflows/...) produce valid links. + marker = f"{os.sep}inference{os.sep}" + idx = filepath.rfind(marker) + if idx == -1: + return None + relative_path = filepath[idx + 1 :].replace(os.sep, "/") + return f"https://github.com/roboflow/inference/blob/main/{relative_path}" + except Exception: return None def get_auto_generation_markers(