Skip to content
5 changes: 4 additions & 1 deletion docs/advanced_onboarding/how-reflex-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ The diagram below provides a detailed overview of how a Reflex app works. We'll

```python eval
rx.el.a(
rx.image(src="https://web.reflex-assets.dev/other/architecture.webp"),
rx.image(
src="https://web.reflex-assets.dev/other/architecture.webp",
alt="Reflex app architecture diagram",
),
href="https://web.reflex-assets.dev/other/architecture.webp",
target="_blank",
)
Expand Down
1 change: 1 addition & 0 deletions docs/ai_builder/app_lifecycle/copy_app.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def render_image():
return rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/app_lifecycle/copy_light.avif",
alt="Copying an app in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
1 change: 1 addition & 0 deletions docs/ai_builder/app_lifecycle/deploy_app.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def render_image():
return rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/app_lifecycle/deploy_light.avif",
alt="Deploying an app in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
1 change: 1 addition & 0 deletions docs/ai_builder/app_lifecycle/download_app.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def render_image():
return rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/app_lifecycle/download_light.avif",
alt="Downloading an app in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
1 change: 1 addition & 0 deletions docs/ai_builder/app_lifecycle/fork_app.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import reflex as rx
rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/overview/fork_template_light.avif",
alt="Forking an app in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
1 change: 1 addition & 0 deletions docs/ai_builder/app_lifecycle/general.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def render_image():
return rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/app_lifecycle/general_light.avif",
alt="General app settings in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
1 change: 1 addition & 0 deletions docs/ai_builder/app_lifecycle/share_app.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def render_image():
return rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/app_lifecycle/share_light.avif",
alt="Sharing an app in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
1 change: 1 addition & 0 deletions docs/ai_builder/features/automated_testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ rx.el.div(
"https://web.reflex-assets.dev/ai_builder/features/test_light.webp",
"https://web.reflex-assets.dev/ai_builder/features/test_dark.webp",
),
alt="Automated testing in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
2 changes: 2 additions & 0 deletions docs/ai_builder/features/connect_to_github.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The Github integration is important to make sure that you don't lose your progre
rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/connecting_to_github.avif",
alt="Connecting a Reflex AI Builder app to GitHub",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand All @@ -36,6 +37,7 @@ The commit history is a great way to see the changes that you have made to your
rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/github_commit_history.avif",
alt="GitHub commit history for a Reflex AI Builder app",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
2 changes: 2 additions & 0 deletions docs/ai_builder/features/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ rx.el.div(
"https://web.reflex-assets.dev/ai_builder/features/style_light.webp",
"https://web.reflex-assets.dev/ai_builder/features/style_dark.webp",
),
alt="Custom styling options in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down Expand Up @@ -51,6 +52,7 @@ rx.el.div(
"https://web.reflex-assets.dev/ai_builder/features/theme_light.webp",
"https://web.reflex-assets.dev/ai_builder/features/theme_dark.webp",
),
alt="Theme customization in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
1 change: 1 addition & 0 deletions docs/ai_builder/features/editor_modes.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def render_image():
return rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/features/diff_light.avif",
alt="Reflex AI Builder editor diff view",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
1 change: 1 addition & 0 deletions docs/ai_builder/features/image_as_prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Below is an image showing how to upload an image to the AI Builder, you can clic
rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/image_upload.avif",
alt="Using an image as a prompt in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
2 changes: 2 additions & 0 deletions docs/ai_builder/features/installing_external_packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Enter the name of the package you want to install in the chat interface. The AI
rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/external_packages_input.avif",
alt="Installing external packages via the chat interface",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand All @@ -35,6 +36,7 @@ Add the package to the `requirements.txt` file and then save the app. This will
rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/external_packages_requirements.avif",
alt="Installing external packages via requirements.txt",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
1 change: 1 addition & 0 deletions docs/ai_builder/features/integration_shortcut.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ rx.el.div(
"https://web.reflex-assets.dev/ai_builder/features/shortcut_light.webp",
"https://web.reflex-assets.dev/ai_builder/features/shortcut_dark.webp",
),
alt="Integrations shortcut in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
1 change: 1 addition & 0 deletions docs/ai_builder/features/knowledge.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def render_image():
return rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/features/knowledge_light.avif",
alt="Reflex AI Builder knowledge section",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
1 change: 1 addition & 0 deletions docs/ai_builder/features/restore_checkpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import reflex as rx
rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/features/restore_light.avif",
alt="Restoring a checkpoint in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
2 changes: 2 additions & 0 deletions docs/ai_builder/features/secrets.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def render_image():
return rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/features/secrets_light.avif",
alt="Adding secrets in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down Expand Up @@ -49,6 +50,7 @@ import reflex as rx
rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/features/secret_bulk_light.avif",
alt="Adding secrets in bulk with the raw editor",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
2 changes: 2 additions & 0 deletions docs/ai_builder/figma.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Figma Integration

Integration Coming Soon!
1 change: 1 addition & 0 deletions docs/ai_builder/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import reflex as rx
rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/add_images_to_assets.avif",
alt="Uploading an image to app assets in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
2 changes: 2 additions & 0 deletions docs/ai_builder/overview/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import reflex as rx
rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/overview/templates_light.avif",
alt="Reflex AI Builder templates gallery",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand All @@ -25,6 +26,7 @@ To use a template, simply click the template and then in the bottom right corner
rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/overview/fork_template_light.avif",
alt="Forking a template in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
4 changes: 4 additions & 0 deletions docs/ai_builder/overview/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import reflex as rx
rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/overview/tutorial_1_light.avif",
alt="Creating a dashboard in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand All @@ -55,6 +56,7 @@ Your dashboard now becomes much more useful with real-time filtering. Users can
rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/overview/tutorial_2_light.avif",
alt="Adding interactive filtering in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand All @@ -79,6 +81,7 @@ Your app now has full CRUD capability for employee records. The modal form provi
rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/overview/tutorial_3_light.avif",
alt="Enabling data entry in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand All @@ -103,6 +106,7 @@ Your app now has proper navigation between the dashboard and chat functionality.
rx.el.div(
rx.image(
src="https://web.reflex-assets.dev/ai_builder/overview/tutorial_4_light.avif",
alt="Building a multi-page app in Reflex AI Builder",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
2 changes: 2 additions & 0 deletions docs/ai_builder/overview/what_is_reflex_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def _docs_app_section_features_small_screen(feature: dict):
return rx.el.div(
rx.image(
src=feature["img"],
alt="Reflex Build feature illustration",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down Expand Up @@ -179,6 +180,7 @@ def _docs_app_sections():
rx.el.div(
rx.image(
src=features_data[0]["img"],
alt="Reflex Build feature illustration",
class_name="rounded-md h-auto",
border=f"0.81px solid {rx.color('slate', 5)}",
),
Expand Down
91 changes: 88 additions & 3 deletions docs/app/reflex_docs/pages/docs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import re
from collections import defaultdict, namedtuple
from pathlib import Path
from types import SimpleNamespace
Expand Down Expand Up @@ -194,13 +195,85 @@ def resolve_doc_route(doc: str, title: str) -> ResolvedDoc | None:
return ResolvedDoc(route=route, display_title=display_title, category=category)


def make_docpage(route: str, title: str, doc_virtual: str, render_fn):
def extract_doc_description(
markdown_text: str | None,
metadata: dict | None = None,
max_len: int = 155,
) -> str | None:
"""Derive a meta description for a documentation page.

Prefers an explicit frontmatter ``meta_description``/``description``;
otherwise extracts the first prose paragraph of the markdown body. Returns
None if nothing usable is found (callers fall back to a title-based default).

Args:
markdown_text: The raw markdown body of the doc.
metadata: Parsed frontmatter, if any.
max_len: Soft maximum length for the description.

Returns:
A cleaned, truncated description, or None.
"""
if metadata:
for key in ("meta_description", "description"):
value = metadata.get(key)
if isinstance(value, str) and value.strip():
return value.strip()
if not markdown_text:
return None
try:
# Drop fenced code blocks (```...```), including ```python exec blocks.
text = re.sub(r"```.*?```", "", markdown_text, flags=re.DOTALL)
para_lines: list[str] = []
skip_prefixes = (
"#",
">",
"---",
"import ",
"from ",
"|",
"<",
"- ",
"* ",
"rx.",
"```",
*(f"{n}." for n in range(1, 10)),
)
for raw in text.splitlines():
line = raw.strip()
if not line:
if para_lines:
break
continue
if line.startswith(skip_prefixes):
continue
para_lines.append(line)
if not para_lines:
return None
para = " ".join(para_lines)
para = re.sub(r"!\[[^\]]*\]\([^)]*\)", "", para) # images
para = re.sub(r"\[([^\]]+)\]\([^)]*\)", r"\1", para) # links -> text
para = re.sub(r"[*_`]+", "", para) # emphasis / inline code
para = re.sub(r"^~?\s*\d+\s*min\s*(?:read)?\s*·?\s*", "", para) # reading time
para = re.sub(r"\s+", " ", para).strip()
if len(para) < 20:
return None
if len(para) > max_len:
para = para[:max_len].rsplit(" ", 1)[0].rstrip(",.;:") + "…"
return para or None
except Exception:
return None


