Skip to content

Commit 9d66826

Browse files
Merge branch 'master' into upgrade-docsy
2 parents d5e3833 + 19fadf8 commit 9d66826

File tree

4 files changed

+175
-2
lines changed

4 files changed

+175
-2
lines changed

build-digest.py

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
#!/usr/bin/env python3
2+
"""Build a single-file markdown digest from a Hugo content directory.
3+
4+
Usage: python3 build-digest.py <content_dir> <output_file> <title>
5+
6+
Excludes: release notes, helm chart values, images, videos, HTML comments, Hugo shortcodes.
7+
"""
8+
9+
import sys
10+
import os
11+
import re
12+
from datetime import datetime, timezone
13+
from pathlib import Path
14+
15+
16+
def strip_front_matter(text: str) -> str:
17+
"""Remove YAML front matter delimited by ---."""
18+
if text.startswith("---"):
19+
end = text.find("---", 3)
20+
if end != -1:
21+
return text[end + 3:].lstrip("\n")
22+
return text
23+
24+
25+
def extract_title(text: str) -> str | None:
26+
"""Extract title from YAML front matter."""
27+
if not text.startswith("---"):
28+
return None
29+
end = text.find("---", 3)
30+
if end == -1:
31+
return None
32+
fm = text[3:end]
33+
for line in fm.split("\n"):
34+
line = line.strip()
35+
if line.lower().startswith("title:"):
36+
title = line[6:].strip()
37+
# Remove quotes
38+
if (title.startswith('"') and title.endswith('"')) or \
39+
(title.startswith("'") and title.endswith("'")):
40+
title = title[1:-1]
41+
return title
42+
return None
43+
44+
45+
def clean_body(body: str) -> str:
46+
"""Remove images, videos, shortcodes, HTML, and comments from markdown body."""
47+
# Remove HTML comments (multiline)
48+
body = re.sub(r'<!--.*?-->', '', body, flags=re.DOTALL)
49+
50+
# Remove style blocks
51+
body = re.sub(r'<style>.*?</style>', '', body, flags=re.DOTALL)
52+
53+
# Remove script blocks
54+
body = re.sub(r'<script>.*?</script>', '', body, flags=re.DOTALL)
55+
56+
lines = body.split('\n')
57+
cleaned = []
58+
for line in lines:
59+
# Skip image references (markdown images with image/video extensions)
60+
if re.match(r'^\s*!\[.*?\]\(.*?\.(png|jpg|jpeg|gif|svg|webp|mp4|webm|mov|avi).*?\)\s*$', line, re.IGNORECASE):
61+
continue
62+
63+
# Skip lines that are entirely a Hugo shortcode call
64+
if re.match(r'^\s*\{\{[<%<\*]', line):
65+
continue
66+
67+
# Remove any inline Hugo shortcode tags: {{< ... >}}, {{% ... %}}, {{</* ... */>}}
68+
line = re.sub(r'\{\{[<%<\*]+.*?[%>\*>]+\}\}', '', line)
69+
# Catch {{ ... }} template calls
70+
line = re.sub(r'\{\{.*?\}\}', '', line)
71+
72+
# Remove remaining HTML tags but keep content
73+
line = re.sub(r'<[^>]+>', '', line)
74+
75+
cleaned.append(line)
76+
77+
body = '\n'.join(cleaned)
78+
79+
# Collapse 3+ consecutive blank lines to 2
80+
body = re.sub(r'\n{3,}', '\n\n', body)
81+
82+
return body.strip()
83+
84+
85+
def title_from_path(filepath: Path) -> str:
86+
"""Derive a title from the file path."""
87+
name = filepath.stem
88+
if name in ('_index', 'index'):
89+
name = filepath.parent.name
90+
# Convert hyphens/underscores to spaces, title case
91+
return name.replace('-', ' ').replace('_', ' ').title()
92+
93+
94+
def heading_depth(relpath: Path, is_index: bool) -> int:
95+
"""Calculate heading depth from relative path depth."""
96+
parts = list(relpath.parts)
97+
depth = len(parts)
98+
if is_index:
99+
depth -= 1
100+
# Clamp between 2 and 4
101+
return max(2, min(4, depth))
102+
103+
104+
def main():
105+
if len(sys.argv) != 4:
106+
print(f"Usage: {sys.argv[0]} <content_dir> <output_file> <title>")
107+
sys.exit(1)
108+
109+
content_dir = Path(sys.argv[1])
110+
output_file = Path(sys.argv[2])
111+
doc_title = sys.argv[3]
112+
113+
# Collect all markdown files, excluding releases and helm-chart-values
114+
md_files = []
115+
for f in sorted(content_dir.rglob("*.md")):
116+
rel = f.relative_to(content_dir)
117+
parts = rel.parts
118+
119+
# Exclude release notes
120+
if 'releases' in parts:
121+
continue
122+
# Exclude helm chart values
123+
if f.name == 'helm-chart-values.md':
124+
continue
125+
126+
md_files.append(f)
127+
128+
now = datetime.now(timezone.utc).strftime("%Y-%m-%d")
129+
out_lines = [
130+
f"# {doc_title}\n",
131+
f"> Auto-generated documentation digest. Source: `{content_dir}` ",
132+
f"> Generated: {now}\n",
133+
"---\n",
134+
]
135+
136+
file_count = 0
137+
for filepath in md_files:
138+
raw = filepath.read_text(encoding='utf-8', errors='replace')
139+
140+
title = extract_title(raw) or title_from_path(filepath)
141+
body = strip_front_matter(raw)
142+
body = clean_body(body)
143+
144+
# Skip empty files
145+
if not body.strip():
146+
continue
147+
148+
rel = filepath.relative_to(content_dir)
149+
is_index = filepath.stem in ('_index', 'index')
150+
depth = heading_depth(rel, is_index)
151+
heading = '#' * depth
152+
153+
out_lines.append(f"\n{heading} {title}\n")
154+
out_lines.append(body)
155+
out_lines.append("\n\n---\n")
156+
file_count += 1
157+
158+
output_file.write_text('\n'.join(out_lines), encoding='utf-8')
159+
total_lines = sum(1 for _ in output_file.read_text().split('\n'))
160+
print(f"Done: {total_lines} lines, {file_count} documents written to {output_file}")
161+
162+
163+
if __name__ == '__main__':
164+
main()

