Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e9b2b20
feat: Integrate MCP Apps into A2UI
dmandar Mar 2, 2026
77e96a2
chore: address PR review comments from gemini-code-assist
dmandar Mar 2, 2026
24cbc89
fix: Secure postMessage by capturing trusted host origin statefully
dmandar Mar 2, 2026
ab56d17
fix: fully secure MCP iframe initialization handshake with sandbox-in…
dmandar Mar 3, 2026
ad105f4
Merge branch 'main' into md-mcpuinew
dmandar Mar 3, 2026
e22bed7
style: run pyink auto-formatter to fix CI build
dmandar Mar 3, 2026
f5b2f41
fix(markdown-it): add missing package main and exports to resolve dow…
dmandar Mar 10, 2026
22859bf
fix(contact): resolve MCP iframe security issues and location double-…
dmandar Mar 10, 2026
0f43a44
revert(markdown-it): undo package exports change per PR review
dmandar Mar 10, 2026
63a3fd3
refactor(contact): address PR 748 review comments for McpApps integra…
dmandar Mar 10, 2026
04c0782
Merge main and resolve conflicts
dmandar Mar 11, 2026
c1b84a1
fix(lit): resolve compiler type errors and review comments
dmandar Mar 11, 2026
62bfcd3
chore: remove internal Google3 configs and properly align renderer sc…
dmandar Mar 11, 2026
22cfcec
Fix A2UI schema validator for incremental updates and update sample i…
dmandar Mar 12, 2026
6c53d20
Fix f-string curly brace escaping in prompt_builder.py
dmandar Mar 12, 2026
776fa4d
Fix LLM prompt for chart_node_click missing context to extract name
dmandar Mar 12, 2026
6bf4868
Address remaining PR #748 comments
dmandar Mar 13, 2026
7a544f8
Merge remote-tracking branch 'origin/main' into md-mcpuinew
dmandar Mar 13, 2026
441f282
Auto-format python code and add missing Apache license headers
dmandar Mar 13, 2026
b80812e
Merge main into md-mcpuinew
dmandar Mar 13, 2026
5f3a7db
chore: fix CI sample formatting, lit workspace, and revert agent_sdks…
dmandar Mar 13, 2026
57091eb
chore: fix NPM 401 error by regenerating package-lock.json via public…
dmandar Mar 13, 2026
dd1d846
chore: revert non-functional pyink formatting outside sample scope an…
dmandar Mar 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 29 additions & 22 deletions docs/scripts/convert_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import argparse

# Registry for bidirectional format conversion:
#
#
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we revert lines that are non-operational to reduce the change needed for review to be limited to operational changes?

# Key: The MkDocs admonition type (the target for '!!! type' syntax).
# Value:
# Value:
# - emoji: Used for mapping GitHub-style emoji quotes (> ⚠️) to MkDocs.
# - tag: Reserved for mapping official GitHub Alert syntax (> [!WARNING]).
MAPPING = {
Expand All @@ -28,17 +28,19 @@
"info": {"emoji": "ℹ️", "tag": "NOTE"},
"success": {"emoji": "✅", "tag": "SUCCESS"},
"danger": {"emoji": "🚫", "tag": "CAUTION"},
"note": {"emoji": "📝", "tag": "NOTE"}
"note": {"emoji": "📝", "tag": "NOTE"},
}

# Reverse lookup: mapping emojis back to their respective MkDocs types
EMOJI_TO_TYPE = {v["emoji"]: k for k, v in MAPPING.items()}

# Emoji Pattern: Handles optional bold titles and standard emojis
EMOJI_PATTERN = r'>\s*(⚠️|💡|ℹ️|✅|🚫|📝)(?:\s*\*\*(.*?)\*\*)?\s*\n((?:>\s*.*\n?)*)'
EMOJI_PATTERN = r">\s*(⚠️|💡|ℹ️|✅|🚫|📝)(?:\s*\*\*(.*?)\*\*)?\s*\n((?:>\s*.*\n?)*)"

# GitHub Alert Pattern [!TYPE]
GITHUB_ALERT_PATTERN = r'>\s*\[\!(WARNING|TIP|NOTE|IMPORTANT|CAUTION)\]\s*\n((?:>\s*.*\n?)*)'
GITHUB_ALERT_PATTERN = (
r">\s*\[\!(WARNING|TIP|NOTE|IMPORTANT|CAUTION)\]\s*\n((?:>\s*.*\n?)*)"
)

