Skip to content

Commit f47fa46

Browse files
feat: improve home page links
1 parent b31cf51 commit f47fa46

File tree

1 file changed

+47
-28
lines changed

1 file changed

+47
-28
lines changed

website/src/homepage/Features.vue

Lines changed: 47 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,53 @@
11
<template>
22
<ul class="features">
3-
<li class="feature" v-for="feat in feats">
3+
<li class="feature">
44
<hr/>
55
<div class="description">
6-
<h2>{{feat.title}}</h2>
6+
<h2>Search and Rewrite</h2>
77
<p>
8-
{{feat.description}}
8+
ast-grep is a code tool for <a href="/guide/quick-start.html">structural search and replace</a>.
9+
It is like syntax-aware grep/sed!
10+
You can write code <a href="/guide/pattern-syntax.html">patterns</a> to locate and modify code,
11+
based on AST, in thousands of files, <a href="/guide/tooling-overview.html#interactive-mode">interactively</a>.
912
</p>
10-
<code>
11-
{{ feat.code }}
13+
<code class="vp-code">
14+
<span>ast-grep</span> -p '$A && $A()' -r '$A?.()'
1215
</code>
1316
</div>
14-
<img :src='feat.image' width="2004" height="1462"/>
17+
<img src='/image/search-replace.png' width="2004" height="1462"/>
18+
</li>
19+
<li class="feature">
20+
<hr/>
21+
<div class="description">
22+
<h2>Scan as Linter</h2>
23+
<p>
24+
ast-grep is a versatile and flexible tool for <a href="/guide/scan-project.html">linting</a> code with AST patterns.
25+
You can easily add new customized rules with <a href="/guide/rule-config.html">intuitive syntax</a> and enjoy pretty error reporting out of box.
26+
</p>
27+
<code class="vp-code">
28+
<span>ast-grep</span> scan
29+
</code>
30+
</div>
31+
<img src='/image/yaml-scan.png' width="2004" height="1462"/>
32+
</li>
33+
<li class="feature">
34+
<hr/>
35+
<div class="description">
36+
<h2>Programmatic Usage</h2>
37+
<p>
38+
ast-grep also provides <a href="/guide/api-usage/js-api.html">node-js binding</a> to access syntax trees programmatically.
39+
You can use jQuery like <a href="/reference/api.html#napi">utility methods</a> to traverse syntax tree nodes.
40+
Node API also has opt-in <a href="/blog/typed-napi.html">type safety</a>.
41+
</p>
42+
<code class="vp-code">
43+
npm install <span>@ast-grep/napi</span>
44+
</code>
45+
</div>
46+
<img src='/image/sg-napi.png' width="2004" height="1462"/>
1547
</li>
1648
<hr/>
1749
</ul>
1850
</template>
19-
<script setup lang="ts">
20-
const feats = [
21-
{
22-
image: '/image/search-replace.png',
23-
title: 'Search and Rewrite',
24-
description: 'ast-grep is a code tool for structural search and replace. It is like syntax-aware grep/sed! You can write code patterns to locate and modify code, based on AST, in thousands of files, interactively.',
25-
code: `sg -p '$A && $A()' -r '$A?.()'`
26-
},
27-
{
28-
image: '/image/yaml-scan.png',
29-
title: 'Scan as Linter',
30-
description: 'ast-grep is a versatile and flexible tool for linting code with AST patterns. You can easily add new customized rules with intuitive syntax and enjoy pretty error reporting out of box.',
31-
code: `sg scan`,
32-
},
33-
{
34-
image: '/image/sg-napi.png',
35-
title: 'Programmatic Usage',
36-
description: 'ast-grep also provides node-js binding for manipulating syntax trees programmatically. You can use jQuery like utility methods to traverse and manipulate syntax tree nodes, or use operators to compose complex matching from simple patterns.',
37-
code: `npm install @ast-grep/napi`,
38-
},
39-
]
40-
</script>
4151
<style scoped>
4252
.features {
4353
margin-top: -2em;
@@ -65,6 +75,11 @@ const feats = [
6575
padding: 0em 2em 2em;
6676
text-align: center;
6777
}
78+
.description a {
79+
text-decoration: underline;
80+
text-decoration-style: dotted;
81+
font-style: italic;
82+
}
6883
@media (min-width: 640px) {
6984
.description {
7085
padding: 0em 4em 2em;
@@ -93,6 +108,10 @@ const feats = [
93108
background-color: var(--vp-c-bg-soft);
94109
transition: border-color 0.25s, background-color 0.25s;
95110
}
111+
code span {
112+
--shiki-light: #6F42C1;
113+
--shiki-dark: #B392F0;
114+
}
96115
hr {
97116
width: 100%;
98117
border: none;

0 commit comments

Comments
 (0)