diff --git a/docs/_scripts/generate_api_reference_links.py b/docs/_scripts/generate_api_reference_links.py
index bbd440a1a..714dc641f 100644
--- a/docs/_scripts/generate_api_reference_links.py
+++ b/docs/_scripts/generate_api_reference_links.py
@@ -213,41 +213,6 @@ def _get_imports(
return imports
-class ImportPreprocessor(Preprocessor):
- """A preprocessor to replace imports in each Python code cell with links to their
- documentation and append the import info in a comment."""
-
- def preprocess(self, nb, resources):
- self.all_imports = []
- file_name = os.path.basename(resources.get("metadata", {}).get("name", ""))
- _DOC_TITLE = _get_doc_title(nb.cells[0].source, file_name)
-
- cells = []
- for cell in nb.cells:
- if cell.cell_type == "code":
- cells.append(cell)
- imports = _get_imports(
- cell.source, _DOC_TITLE, "langchain"
- ) + _get_imports(cell.source, _DOC_TITLE, "langgraph")
- if not imports:
- continue
-
- cells.append(
- nbformat.v4.new_markdown_cell(
- source=f"""
-
- """
- )
- )
- else:
- cells.append(cell)
- nb.cells = cells
- return nb, resources
-
-
def get_imports(code: str, doc_title: str) -> List[ImportInformation]:
"""Retrieve all import references from the given code for specified ecosystems.
diff --git a/docs/_scripts/notebook_convert.py b/docs/_scripts/notebook_convert.py
index 5db6d7d0c..4bb3131e8 100644
--- a/docs/_scripts/notebook_convert.py
+++ b/docs/_scripts/notebook_convert.py
@@ -107,7 +107,6 @@ exporter = MarkdownExporter(
preprocessors=[
EscapePreprocessor,
ExtractAttachmentsPreprocessor,
- ImportPreprocessor,
],
template_name="mdoutput",
extra_template_basedirs=[
diff --git a/docs/_scripts/notebook_hooks.py b/docs/_scripts/notebook_hooks.py
index 8d3649bb1..9eb161c8f 100644
--- a/docs/_scripts/notebook_hooks.py
+++ b/docs/_scripts/notebook_hooks.py
@@ -112,11 +112,9 @@ def on_page_markdown(markdown: str, page: Page, **kwargs: Dict[str, Any]):
if page.file.src_path.endswith(".ipynb"):
logger.info("Processing Jupyter notebook: %s", page.file.src_path)
markdown = convert_notebook(page.file.abs_src_path)
- else:
- # Append API reference links to code blocks
- # This logic is already applied for notebooks in `convert_notebook`.
- # We add it here to apply it to regular markdown files.
- markdown = update_markdown_with_imports(markdown)
+
+ # Append API reference links to code blocks
+ markdown = update_markdown_with_imports(markdown)
# Apply highlight comments to code blocks
markdown = _highlight_code_blocks(markdown)
return markdown