Compare commits
4
Commits
7f8091120c
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
819d9cb77d | ||
|
|
5b685e251b | ||
|
|
0d61c7662a | ||
|
|
ed2fd9f45e |
No files matched your search
+31
-31
@@ -12,44 +12,44 @@
|
|||||||
"format": "prettier --plugin-search-dir . --write ."
|
"format": "prettier --plugin-search-dir . --write ."
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/adapter-auto": "^2.0.0",
|
"@sveltejs/adapter-auto": "^2.1.1",
|
||||||
"@sveltejs/kit": "^1.20.4",
|
"@sveltejs/kit": "^1.30.4",
|
||||||
"@tailwindcss/typography": "^0.5.10",
|
"@tailwindcss/typography": "^0.5.16",
|
||||||
"@types/codemirror": "^5.60.12",
|
"@types/codemirror": "^5.60.16",
|
||||||
"@types/lodash-es": "^4.17.10",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
||||||
"@typescript-eslint/parser": "^6.0.0",
|
"@typescript-eslint/parser": "^6.21.0",
|
||||||
"autoprefixer": "^10.4.16",
|
"autoprefixer": "^10.4.21",
|
||||||
"eslint": "^8.28.0",
|
"eslint": "^8.57.1",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "^8.10.2",
|
||||||
"eslint-plugin-svelte": "^2.30.0",
|
"eslint-plugin-svelte": "^2.46.1",
|
||||||
"postcss": "^8.4.31",
|
"postcss": "^8.5.6",
|
||||||
"prettier": "^2.8.0",
|
"prettier": "^2.8.8",
|
||||||
"prettier-plugin-svelte": "^2.10.1",
|
"prettier-plugin-svelte": "^2.10.1",
|
||||||
"svelte": "^4.0.5",
|
"svelte": "^4.2.20",
|
||||||
"svelte-check": "^3.4.3",
|
"svelte-check": "^3.8.6",
|
||||||
"tailwindcss": "^3.3.5",
|
"tailwindcss": "^3.4.17",
|
||||||
"tslib": "^2.4.1",
|
"tslib": "^2.8.1",
|
||||||
"typescript": "^5.0.0",
|
"typescript": "^5.9.2",
|
||||||
"vite": "^4.4.2"
|
"vite": "^4.5.14"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@iconify/svelte": "^3.1.4",
|
"@iconify/svelte": "^3.1.6",
|
||||||
"@svelte-put/clickoutside": "^3.0.0",
|
"@svelte-put/clickoutside": "^3.0.2",
|
||||||
"@sveltejs/adapter-static": "^2.0.3",
|
"@sveltejs/adapter-static": "^2.0.3",
|
||||||
"brotli-compress": "^1.3.3",
|
"brotli-compress": "^1.3.3",
|
||||||
"highlight.js": "^11.9.0",
|
"highlight.js": "^11.11.1",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"rehype-highlight": "^7.0.0",
|
"rehype-highlight": "^7.0.2",
|
||||||
"rehype-stringify": "^10.0.0",
|
"rehype-stringify": "^10.0.1",
|
||||||
"remark-gfm": "^4.0.0",
|
"remark-gfm": "^4.0.1",
|
||||||
"remark-parse": "^11.0.0",
|
"remark-parse": "^11.0.0",
|
||||||
"remark-rehype": "^11.0.0",
|
"remark-rehype": "^11.1.2",
|
||||||
"sass": "^1.69.5",
|
"sass": "^1.91.0",
|
||||||
"slim-select": "^2.6.0",
|
"slim-select": "^2.12.1",
|
||||||
"svelte-select": "^5.7.0",
|
"svelte-select": "^5.8.3",
|
||||||
"tw-elements": "^1.0.0",
|
"tw-elements": "^1.1.0",
|
||||||
"unified": "^11.0.4"
|
"unified": "^11.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Generated
+2893
-2124
File diff suppressed because it is too large.
Load diff
@@ -1,22 +1,40 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import Icon from '@iconify/svelte'
|
||||||
|
import { fade } from 'svelte/transition'
|
||||||
|
|
||||||
export let isMarkdown: boolean
|
export let isMarkdown: boolean
|
||||||
export let isPlainText: boolean
|
export let isPlainText: boolean
|
||||||
export let decompressed: string
|
export let decompressed: string
|
||||||
export let htmlContent: string
|
export let htmlContent: string
|
||||||
let cssClass = ''
|
let cssClass = ''
|
||||||
export { cssClass as class }
|
export { cssClass as class }
|
||||||
|
|
||||||
|
let copied = false
|
||||||
|
function copyCode() {
|
||||||
|
navigator.clipboard.writeText(decompressed)
|
||||||
|
copied = true
|
||||||
|
setTimeout(() => (copied = false), 500)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class={cssClass}>
|
<div class={cssClass + ' relative'}>
|
||||||
{#if isMarkdown}
|
{#if isMarkdown}
|
||||||
<div class="h-full p-2">
|
<div class="h-full p-2">
|
||||||
{@html htmlContent}
|
{@html htmlContent}
|
||||||
</div>
|
</div>
|
||||||
{:else if isPlainText}
|
{:else if isPlainText}
|
||||||
<div class="whitespace-pre-line h-full">
|
<pre class="h-full">{decompressed}</pre>
|
||||||
{decompressed}
|
|
||||||
</div>
|
|
||||||
{:else}
|
{:else}
|
||||||
|
<button
|
||||||
|
class="z-40 right-4 top-[5.25rem] absolute inline"
|
||||||
|
on:click={copyCode}
|
||||||
|
title="Copy code">
|
||||||
|
<Icon class="text-xl" icon="fluent:copy-24-regular" />
|
||||||
|
</button>
|
||||||
|
{#if copied}
|
||||||
|
<span class="absolute right-4 top-24" out:fade={{ duration: 500 }}>Copied!</span>
|
||||||
|
{/if}
|
||||||
|
<!-- code block -->
|
||||||
<pre class="h-full"><code>{@html htmlContent}</code></pre>
|
<pre class="h-full"><code>{@html htmlContent}</code></pre>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@@ -44,12 +44,16 @@
|
|||||||
|
|
||||||
$: {
|
$: {
|
||||||
if (editor) {
|
if (editor) {
|
||||||
languages = CodeMirror.modeInfo
|
languages = (CodeMirror.modeInfo as unknown[])
|
||||||
.map((e: any) => ({
|
.map((e: any) => {
|
||||||
text: e.name,
|
let name = e.name
|
||||||
value: shorten(e.name),
|
if (name === 'Common Lisp') name = 'Lisp'
|
||||||
|
return {
|
||||||
|
text: name,
|
||||||
|
value: shorten(name),
|
||||||
data: { mime: e.mime, mode: e.mode },
|
data: { mime: e.mime, mode: e.mode },
|
||||||
}))
|
}
|
||||||
|
})
|
||||||
.filter((l: any) => l.value !== 'gflm') // Remove github flavored markdown, redundant with markdown
|
.filter((l: any) => l.value !== 'gflm') // Remove github flavored markdown, redundant with markdown
|
||||||
|
|
||||||
selectedLanguage =
|
selectedLanguage =
|
||||||
|
|||||||
+8
-5
@@ -12,22 +12,22 @@ export const slugify = (str: string) =>
|
|||||||
|
|
||||||
export const shorten = (name: string) => {
|
export const shorten = (name: string) => {
|
||||||
let n = slugify(name).replace('script', '-s').replace('python', 'py').replace('markdown', 'md')
|
let n = slugify(name).replace('script', '-s').replace('python', 'py').replace('markdown', 'md')
|
||||||
const nov = (s: string) => s[0] + s.substr(1).replace(/[aeiouy-]/g, '')
|
const nov = (s: string) => s[0] + s.substring(1).replace(/[aeiouy-]/g, '')
|
||||||
if (n.replace(/-/g, '').length <= 4) {
|
if (n.replace(/-/g, '').length <= 4) {
|
||||||
return n.replace(/-/g, '')
|
return n.replace(/-/g, '')
|
||||||
}
|
}
|
||||||
if (n.split('-').length >= 2) {
|
if (n.split('-').length >= 2) {
|
||||||
return n
|
return n
|
||||||
.split('-')
|
.split('-')
|
||||||
.map((x) => nov(x.substr(0, 2)))
|
.map((x) => nov(x.substring(0, 2)))
|
||||||
.join('')
|
.join('')
|
||||||
.substr(0, 4)
|
.substring(0, 4)
|
||||||
}
|
}
|
||||||
n = nov(n)
|
n = nov(n)
|
||||||
if (n.length <= 4) {
|
if (n.length <= 4) {
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
return n.substr(0, 2) + n.substr(n.length - 2, 2)
|
return n.substring(0, 2) + n.substring(n.length - 2, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getLangFromUrl() {
|
export function getLangFromUrl() {
|
||||||
@@ -41,6 +41,9 @@ export function isInIframe(): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getHljsLangFromShort(short: string): string {
|
export function getHljsLangFromShort(short: string): string {
|
||||||
const langs = hljs.listLanguages().map((lang) => ({ lang, short: shorten(lang) }))
|
const langs = hljs
|
||||||
|
.listLanguages()
|
||||||
|
.filter((l) => l !== 'taggerscript') // seriously? This overrides typescript.
|
||||||
|
.map((lang) => ({ lang, short: shorten(lang) }))
|
||||||
return langs.find((l) => l.short === short)?.lang ?? 'plaintext'
|
return langs.find((l) => l.short === short)?.lang ?? 'plaintext'
|
||||||
}
|
}
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
export const prerender = true
|
export const prerender = true
|
||||||
export const ssr = false
|
export const ssr = false
|
||||||
|
export const trailingSlash = 'always'
|
||||||
@@ -2,6 +2,6 @@
|
|||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
|
|
||||||
goto(
|
goto(
|
||||||
'/?l=md#G38MIKwO4jHSnkre/mbgqEctyYQbtQJgo6cGCYx8X4+fbmPzKoTWODMIWqOT72vTXcv0Q+BLkVfmA7d1QLpnOeFhmzpMTYUWPv+//drZimgkkjmdEolteffdmVWDAW8mTed/8ErUUEW7WYh5SyQSIv7aqx37ayxwFXxEG8z1GV47nfcdJRT7vyRjICIf0f8sSDEWUmF+OigZlLSvg8AbYqpMLCWIkvz4oFCEPu8EQ7W4oiy2MZDqgHO7tHvuJIeAqJPFiviPrswtp66P7AmQIFHcr8RO45OUwoo+7mw2kb4CIwNSJktMDeJLMD7tEsfwjPkKmDYZ8xRdQGyqDSyGkxapsTiMxPlmE6Dee1JkAMgaNSPWtJedCxiwzQgLylwDHGRB6U0Yy9liHFE5J9rDujwE/pQ5e1zrYcDAV+aeOKuVxOJnpCWW9F/F9tUWSIuT7/rx8R1i8H/3R6AQuK0BVWA8twvYgObo+TSRWtZI4mOFjm/p7ndIS9S4zDNXF18a3WlfeMSFBjepH0vip7llpqFdSOHP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