INNER CODE UNIT · Python

render_file

fralau/mkdocs-macros-plugin · mkdocs_macros/context.py:312

    def render_file(filename):
        """
        Render an external page (filename) containing jinja2 code
        Do not declare as macro, as this is pointless.
        """
        SOURCE_FILE = os.path.join(SOURCE_DIR, filename)
        with open(SOURCE_FILE) as f:
            s = f.read()
        # now we need to render the jinja2 directives,
        # always rendering (to skip reasoning about page header)
        return env.render(s, force_rendering=True)

    @env.macro
    def context(obj:dict=None):
        """
        *Default Mkdocs-Macro*: List an object
        (by default the variables)
        """

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…