fix broken indentation

This commit is contained in:
Chris W 2023-10-06 22:02:50 -06:00
parent 4e1a164717
commit 793292d0ed
4 changed files with 4 additions and 5 deletions

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/images/favicon.ico" />
<meta name="viewport" content="width=device-width" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body class="w-full h-full min-h-full" data-sveltekit-preload-data="hover" data-theme="skeleton">

View File

@ -88,7 +88,7 @@
<!-- prettier-ignore -->
<div class="markdown text-xl max-w-[90ch] pb-24">{@html contents}</div>
{:else}
<pre class="pt-5 pb-24 w-full whitespace-pre-wrap" bind:this={codeRef} on:dblclick={() => selectAll()} ><code>{@html contents}</code></pre>
<pre class="pl-2 pt-5 pb-24 max-w-full break-words whitespace-pre-line" bind:this={codeRef} on:dblclick={() => selectAll()} ><code>{@html contents}</code></pre>
{/if}
<div class="fixed bottom-0 right-0 w-full md:w-auto">

View File

@ -17,7 +17,7 @@
<ToolBox disableSave={true} disableCopy={true} on:new={() => goto('/')} />
</div>
<div class="pl-8 max-w-[100ch] pb-24">
<div class="pl-2 pr-2 max-w-[100ch] pb-24">
<h1 class="h1 mb-2">Paste69</h1>
<p class="mb-4 mt-4">

View File

@ -29,14 +29,13 @@ export const highlight = (code: string, lang: string | undefined = undefined) =>
};
// Plugin to add line numbers
hljs.addPlugin({
'after:highlight': (result) => {
const code = result.value.split('\n').map((line, index) => {
const lineNumber = index + 1;
const paddedLineNumber = String(lineNumber).padStart(5, ' ');
return `<div class="flex flex-row items-start justify-start gap-8"><div class="text-gray-400 select-none shrink-0 min-w-14">${paddedLineNumber}</div><div class="">${line}</div></div>`;
return `<div class="flex flex-row items-start justify-start gap-8"><div class="text-gray-400 select-none shrink-0 min-w-14">${paddedLineNumber}</div><pre class="whitespace-pre-wrap">${line}</pre></div>`;
}).join('\n');
result.value = `<div class="flex flex-col">${code}</div>`