def make_docpage(
route: str, title: str, doc_virtual: str, render_fn, description: str | None = None
):
"""Wrap a render function as a docpage, setting module metadata."""
doc_path = Path(doc_virtual)
render_fn.__module__ = ".".join(doc_path.parts[:-1])
Comment thread
Alek99 marked this conversation as resolved.
render_fn.__name__ = doc_path.stem
render_fn.__qualname__ = doc_path.stem
return docpage(set_path=route, t=title)(render_fn)
return docpage(set_path=route, t=title, description=description)(render_fn)


def handle_library_doc(
Expand Down Expand Up @@ -250,7 +323,19 @@ def comp(_actual=actual_path, _virtual=virtual_doc):
body = rx.fragment(body, faq_script)
return ((toc, doc_content), body)

return make_docpage(resolved.route, resolved.display_title, virtual_doc, comp)
try:
description = extract_doc_description(
Path(actual_path).read_text(encoding="utf-8")
)
except Exception:
description = None
return make_docpage(
resolved.route,
resolved.display_title,
virtual_doc,
comp,
description=description,
)


# Build doc_markdown_sources mapping
Expand Down
2 changes: 1 addition & 1 deletion docs/app/reflex_docs/pages/docs_landing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
title="Reflex Documentation - Build Web Apps in Pure Python",
description="Reflex documentation: tutorials, API reference, and guides for building full-stack Python web apps. Get started in minutes.",
image=f"{REFLEX_ASSETS_CDN}previews/index_preview.webp",
url="https://reflex.dev/docs",
url="https://reflex.dev/docs/",
),
)
def docs_landing() -> rx.Component:
Expand Down
2 changes: 1 addition & 1 deletion docs/app/reflex_docs/pages/library_previews.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def create_previews(
@docpage(
right_sidebar=False,
set_path=f"/library{prefix.rstrip('/')}/" + path.strip("/") + "/",
page_title=component_category + " Library",
page_title=component_category + " Component Library · Reflex Docs",
)
def page() -> rx.Component:
from reflex_docs.templates.docpage.sidebar.sidebar_items import (
Expand Down
Loading
Loading