def render(self, config, files): """ Convert the Markdown source file to HTML as per the config. """ extensions = [_RelativePathExtension(self.file, files) ] + config['markdown_extensions'] md = MarkdownInterop(extensions=extensions, extension_configs=config['mdx_configs'] or {}) self.content = md.convert(self.markdown) self.toc = get_toc(getattr(md, 'toc_tokens', []))
def on_page_content(self, html: str, page: Page, config: MkDocsConfig, files: Files): if str(page.file.abs_src_path).endswith("ipynb") and not ( "markdown.extensions.md_in_html" in config["markdown_extensions"] or "markdown.extensions.extra" in config["markdown_extensions"]): log.debug(f"Re-rendering page with markdown in divs: {page}") extensions = [ _RelativePathExtension(page.file, files), "markdown.extensions.md_in_html", ] + config["markdown_extensions"] md = markdown.Markdown(extensions=extensions, extension_configs=config["mdx_configs"] or {}) html = md.convert(page.markdown) page.toc = get_toc(getattr(md, "toc_tokens", [])) return html