diff --git a/mkdocs/structure/files.py b/mkdocs/structure/files.py index ceab53f989..c4f5155dc9 100644 --- a/mkdocs/structure/files.py +++ b/mkdocs/structure/files.py @@ -8,7 +8,7 @@ import shutil import warnings from pathlib import PurePath -from typing import TYPE_CHECKING, Callable, Iterable, Iterator, Sequence +from typing import TYPE_CHECKING, Callable, Iterable, Iterator, Sequence, Optional from urllib.parse import quote as urlquote import jinja2.environment @@ -193,6 +193,9 @@ class File: inclusion: InclusionLevel = InclusionLevel.UNDEFINED """Whether the file will be excluded from the built site.""" + generated_by: Optional[str] = None + """Indicator for plugin developers to track which system created the File.""" + @property def src_path(self) -> str: """Same as `src_uri` (and synchronized with it) but will use backslashes on Windows. Discouraged.""" @@ -222,6 +225,7 @@ def __init__( *, dest_uri: str | None = None, inclusion: InclusionLevel = InclusionLevel.UNDEFINED, + generated_by: Optional[str] = None, ) -> None: self.page = None self.src_path = path @@ -233,6 +237,7 @@ def __init__( self.abs_src_path = os.path.normpath(os.path.join(src_dir, self.src_uri)) self.abs_dest_path = os.path.normpath(os.path.join(dest_dir, self.dest_uri)) self.inclusion = inclusion + self.generated_by = generated_by def __eq__(self, other) -> bool: return (