Skip to content

Commit fe93bd5

Browse files
committed
Updating example to use @code-hike/mdx
1 parent c78f3a9 commit fe93bd5

File tree

2 files changed

+80
-81
lines changed

2 files changed

+80
-81
lines changed

examples/astro/src/pages/codehike.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import "@code-hike/mdx/styles.css"
2+
import { CH } from "@code-hike/mdx/components"
3+
4+
# Hello
5+
6+
Lorem ipsum dolor sit amet.
7+
8+
<CH.Code client:load>
9+
```python hello.py mark=1[22:30]
10+
print("Rendered with Code Hike")
11+
```
12+
</CH.Code>
13+
14+
Lorem ipsum dolor sit amet.

examples/astro/src/pages/index.astro

Lines changed: 66 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,81 @@
11
---
2-
import Layout from '../layouts/Layout.astro';
3-
import Card from '../components/Card.astro';
2+
import Layout from "../layouts/Layout.astro"
3+
import Card from "../components/Card.astro"
44
---
55

66
<Layout title="Welcome to Astro.">
7-
<main>
8-
<h1>Welcome to <span class="text-gradient">Astro</span></h1>
9-
<p class="instructions">
10-
Check out the <code>src/pages</code> directory to get started.<br />
11-
<strong>Code Challenge:</strong> Tweak the "Welcome to Astro" message above.
12-
</p>
13-
<ul role="list" class="link-card-grid">
14-
<Card
15-
href="https://docs.astro.build/"
16-
title="Documentation"
17-
body="Learn how Astro works and explore the official API docs."
18-
/>
19-
<Card
20-
href="https://astro.build/integrations/"
21-
title="Integrations"
22-
body="Supercharge your project with new frameworks and libraries."
23-
/>
24-
<Card
25-
href="https://astro.build/themes/"
26-
title="Themes"
27-
body="Explore a galaxy of community-built starter themes."
28-
/>
29-
<Card
30-
href="https://astro.build/chat/"
31-
title="Chat"
32-
body="Come say hi to our amazing Discord community. ❤️"
33-
/>
34-
</ul>
35-
</main>
7+
<main>
8+
<h1>Welcome to <span class="text-gradient">Astro</span></h1>
9+
<p class="instructions">
10+
Check out the <code>src/pages</code> directory to get started.<br />
11+
<strong>Code Challenge:</strong> Tweak the "Welcome to Astro" message above.
12+
</p>
13+
<ul role="list" class="link-card-grid">
14+
<Card
15+
href="/codehike"
16+
title="Codehike"
17+
body="See the Codehike sample by clicking here"
18+
/>
19+
</ul>
20+
</main>
3621
</Layout>
3722

3823
<style>
39-
:root {
40-
--astro-gradient: linear-gradient(0deg, #4f39fa, #da62c4);
41-
}
24+
:root {
25+
--astro-gradient: linear-gradient(0deg, #4f39fa, #da62c4);
26+
}
4227

43-
h1 {
44-
margin: 2rem 0;
45-
}
28+
h1 {
29+
margin: 2rem 0;
30+
}
4631

47-
main {
48-
margin: auto;
49-
padding: 1em;
50-
max-width: 60ch;
51-
}
32+
main {
33+
margin: auto;
34+
padding: 1em;
35+
max-width: 60ch;
36+
}
5237

53-
.text-gradient {
54-
font-weight: 900;
55-
background-image: var(--astro-gradient);
56-
-webkit-background-clip: text;
57-
-webkit-text-fill-color: transparent;
58-
background-size: 100% 200%;
59-
background-position-y: 100%;
60-
border-radius: 0.4rem;
61-
animation: pulse 4s ease-in-out infinite;
62-
}
38+
.text-gradient {
39+
font-weight: 900;
40+
background-image: var(--astro-gradient);
41+
-webkit-background-clip: text;
42+
-webkit-text-fill-color: transparent;
43+
background-size: 100% 200%;
44+
background-position-y: 100%;
45+
border-radius: 0.4rem;
46+
animation: pulse 4s ease-in-out infinite;
47+
}
6348

64-
@keyframes pulse {
65-
0%,
66-
100% {
67-
background-position-y: 0%;
68-
}
69-
50% {
70-
background-position-y: 80%;
71-
}
72-
}
49+
@keyframes pulse {
50+
0%,
51+
100% {
52+
background-position-y: 0%;
53+
}
54+
50% {
55+
background-position-y: 80%;
56+
}
57+
}
7358

74-
.instructions {
75-
line-height: 1.6;
76-
margin: 1rem 0;
77-
background: #4f39fa;
78-
padding: 1rem;
79-
border-radius: 0.4rem;
80-
color: var(--color-bg);
81-
}
59+
.instructions {
60+
line-height: 1.6;
61+
margin: 1rem 0;
62+
background: #4f39fa;
63+
padding: 1rem;
64+
border-radius: 0.4rem;
65+
color: var(--color-bg);
66+
}
8267

83-
.instructions code {
84-
font-size: 0.875em;
85-
border: 0.1em solid var(--color-border);
86-
border-radius: 4px;
87-
padding: 0.15em 0.25em;
88-
}
68+
.instructions code {
69+
font-size: 0.875em;
70+
border: 0.1em solid var(--color-border);
71+
border-radius: 4px;
72+
padding: 0.15em 0.25em;
73+
}
8974

90-
.link-card-grid {
91-
display: grid;
92-
grid-template-columns: repeat(auto-fit, minmax(24ch, 1fr));
93-
gap: 1rem;
94-
padding: 0;
95-
}
75+
.link-card-grid {
76+
display: grid;
77+
grid-template-columns: repeat(auto-fit, minmax(24ch, 1fr));
78+
gap: 1rem;
79+
padding: 0;
80+
}
9681
</style>

0 commit comments

Comments
 (0)