Xwiki Import Markdown -

class XWikiMarkdownImporter: def (self, url, username, password): self.base_url = url.rstrip('/') self.auth = HTTPBasicAuth(username, password) self.session = requests.Session() self.session.auth = self.auth

# Read markdown content with open(file_path, 'r', encoding='utf-8') as f: markdown_content = f.read() xwiki import markdown

# Import single file importer.import_file("document.md", space="Main") class XWikiMarkdownImporter: def (self

# Lists markdown_text = re.sub(r'^\- (.*?)$', r'* \1', markdown_text, flags=re.M) markdown_text = re.sub(r'^\* (.*?)$', r'* \1', markdown_text, flags=re.M) markdown_text = re.sub(r'^\+ (.*?)$', r'** \1', markdown_text, flags=re.M) flags=re.M) markdown_text = re.sub(r'^\* (.*?)$'

# Wrap in markdown macro wiki_content = f"{{{{markdown}}}}\n{markdown_content}\n{{{{/markdown}}}}"