Skip to content

Commit 43a03d6

Browse files
michaelmcneesclaude
andcommitted
fix: address 5 Copilot comments on PR #6
1. CEL link: separate external cel.dev link from internal expressions guide 2. status_code → status in server-guide (matches http.go output) 3. sanitizeExcerpt: recursive DOM walk preserves nested <mark> tags 4. Search race condition: requestId counter discards stale responses 5. Bottom padding: moved to global CSS @media (max-width: 1023px) body so all pages (including 404) clear the mobile bottom nav Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9386a1a commit 43a03d6

7 files changed

Lines changed: 35 additions & 23 deletions

File tree

site/src/components/SearchModal.astro

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,28 +68,28 @@
6868
if (modal) modal.classList.add('hidden');
6969
}
7070

71-
// Sanitize Pagefind excerpt: strip all HTML except <mark> tags
71+
// Recursively sanitize Pagefind excerpt: preserve only <mark> tags, strip everything else
7272
function sanitizeExcerpt(html) {
73-
var tmp = document.createElement('div');
74-
tmp.textContent = '';
75-
// Parse into a temporary element to strip tags
7673
var parser = new DOMParser();
7774
var doc = parser.parseFromString(html, 'text/html');
78-
var walker = doc.body.childNodes;
79-
for (var i = 0; i < walker.length; i++) {
80-
var node = walker[i];
81-
if (node.nodeType === 3) {
82-
tmp.appendChild(document.createTextNode(node.textContent));
83-
} else if (node.nodeType === 1 && node.tagName === 'MARK') {
84-
var mark = document.createElement('mark');
85-
mark.setAttribute('data-pagefind-highlight', '');
86-
mark.textContent = node.textContent;
87-
tmp.appendChild(mark);
88-
} else {
89-
tmp.appendChild(document.createTextNode(node.textContent || ''));
75+
var container = document.createElement('div');
76+
function walk(parent, target) {
77+
for (var i = 0; i < parent.childNodes.length; i++) {
78+
var node = parent.childNodes[i];
79+
if (node.nodeType === 3) {
80+
target.appendChild(document.createTextNode(node.textContent));
81+
} else if (node.nodeType === 1 && node.tagName === 'MARK') {
82+
var mark = document.createElement('mark');
83+
mark.setAttribute('data-pagefind-highlight', '');
84+
walk(node, mark);
85+
target.appendChild(mark);
86+
} else if (node.nodeType === 1) {
87+
walk(node, target);
88+
}
9089
}
9190
}
92-
return tmp;
91+
walk(doc.body, container);
92+
return container;
9393
}
9494

9595
document.addEventListener('keydown', function(e) {
@@ -109,6 +109,7 @@
109109
});
110110

111111
var debounceTimer;
112+
var searchRequestId = 0;
112113
document.addEventListener('input', function(e) {
113114
if (!e.target || !e.target.hasAttribute('data-search-input')) return;
114115
clearTimeout(debounceTimer);
@@ -123,20 +124,24 @@
123124
return;
124125
}
125126

127+
var thisRequestId = ++searchRequestId;
128+
126129
loadPagefind().then(function(pf) {
127130
if (!pf) {
128131
setResultsText('Search unavailable (build required)');
129132
return;
130133
}
131134

132135
pf.search(query).then(function(search) {
136+
if (thisRequestId !== searchRequestId) return; // stale response
133137
if (search.results.length === 0) {
134138
setResultsText('No results for "' + query + '"');
135139
return;
136140
}
137141

138142
Promise.all(search.results.slice(0, 8).map(function(r) { return r.data(); }))
139143
.then(function(items) {
144+
if (thisRequestId !== searchRequestId) return; // stale response
140145
while (results.firstChild) results.removeChild(results.firstChild);
141146
items.forEach(function(item) {
142147
var link = document.createElement('a');

site/src/content/docs/getting-started/data-passing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Execution b2c3d4e5-f6a7-8901-bcde-f12345678901: completed
4444
4545
## CEL Expression Syntax
4646
47-
Mantle uses [CEL (Common Expression Language)](/docs/concepts/expressions) for data passing and conditional logic. The essentials:
47+
Mantle uses [CEL (Common Expression Language)](https://cel.dev) for data passing and conditional logic. See the [Expressions guide](/docs/concepts/expressions) for the full reference. The essentials:
4848
4949
- **Access step output:** `steps['step-name'].output.json.field`
5050
- **Access inputs:** `inputs.field_name`

site/src/content/docs/server-guide/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ steps:
6666

6767
- name: alert-on-failure
6868
action: http/request
69-
if: "steps['check-api'].output.status_code != 200"
69+
if: "steps['check-api'].output.status != 200"
7070
params:
7171
method: POST
7272
url: https://hooks.slack.com/services/T00/B00/xxx
7373
body:
74-
text: "API health check failed with status {{ steps.check-api.output.status_code }}"
74+
text: "API health check failed with status {{ steps.check-api.output.status }}"
7575
```
7676
7777
Apply the workflow and start the server:

site/src/layouts/Docs.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const { prev, next } = getPrevNext(currentPath);
2525
<Base title={`${title} - Mantle Docs`}>
2626
<Nav />
2727
<div class="mx-auto max-w-[1280px] px-4 sm:px-6 overflow-x-hidden">
28-
<div class="flex min-h-screen pt-16 pb-16 md:pb-0">
28+
<div class="flex min-h-screen pt-16">
2929
<DocsSidebar currentPath={currentPath} />
3030

3131
<!-- Main content -->

site/src/pages/404.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Nav from '../components/Nav.astro';
44
---
55
<Base title="404 — Route Not Found | Mantle">
66
<Nav />
7-
<main class="min-h-screen flex items-center justify-center pt-16">
7+
<main class="min-h-screen flex items-center justify-center pt-16" id="main-content">
88
<div class="mx-auto max-w-[700px] px-6 py-24">
99
<h1 class="font-headline text-4xl sm:text-5xl font-bold tracking-tight mb-8">
1010
404: Route Not Found

site/src/pages/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Footer from '../components/Footer.astro';
1313
<Base title="Mantle — Headless AI Workflow Automation">
1414
<div data-pagefind-ignore>
1515
<Nav isHome={true} />
16-
<main id="main-content" class="pb-16 md:pb-0">
16+
<main id="main-content">
1717
<Hero />
1818
<Features />
1919
<HowItWorks />

site/src/styles/global.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ body {
100100
color: var(--color-on-primary);
101101
}
102102

103+
/* Bottom padding for fixed mobile nav — applied globally so all pages clear it */
104+
@media (max-width: 1023px) {
105+
body {
106+
padding-bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px));
107+
}
108+
}
109+
103110
/* Blinking cursor animation */
104111
@keyframes blink {
105112
0%, 50% { opacity: 1; }

0 commit comments

Comments
 (0)