Skip to content

Commit edca70a

Browse files
inutanoclaude
andcommitted
Improve agents and demo pages: tables, copy button, nav cleanup
- Enable markdown table rendering (tables: true in Redcarpet) - Add table styles with borders, padding, and hover highlight - Add click-to-copy button on code blocks with iOS Safari fallback - Strip trailing newline from copied text - Remove Demo from navbar; link to /demo from /agents page instead - Load FontAwesome regular CSS for copy icon Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4b9eeac commit edca70a

6 files changed

Lines changed: 77 additions & 7 deletions

File tree

views/_copy_code.haml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
:javascript
2+
document.addEventListener('DOMContentLoaded', function() {
3+
function copyText(text) {
4+
if (navigator.clipboard && window.isSecureContext) {
5+
return navigator.clipboard.writeText(text);
6+
}
7+
var ta = document.createElement('textarea');
8+
ta.value = text;
9+
ta.style.position = 'fixed';
10+
ta.style.left = '-9999px';
11+
document.body.appendChild(ta);
12+
ta.focus();
13+
ta.select();
14+
try { document.execCommand('copy'); } catch(e) {}
15+
document.body.removeChild(ta);
16+
return Promise.resolve();
17+
}
18+
19+
document.querySelectorAll('.publication_list pre').forEach(function(pre) {
20+
pre.style.position = 'relative';
21+
var btn = document.createElement('button');
22+
btn.className = 'copy-btn';
23+
btn.title = 'Copy to clipboard';
24+
btn.innerHTML = '<i class="far fa-copy"></i>';
25+
btn.addEventListener('click', function() {
26+
var code = pre.querySelector('code');
27+
var text = (code || pre).textContent.replace(/\n$/, '');
28+
copyText(text).then(function() {
29+
btn.innerHTML = '<i class="fas fa-check"></i>';
30+
setTimeout(function() {
31+
btn.innerHTML = '<i class="far fa-copy"></i>';
32+
}, 1500);
33+
});
34+
});
35+
pre.appendChild(btn);
36+
});
37+
});

views/_navigation.haml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@
4545
%i.fas.fa-robot
4646
%span.full-text Agents
4747
%span.abbrev-text API
48-
%li{ :class => (@active_menu == 'demo') ? 'active' : '' }
49-
%a{ :href => "#{app_root}/demo" }
50-
%i.fas.fa-play-circle
51-
%span.full-text Demo
52-
%span.abbrev-text Demo
5348
%li
5449
%a{ :href => "https://github.com/inutano/chip-atlas/wiki" }
5550
%i.fab.fa-github

views/agents.haml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
%link{ :href => "#{app_root}/css/fontawesome.css", :rel => "stylesheet"}
1919
%link{ :href => "#{app_root}/css/brands.css", :rel => "stylesheet"}
2020
%link{ :href => "#{app_root}/css/solid.css", :rel => "stylesheet"}
21+
%link{ :href => "#{app_root}/css/regular.css", :rel => "stylesheet"}
2122

2223
%body
2324
- @active_menu = 'agents'
@@ -26,7 +27,7 @@
2627
.container
2728
.row
2829
.col-md-8.col-md-offset-2.publication_list
29-
!= markdown(:agents, layout: false, fenced_code_blocks: true, autolink: true)
30+
!= markdown(:agents, layout: false, fenced_code_blocks: true, autolink: true, tables: true)
3031

3132
!= haml :footer
3233

@@ -36,3 +37,4 @@
3637
%script{ :src => "#{app_root}/js/jquery.min.js" }
3738
%script{ :src => "#{app_root}/js/bootstrap.min.js" }
3839
%script{ :src => "#{app_root}/js/pj/pj.js" }
40+
!= haml :_copy_code

views/agents.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
ChIP-Atlas is a comprehensive database of public ChIP-seq, ATAC-seq, DNase-seq, and Bisulfite-seq experiments. This page describes how AI agents can query ChIP-Atlas programmatically via the MCP (Model Context Protocol) server or the HTTP API directly.
44

5+
**New here?** Check out the [hands-on demo tutorial](/demo) for step-by-step scenarios you can try with your preferred LLM.
6+
57
---
68

79
## MCP Server

views/demo.haml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
%link{ :href => "#{app_root}/css/fontawesome.css", :rel => "stylesheet"}
1919
%link{ :href => "#{app_root}/css/brands.css", :rel => "stylesheet"}
2020
%link{ :href => "#{app_root}/css/solid.css", :rel => "stylesheet"}
21+
%link{ :href => "#{app_root}/css/regular.css", :rel => "stylesheet"}
2122

2223
%body
2324
- @active_menu = 'demo'
@@ -26,7 +27,7 @@
2627
.container
2728
.row
2829
.col-md-8.col-md-offset-2.publication_list
29-
!= markdown(:demo, layout: false, fenced_code_blocks: true, autolink: true)
30+
!= markdown(:demo, layout: false, fenced_code_blocks: true, autolink: true, tables: true)
3031

3132
!= haml :footer
3233

@@ -36,3 +37,4 @@
3637
%script{ :src => "#{app_root}/js/jquery.min.js" }
3738
%script{ :src => "#{app_root}/js/bootstrap.min.js" }
3839
%script{ :src => "#{app_root}/js/pj/pj.js" }
40+
!= haml :_copy_code

views/style.sass

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,43 @@ footer
218218
width: 28vw
219219
max-width: 150px
220220

221+
// copy button on code blocks
222+
.copy-btn
223+
position: absolute
224+
top: 6px
225+
right: 6px
226+
background: #e8e8e8
227+
border: none
228+
border-radius: 3px
229+
padding: 4px 7px
230+
cursor: pointer
231+
font-size: 13px
232+
color: #555
233+
opacity: 0.6
234+
transition: opacity 0.15s
235+
&:hover
236+
background: #d0d0d0
237+
color: #333
238+
opacity: 1
239+
221240
// publication
222241
.publication_list
223242
margin:
224243
top: .5em
225244
line-height: 1.5
245+
table
246+
width: 100%
247+
margin-bottom: 1em
248+
border-collapse: collapse
249+
th, td
250+
padding: 8px 12px
251+
border: 1px solid #ddd
252+
text-align: left
253+
th
254+
background-color: #f5f5f5
255+
font-weight: bold
256+
tbody tr:hover
257+
background-color: #f9f9f9
226258

227259
// navbar height fix
228260
.navbar-fixed-top

0 commit comments

Comments
 (0)