@@ -239,6 +239,12 @@ def classify(m):
239239 return re .sub (r'<blockquote>\s*(.*?)\s*</blockquote>' , classify , html_text , flags = re .DOTALL )
240240
241241
242+ # ── Tag formatting ───────────────────────────────────────────────────────────
243+
244+ def format_ext_tags (html_text ):
245+ """Replace [ext] with a styled badge span."""
246+ return html_text .replace ('[ext]' , '<span class="ext-tag">ext</span>' )
247+
242248# ── HTML template ────────────────────────────────────────────────────────────
243249
244250def _section_key (name ):
@@ -265,10 +271,12 @@ def build_sidebar_html(current_slug):
265271 ' <ul class="sidebar-links">' ,
266272 )
267273 )
274+ is_ext = section_name == "Extensions"
268275 for slug , label in pages :
269276 active = ' class="active"' if slug == current_slug else ''
270277 href = "index.html" if slug == "index" else f"{ slug } .html"
271- parts .append (f' <li><a href="{ href } "{ active } >{ label } </a></li>' )
278+ display = f'{ label } <span class="ext-tag">ext</span>' if is_ext else label
279+ parts .append (f' <li><a href="{ href } "{ active } >{ display } </a></li>' )
272280
273281 parts .extend ((' </ul>' , '</div>' ))
274282 return "\n " .join (parts )
@@ -389,8 +397,8 @@ def build_page(slug):
389397 meta , body_md = parse_frontmatter (raw )
390398 title = meta .get ("title" , slug .capitalize ())
391399 subtitle = meta .get ("subtitle" , "" )
392- page_title = meta .get ("page_title" , title )
393- og_title = meta .get ("og_title" , title )
400+ page_title = meta .get ("page_title" , title ). replace ( "[ext]" , "" ). strip ()
401+ og_title = meta .get ("og_title" , title ). replace ( "[ext]" , "" ). strip ()
394402
395403 # Convert markdown to HTML
396404 body_html , toc_tokens = convert_markdown (body_md )
@@ -399,6 +407,7 @@ def build_page(slug):
399407 body_html = rewrite_md_links (body_html )
400408 body_html = highlight_code_blocks (body_html )
401409 body_html = process_blockquotes (body_html )
410+ body_html = format_ext_tags (body_html )
402411
403412 # Build subtitle HTML
404413 subtitle_html = f'<p class="subtitle">{ subtitle } </p>' if subtitle else ""
0 commit comments