16 lines
422 B
Svelte
16 lines
422 B
Svelte
<script>
|
|
import Children from 'svelte-exmarkdown/renderer/Children.svelte';
|
|
import { toAnchor } from './anchors';
|
|
export let children;
|
|
export let properties;
|
|
|
|
function flatten(a) {
|
|
if (a.value) {
|
|
return a.value;
|
|
} else if (a.children) {
|
|
return a.children.map(flatten).join('');
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<h2 id={toAnchor(children.map(flatten).join(''))} {...properties}><Children {children} /></h2> |