mirror of
https://github.com/langgenius/dify.git
synced 2026-05-26 04:00:39 -04:00
Co-authored-by: Copilot <copilot@github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
17 lines
552 B
Python
17 lines
552 B
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from mkdocs.config.defaults import MkDocsConfig
|
|
from mkdocs.structure.files import Files
|
|
from mkdocs.structure.pages import Page
|
|
from snippets import inject_snippets
|
|
|
|
DOCS_ROOT = Path(__file__).resolve().parent.parent
|
|
|
|
|
|
def on_page_markdown(markdown: str, page: Page, config: MkDocsConfig, files: Files) -> str:
|
|
"""Inject repository snippets before MkDocs renders Markdown."""
|
|
relative_path = DOCS_ROOT / page.file.src_uri
|
|
return inject_snippets(markdown, relative_path.parent)
|