Skip to content

markdownbackend

Class info

Classes

Name Children Inherits
MarkdownBackend
mkdocs_mknodes.backends.markdownbackend

    🛈 DocStrings

    MarkdownBackend

    Bases: BuildBackend

    Source code in mkdocs_mknodes/backends/markdownbackend.py
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    class MarkdownBackend(buildbackend.BuildBackend):
        def __init__(
            self,
            directory: str | os.PathLike[str] | None = None,
            extension: str = ".md",
        ):
            """Constructor.
    
            Args:
                directory: build directory
                extension: Extention of files to generate
            """
            self.extension = extension
            self.directory = upath.UPath(directory or ".")
            self._files: dict[str, str | bytes] = {}
    
        def write_files(self, files: dict[str, str | bytes]):
            for k, v in files.items():
                logger.debug("%s: Writing file to %r", type(self).__name__, str(k))
                target_path = (self.directory / k).with_suffix(self.extension)
                self._files[target_path.as_posix()] = v
                pathhelpers.write_file(v, target_path)
    

    __init__

    __init__(directory: str | PathLike[str] | None = None, extension: str = '.md')
    

    Constructor.

    Parameters:

    Name Type Description Default
    directory str | PathLike[str] | None

    build directory

    None
    extension str

    Extention of files to generate

    '.md'
    Source code in mkdocs_mknodes/backends/markdownbackend.py
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    def __init__(
        self,
        directory: str | os.PathLike[str] | None = None,
        extension: str = ".md",
    ):
        """Constructor.
    
        Args:
            directory: build directory
            extension: Extention of files to generate
        """
        self.extension = extension
        self.directory = upath.UPath(directory or ".")
        self._files: dict[str, str | bytes] = {}