lib/Highlight: add button to disable slicing
This commit is contained in:
parent
d985dadfe9
commit
e41c15ae6c
|
@ -8,10 +8,18 @@
|
||||||
export let alt;
|
export let alt;
|
||||||
|
|
||||||
let renderedCode;
|
let renderedCode;
|
||||||
$: renderedCode = slice ? code.replace(/#<hidden>[^]*?#<\/hidden>/, "") : code;;
|
$: renderedCode = slice ? code.replace(/#<hidden>[^]*?#<\/hidden>/, "") : code;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<p class="sr-only">{alt}</p>
|
<p class="sr-only">{alt}</p>
|
||||||
<div class="whitespace-pre-wrap font-mono" aria-hidden title={alt}>
|
<div class="whitespace-pre-wrap font-mono relative" aria-hidden title={alt}>
|
||||||
<Highlight {language} code={renderedCode} />
|
<Highlight {language} code={renderedCode} />
|
||||||
|
<button
|
||||||
|
class="top-0 right-0 absolute font-sans text-xs font-bold"
|
||||||
|
class:text-blue-500={slice}
|
||||||
|
on:click={() => { slice = !slice }}
|
||||||
|
>
|
||||||
|
({slice ? "show" : "hide"} full)
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -17,5 +17,9 @@ with import <nixpkgs> { }; nixos
|
||||||
enable = true;
|
enable = true;
|
||||||
settings.PermitRootLogin = "yes";
|
settings.PermitRootLogin = "yes";
|
||||||
};
|
};
|
||||||
|
# run with:
|
||||||
|
# nix-build vm.nix -A vm && (rm nixos.qcow2 ; QEMU_NET_OPTS='hostfwd=tcp::3000-:80' ./result/bin/run-nixos-vm)
|
||||||
|
# xdg-open http://localhost:3000
|
||||||
|
|
||||||
#</hidden>
|
#</hidden>
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue