from flask import Flask, Response import requests import markdown import re app = Flask(__name__) BASE_URL = "https://raw.githubusercontent.com/huggingface/xet-core/refs/heads/assaf/spec/spec/" ENTRY_FILE = "spec.md" # header links filenames HEADER_FILES = [ "spec.md", "upload_protocol.md", "download_protocol.md", "api.md", "auth.md", "chunking.md", "hashing.md", "deduplication.md", "file_reconstruction.md", "xorb.md", "shard.md", "file_id.md" ] CSS_STYLE = """ """ HTML_TEMPLATE = """
Could not fetch {url}
" md_text = resp.text # Rewrite links: ../spec/foo.md → /view/foo.md md_text = re.sub( r"\.\./spec/([^\s)]+)", r"/view/\1", md_text ) # Convert to HTML html_content = markdown.markdown(md_text, extensions=["extra", "toc"]) # Generate header links header_links = "" for filename in HEADER_FILES: header_links += f'