# MkDocs Pattern: Captures '!!! type "Title"' blocks
MKDOCS_PATTERN = r'!!!\s+(\w+)\s+"(.*?)"\n((?:\s{4}.*\n?)*)'
Expand All @@ -53,28 +55,29 @@ def clean_body_for_mkdocs(body_text):
4. Preserves internal paragraph breaks.
"""
# Remove leading '>' and trailing whitespace from each line
raw_lines = [re.sub(r'^>\s?', '', line).rstrip() for line in body_text.split('\n')]
raw_lines = [re.sub(r"^>\s?", "", line).rstrip() for line in body_text.split("\n")]

# Find the first line with actual text (to strip leading blank lines)
start_idx = -1
for i, line in enumerate(raw_lines):
if line.strip():
start_idx = i
break

if start_idx == -1:
return ""

# Slice from the first content line
content_lines = raw_lines[start_idx:]

# Join lines and rstrip the entire block to remove trailing blank lines
body = "\n".join([f" {l}".rstrip() for l in content_lines]).rstrip()
return body


def to_mkdocs(content):
"""Converts GitHub style to MkDocs style."""

def emoji_replacer(match):
emoji_char, title, raw_body = match.groups()
adm_type = EMOJI_TO_TYPE.get(emoji_char, "note")
Expand All @@ -83,43 +86,47 @@ def emoji_replacer(match):
# Return block with exactly one newline at the end
return f'!!! {adm_type} "{title_val}"\n{body}\n'


def alert_replacer(match):
alert_type = match.group(1).lower()
type_map = {"important": "info", "caution": "danger"}
mkdocs_type = type_map.get(alert_type, alert_type)
raw_body = match.group(2)
first_line_match = re.search(r'^>\s*\*\*(.*?)\*\*\s*\n', raw_body)

first_line_match = re.search(r"^>\s*\*\*(.*?)\*\*\s*\n", raw_body)
title = first_line_match.group(1) if first_line_match else ""
if first_line_match:
raw_body = raw_body[first_line_match.end():]
raw_body = raw_body[first_line_match.end() :]

body = clean_body_for_mkdocs(raw_body)
return f'!!! {mkdocs_type} "{title}"\n{body}\n'

content = re.sub(EMOJI_PATTERN, emoji_replacer, content, flags=re.MULTILINE)
content = re.sub(GITHUB_ALERT_PATTERN, alert_replacer, content, flags=re.MULTILINE)
return content


def process_file(path):
with open(path, 'r', encoding='utf-8') as f:
with open(path, "r", encoding="utf-8") as f:
content = f.read()
new_content = to_mkdocs(content)
if new_content != content:
with open(path, 'w', encoding='utf-8') as f:
with open(path, "w", encoding="utf-8") as f:
f.write(new_content)
print(f"[CONVERTED] {path}")


def run_conversion():
for root, dirs, files in os.walk('docs'):
if any(x in root for x in ['scripts', 'assets', '__pycache__']):
for root, dirs, files in os.walk("docs"):
if any(x in root for x in ["scripts", "assets", "__pycache__"]):
continue
for file in files:
if file.endswith('.md'):
if file.endswith(".md"):
process_file(os.path.join(root, file))


if __name__ == "__main__":
parser = argparse.ArgumentParser(description="GitHub to MkDocs Markdown Admonition Converter")
parser = argparse.ArgumentParser(
description="GitHub to MkDocs Markdown Admonition Converter"
)
args = parser.parse_args()
run_conversion()
50 changes: 23 additions & 27 deletions docs/scripts/test_convert_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,26 @@
# --- 1. A2UI Specific Header Cases ---
ADMONITION_CASES = [
('!!! info "Coming soon..."', "Coming soon...", "ℹ️"),
('!!! warning "Status: Early Stage Public Preview"', "Status: Early Stage Public Preview", "⚠️"),
(
'!!! warning "Status: Early Stage Public Preview"',
"Status: Early Stage Public Preview",
"⚠️",
),
('!!! success "Stable Release"', "Stable Release", "✅"),
('!!! note "Version Compatibility"', "Version Compatibility", "📝"),
('!!! warning "Attention"', "Attention", "⚠️"),
('!!! tip "It\'s Just JSON"', "It's Just JSON", "💡"),
]


@pytest.mark.parametrize("expected_header, title, emoji", ADMONITION_CASES)
def test_standard_a2ui_conversion(expected_header, title, emoji):
"""Verifies that GitHub style converts to expected A2UI headers."""
body = " Line 1\n Line 2"
github_input = f"> {emoji} **{title}**\n>\n> Line 1\n> Line 2\n"

expected = f"{expected_header}\n{body}\n"

# GitHub -> MkDocs
result = to_mkdocs(github_input)
assert result.strip() == expected.strip()
Expand All @@ -45,7 +50,7 @@ def test_empty_title_case():
"""
github_input = "> 💡\n>\n> Content.\n"
expected = '!!! tip ""\n Content.\n'

