Spaces:
Running
Running
Commit
·
d3c5e15
1
Parent(s):
055a113
breadcrumbs yum
Browse files- .gitignore +1 -0
- app.py +61 -2
.gitignore
CHANGED
@@ -1 +1,2 @@
|
|
1 |
venv/
|
|
|
|
1 |
venv/
|
2 |
+
__pycache__/
|
app.py
CHANGED
@@ -8,11 +8,26 @@ app = Flask(__name__)
|
|
8 |
BASE_URL = "https://raw.githubusercontent.com/huggingface/xet-core/refs/heads/assaf/spec/spec/"
|
9 |
ENTRY_FILE = "spec.md"
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
CSS_STYLE = """
|
12 |
<style>
|
13 |
body {
|
14 |
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
15 |
-
max-width:
|
16 |
margin: 2rem auto;
|
17 |
padding: 1rem;
|
18 |
line-height: 1.6;
|
@@ -42,6 +57,39 @@ CSS_STYLE = """
|
|
42 |
padding: 0.2rem 0.4rem;
|
43 |
border-radius: 4px;
|
44 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
</style>
|
46 |
"""
|
47 |
|
@@ -53,6 +101,11 @@ HTML_TEMPLATE = """<!DOCTYPE html>
|
|
53 |
{css}
|
54 |
</head>
|
55 |
<body>
|
|
|
|
|
|
|
|
|
|
|
56 |
{content}
|
57 |
</body>
|
58 |
</html>
|
@@ -76,7 +129,13 @@ def fetch_and_render_md(path: str = ENTRY_FILE) -> str:
|
|
76 |
|
77 |
# Convert to HTML
|
78 |
html_content = markdown.markdown(md_text, extensions=["extra", "toc"])
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
|
82 |
@app.route("/")
|
|
|
8 |
BASE_URL = "https://raw.githubusercontent.com/huggingface/xet-core/refs/heads/assaf/spec/spec/"
|
9 |
ENTRY_FILE = "spec.md"
|
10 |
|
11 |
+
# header links filenames
|
12 |
+
HEADER_FILES = [
|
13 |
+
"spec.md",
|
14 |
+
"upload_protocol.md",
|
15 |
+
"download_protocol.md",
|
16 |
+
"api.md",
|
17 |
+
"auth.md",
|
18 |
+
"chunking.md",
|
19 |
+
"hashing.md",
|
20 |
+
"deduplication.md",
|
21 |
+
"file_reconstruction.md",
|
22 |
+
"xorb.md",
|
23 |
+
"shard.md"
|
24 |
+
]
|
25 |
+
|
26 |
CSS_STYLE = """
|
27 |
<style>
|
28 |
body {
|
29 |
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
30 |
+
max-width: 1000px;
|
31 |
margin: 2rem auto;
|
32 |
padding: 1rem;
|
33 |
line-height: 1.6;
|
|
|
57 |
padding: 0.2rem 0.4rem;
|
58 |
border-radius: 4px;
|
59 |
}
|
60 |
+
.header {
|
61 |
+
margin-top: 3rem;
|
62 |
+
padding: 2rem 0 1rem 0;
|
63 |
+
border-top: 1px solid #ddd;
|
64 |
+
background: #f8f8f8;
|
65 |
+
}
|
66 |
+
.header-links {
|
67 |
+
display: flex;
|
68 |
+
flex-wrap: wrap;
|
69 |
+
gap: 1rem;
|
70 |
+
justify-content: center;
|
71 |
+
list-style: none;
|
72 |
+
margin: 0;
|
73 |
+
padding: 0;
|
74 |
+
}
|
75 |
+
.header-links li {
|
76 |
+
margin: 0;
|
77 |
+
}
|
78 |
+
.header-links a {
|
79 |
+
padding: 0.5rem 1rem;
|
80 |
+
background: #fff;
|
81 |
+
border: 1px solid #ddd;
|
82 |
+
border-radius: 6px;
|
83 |
+
color: #333;
|
84 |
+
font-size: 0.9rem;
|
85 |
+
transition: all 0.2s ease;
|
86 |
+
}
|
87 |
+
.header-links a:hover {
|
88 |
+
background: #007acc;
|
89 |
+
color: white;
|
90 |
+
text-decoration: none;
|
91 |
+
border-color: #007acc;
|
92 |
+
}
|
93 |
</style>
|
94 |
"""
|
95 |
|
|
|
101 |
{css}
|
102 |
</head>
|
103 |
<body>
|
104 |
+
<header class="header">
|
105 |
+
<ul class="header-links">
|
106 |
+
{header_links}
|
107 |
+
</ul>
|
108 |
+
</header>
|
109 |
{content}
|
110 |
</body>
|
111 |
</html>
|
|
|
129 |
|
130 |
# Convert to HTML
|
131 |
html_content = markdown.markdown(md_text, extensions=["extra", "toc"])
|
132 |
+
|
133 |
+
# Generate header links
|
134 |
+
header_links = ""
|
135 |
+
for filename in HEADER_FILES:
|
136 |
+
header_links += f'<li><a href="/view/{filename}">{filename}</a></li>\n '
|
137 |
+
|
138 |
+
return HTML_TEMPLATE.format(css=CSS_STYLE, content=html_content, header_links=header_links)
|
139 |
|
140 |
|
141 |
@app.route("/")
|