aboutsummaryrefslogtreecommitdiff
path: root/src/lib/components/code.svelte
blob: 255bf7e1a621432463957c5ebda9de76379f9f29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<script lang="ts">
	type Lines = string | boolean | null
	type Offset = string | null
	type Language = string | null

	export let id = 'code-animation'
	export let lines: Lines = true
	export let offset: Offset = null
	export let lang: Language = null

	delete $$restProps.class
</script>

<pre data-id={id} class={$$props.class || ''} {...$$restProps}>
  <code
		data-trim
		data-line-numbers={lines || null}
		data-ln-start-from={offset}
		class="language-{lang}">
<slot />
  </code>
</pre>