{# Live Markdown Editor (text-forge). Provides an "Edit" button on content pages that opens a split-pane editor with live preview using Pyodide + PyMdown Extensions. Config (mkdocs.yml -> plugins -> text-forge): text-forge: editor_enabled: true # Show editor button on content pages #} {% if text_forge_editor_enabled and page and page.content %} {% set editor_config = { 'sourceUrl': (config.repo_url ~ '/' ~ config.edit_uri ~ page.file.src_path)|e|replace('/blob/', '/raw/'), 'filePath': page.file.src_path|e, 'fileName': page.file.name|e, 'sourceContent': (page._text_forge_original_source | default(page.markdown)), 'markdownExtensions': config.markdown_extensions, 'extensionConfigs': config.mdx_configs, 'github': { 'owner': config.repo_name.split('/')[0]|e, 'repo': config.repo_name.split('/')[1]|e, 'branch': config.remote_branch|default('main')|e, 'apiUrl': 'https://api.github.com' } if config.repo_name else None } %} {% endif %}