diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index e1f786e..cd833cb 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -28,7 +28,8 @@ onMount(async () => { let lang = getLangFromUrl() - lang = lang === 'mrwn' || lang === 'gflm' ? 'md' : lang // back compatiblity with old links + // Remove github flavored markdown, redundant with markdown + lang = lang === 'gflm' ? 'md' : lang // extract the part in the url after the hash const hash = window.location.hash.slice(1) diff --git a/src/routes/editor/+page.svelte b/src/routes/editor/+page.svelte index 81147ef..a332458 100644 --- a/src/routes/editor/+page.svelte +++ b/src/routes/editor/+page.svelte @@ -18,7 +18,8 @@ if (editor) { const url = new URL(window.location.origin) compressed = await brotli.compress(editor.getValue()) - if ($selectedLang) { + // Set the language (ignore for plain text, since it's the default) + if ($selectedLang && $selectedLang !== 'plt') { url.searchParams.set('l', $selectedLang) } url.hash = compressed @@ -32,6 +33,8 @@ }, 1000) async function initCodeEditor() { + $selectedLang = new URLSearchParams(window.location.search).get('l') ?? ' plt' + CodeMirror.modeURL = 'https://cdn.jsdelivr.net/npm/codemirror@5.65.16/mode/%N/%N.js' editor = new CodeMirror(byId('editor'), { lineNumbers: true, @@ -64,7 +67,6 @@ } } - $selectedLang = new URLSearchParams(window.location.search).get('l') ?? ' plt' }