result = to_mkdocs(github_input)
assert result == expected

Expand All @@ -60,44 +65,35 @@ def test_paragraph_spacing_and_trailing_lines():
"""
source_github = (
"> ✅ **Stable Release**\n"
">\n" # Spacer line
">\n" # Spacer line
"> Line 1\n"
">\n" # Internal break
">\n" # Internal break
"> Line 2\n"
">\n" # Trailing line 1
">\n" # Trailing line 2
">\n" # Trailing line 1
">\n" # Trailing line 2
)

result = to_mkdocs(source_github)

expected = (
'!!! success "Stable Release"\n'
' Line 1\n'
'\n'
' Line 2\n'
)

expected = '!!! success "Stable Release"\n' " Line 1\n" "\n" " Line 2\n"
assert result == expected


# --- 4. Multiple Blocks & Isolation ---
def test_multiple_blocks_in_one_file():
"""Ensures multiple blocks are processed without bleeding into each other."""
github_input = (
'> ✅ **Block 1**\n'
'> Content 1\n'
'\n'
'> ℹ️ **Block 2**\n'
'> Content 2\n'
"> ✅ **Block 1**\n" "> Content 1\n" "\n" "> ℹ️ **Block 2**\n" "> Content 2\n"
)

expected = (
'!!! success "Block 1"\n'
' Content 1\n'
'\n'
" Content 1\n"
"\n"
'!!! info "Block 2"\n'
' Content 2\n'
" Content 2\n"
)

result = to_mkdocs(github_input)
assert result == expected

Expand All @@ -114,5 +110,5 @@ def test_github_alert_to_mkdocs():
"""Verifies official [!TYPE] syntax conversion."""
source = "> [!WARNING]\n> **Security Notice**\n> Do not share keys."
expected = '!!! warning "Security Notice"\n Do not share keys.\n'

assert to_mkdocs(source) == expected
2 changes: 0 additions & 2 deletions renderers/angular/.npmrc

This file was deleted.

2 changes: 0 additions & 2 deletions renderers/lit/.npmrc

This file was deleted.

5 changes: 4 additions & 1 deletion renderers/lit/src/0.8/ui/directives/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ class MarkdownDirective extends Directive {
})
// The until directive lets us render a placeholder *until* the rendered
// content resolves.
return until(rendered, html`<span class="no-markdown-renderer">${value}</span>`);
return until(
rendered,
html`<span class="no-markdown-renderer">${value}</span>`
);
}

if (!MarkdownDirective.defaultMarkdownWarningLogged) {
Expand Down
2 changes: 0 additions & 2 deletions renderers/markdown/markdown-it/.npmrc

This file was deleted.

16 changes: 13 additions & 3 deletions samples/agent/adk/component_gallery/gallery_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def add_demo_surface(surface_id, component_def):

# Inject data model for this surface
messages.append({
"dataModelUpdate": {"surfaceId": surface_id, "contents": [gallery_data_content]}
"dataModelUpdate": {
"surfaceId": surface_id,
"contents": [gallery_data_content],
}
})

# 1. TextField
Expand Down Expand Up @@ -304,7 +307,11 @@ def add_demo_surface(surface_id, component_def):
"component": {
"Column": {
"children": {
"explicitList": ["div-text-1", "div-horiz", "div-text-2"]
"explicitList": [
"div-text-1",
"div-horiz",
"div-text-2",
]
},
"distribution": "start",
"alignment": "stretch",
Expand All @@ -315,7 +322,10 @@ def add_demo_surface(surface_id, component_def):
"id": "div-text-1",
"component": {"Text": {"text": {"literalString": "Above Divider"}}},
},
{"id": "div-horiz", "component": {"Divider": {"axis": "horizontal"}}},
{
"id": "div-horiz",
"component": {"Divider": {"axis": "horizontal"}},
},
{
"id": "div-text-2",
"component": {"Text": {"text": {"literalString": "Below Divider"}}},
Expand Down
6 changes: 6 additions & 0 deletions samples/agent/adk/contact_multiple_surfaces/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ This sample uses the Agent Development Kit (ADK) along with the A2A protocol to
uv run .
```

4. (Optional) Run the server with standard `WebFrame` instead of the custom `McpAppsCustomComponent`:

```bash
USE_MCP_SANDBOX=false uv run .
```


## Disclaimer

Expand Down
Loading
Loading