build/meshery-extensions.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.9.2-1
1+
v1.0.0-1
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: v1.0.0-1
3+
date: 2026-03-25T01:23:06Z
4+
tag: v1.0.0-1
5+
prerelease: false
6+
toc_hide: true
7+
---
8+
9+
[Meshery v1.0 is here!](https://meshery.io/blog/meshery-v1.0-general-availability/)

static/data/csv/pricing-list.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html lang="en"><head><meta name="description" content="Web word processing, presentations and spreadsheets"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"><link rel="shortcut icon" href="//docs.google.com/favicon.ico"><title>Page Not Found</title><meta name="referrer" content="origin"><link href="//fonts.googleapis.com/css?family=Product+Sans" rel="stylesheet" type="text/css" nonce="iLgIKvIZq2Q8pTdDtvs1cw"><style nonce="iLgIKvIZq2Q8pTdDtvs1cw">#drive-logo{margin:18px 0;position:absolute;white-space:nowrap}.docs-drivelogo-img{background-image:url(//ssl.gstatic.com/images/branding/googlelogo/1x/googlelogo_color_116x41dp.png);-webkit-background-size:116px 41px;background-size:116px 41px;display:inline-block;height:41px;vertical-align:bottom;width:116px}.docs-drivelogo-text{color:#000;display:inline-block;opacity:.54;text-decoration:none;font-family:"Product Sans",Arial,Helvetica,sans-serif;font-size:32px;text-rendering:optimizeLegibility;position:relative;top:-6px;left:-7px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (-webkit-min-device-pixel-ratio:1.5),(min-resolution:144dpi){.docs-drivelogo-img{background-image:url(//ssl.gstatic.com/images/branding/googlelogo/2x/googlelogo_color_116x41dp.png)}}.goog-inline-block{position:relative;display:-moz-inline-box;display:inline-block}* html .goog-inline-block{display:inline}*:first-child+html .goog-inline-block{display:inline}sentinel{}</style><style type="text/css" nonce="iLgIKvIZq2Q8pTdDtvs1cw">body {background-color: #fff; font-family: Arial,sans-serif; font-size: 13px; margin: 0; padding: 0;}a, a:link, a:visited {color: #112ABB;}</style><style type="text/css" nonce="iLgIKvIZq2Q8pTdDtvs1cw">.errorMessage {font-size: 12pt; font-weight: bold; line-height: 150%;}</style></head><body><div id="outerContainer"><div id="innerContainer"><div style="position: absolute; top: -80px;"><div style="margin: 18px 0; position: absolute; white-space: nowrap;"><a href="//support.google.com/docs/"><img height="35px" src="//ssl.gstatic.com/docs/common/product/spreadsheets_lockup2.png" alt="Google logo"/></a></div></div><div align="center"><p class="errorMessage" style="padding-top: 50px">Sorry, unable to open the file at this time.</p><p> Please check the address and try again. </p><div style="background: #F0F6FF; border: 1px solid black; margin-top: 35px; padding: 10px 125px; width: 300px;"><p><strong>Get stuff done with Google Drive</strong></p><p>Apps in Google Drive make it easy to create, store and share online documents, spreadsheets, presentations and more.</p><p>Learn more at <a href="https://drive.google.com/start/apps">drive.google.com/start/apps</a>.</p></div></div></div></div></body><style nonce="iLgIKvIZq2Q8pTdDtvs1cw">html {height: 100%; overflow: auto;}body {height: 100%; overflow: auto;}#outerContainer {margin: auto; max-width: 750px;}#innerContainer {margin-bottom: 20px; margin-left: 40px; margin-right: 40px; margin-top: 80px; position: relative;}</style></html>
1+
<!DOCTYPE html><html lang="en"><head><meta name="description" content="Web word processing, presentations and spreadsheets"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"><link rel="shortcut icon" href="//docs.google.com/favicon.ico"><title>Page Not Found</title><meta name="referrer" content="origin"><link href="//fonts.googleapis.com/css?family=Product+Sans" rel="stylesheet" type="text/css" nonce="SdicnatqeC2CO6io6OFUzA"><style nonce="SdicnatqeC2CO6io6OFUzA">#drive-logo{margin:18px 0;position:absolute;white-space:nowrap}.docs-drivelogo-img{background-image:url(//ssl.gstatic.com/images/branding/googlelogo/1x/googlelogo_color_116x41dp.png);-webkit-background-size:116px 41px;background-size:116px 41px;display:inline-block;height:41px;vertical-align:bottom;width:116px}.docs-drivelogo-text{color:#000;display:inline-block;opacity:.54;text-decoration:none;font-family:"Product Sans",Arial,Helvetica,sans-serif;font-size:32px;text-rendering:optimizeLegibility;position:relative;top:-6px;left:-7px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (-webkit-min-device-pixel-ratio:1.5),(min-resolution:144dpi){.docs-drivelogo-img{background-image:url(//ssl.gstatic.com/images/branding/googlelogo/2x/googlelogo_color_116x41dp.png)}}.goog-inline-block{position:relative;display:-moz-inline-box;display:inline-block}* html .goog-inline-block{display:inline}*:first-child+html .goog-inline-block{display:inline}sentinel{}</style><style type="text/css" nonce="SdicnatqeC2CO6io6OFUzA">body {background-color: #fff; font-family: Arial,sans-serif; font-size: 13px; margin: 0; padding: 0;}a, a:link, a:visited {color: #112ABB;}</style><style type="text/css" nonce="SdicnatqeC2CO6io6OFUzA">.errorMessage {font-size: 12pt; font-weight: bold; line-height: 150%;}</style></head><body><div id="outerContainer"><div id="innerContainer"><div style="position: absolute; top: -80px;"><div style="margin: 18px 0; position: absolute; white-space: nowrap;"><a href="//support.google.com/docs/"><img height="35px" src="//ssl.gstatic.com/docs/common/product/spreadsheets_lockup2.png" alt="Google logo"/></a></div></div><div align="center"><p class="errorMessage" style="padding-top: 50px">Sorry, unable to open the file at this time.</p><p> Please check the address and try again. </p><div style="background: #F0F6FF; border: 1px solid black; margin-top: 35px; padding: 10px 125px; width: 300px;"><p><strong>Get stuff done with Google Drive</strong></p><p>Apps in Google Drive make it easy to create, store and share online documents, spreadsheets, presentations and more.</p><p>Learn more at <a href="https://drive.google.com/start/apps">drive.google.com/start/apps</a>.</p></div></div></div></div></body><style nonce="SdicnatqeC2CO6io6OFUzA">html {height: 100%; overflow: auto;}body {height: 100%; overflow: auto;}#outerContainer {margin: auto; max-width: 750px;}#innerContainer {margin-bottom: 20px; margin-left: 40px; margin-right: 40px; margin-top: 80px; position: relative;}</style></html>

0 commit comments

Comments
 (0)