summaryrefslogtreecommitdiff
path: root/www/src/components/Shell.astro
blob: 3147ba886fdb42e8382621ac513157a8fdebb676 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
---
export interface Props {
  code: string;
}
const { code } = Astro.props;
---
<pre><code>{String(code).trim().split('\n').map(
  line => <span class="line">{
    line.startsWith('#') ? <span class="comment">{line}</span> : line
  }</span>)
}</code></pre>

<style>
  pre, code {
    white-space: pre;
  }
  .comment {
    color: var(--color-gray-400);
  }
  .line {
    display: block;
  }
  .line:empty::after {
    content: " ";
  }
</style>