diff --git a/docs/playground/index.html b/docs/playground/index.html index 7ebbf7d..4b6b83f 100644 --- a/docs/playground/index.html +++ b/docs/playground/index.html @@ -56,7 +56,9 @@ const previewElm = $('preview'); const htmlElm= $$('#html pre'); const permelinkElm = $('permalink') + const messageElm = $('message'); + messageElm.innerText = ""; const options = getOptions(); const html = toHtml(inputElm.value, options); previewElm.innerHTML = html; @@ -84,13 +86,20 @@ const onload = function(obj) { wasm = obj.instance; go.run(wasm); - document.getElementById("convert-markdown").disabled = false; + $("convert-markdown").disabled = false; const u = new URL(location.href); if(u.searchParams.has("m")) { setOptions(u.searchParams.get("o")); $("input").value = decodeURIComponent(u.searchParams.get("m")); convert(); } + + if(u.searchParams.has("v")) { + const v = u.searchParams.get("v") + if(v !== goldmarkVersion) { + $("message").innerHTML = "
This link was created for goldmark@"+v+". Results may differ with this version.
"; + } + } }; if ('instantiateStreaming' in WebAssembly) { @@ -101,8 +110,7 @@ ).then(bytes => WebAssembly.instantiate(bytes, go.importObject).then(onload)); } - [...document.querySelectorAll('#container pre')] - .map(pre => { + for(const pre of [...document.querySelectorAll('#container pre')]){ const button = document.createElement('button'); pre.parentNode.insertBefore(button, pre); button.textContent = 'copy'; @@ -121,7 +129,7 @@ button.textContent = 'copy'; }, 500); }); - }); + } }); @@ -130,6 +138,8 @@

goldmark@v1.7.0 playground

+
+
diff --git a/docs/playground/playground.css b/docs/playground/playground.css index e7b28c3..80aecab 100644 --- a/docs/playground/playground.css +++ b/docs/playground/playground.css @@ -1148,3 +1148,7 @@ button.pre-copy { font-size: .8em; cursor: pointer; } + +#message .warn { + color: var(--color-danger-fg); +} diff --git a/src/playground/index.html b/src/playground/index.html index 67b19ef..696093b 100644 --- a/src/playground/index.html +++ b/src/playground/index.html @@ -56,7 +56,9 @@ const previewElm = $('preview'); const htmlElm= $$('#html pre'); const permelinkElm = $('permalink') + const messageElm = $('message'); + messageElm.innerText = ""; const options = getOptions(); const html = toHtml(inputElm.value, options); previewElm.innerHTML = html; @@ -84,13 +86,20 @@ const onload = function(obj) { wasm = obj.instance; go.run(wasm); - document.getElementById("convert-markdown").disabled = false; + $("convert-markdown").disabled = false; const u = new URL(location.href); if(u.searchParams.has("m")) { setOptions(u.searchParams.get("o")); $("input").value = decodeURIComponent(u.searchParams.get("m")); convert(); } + + if(u.searchParams.has("v")) { + const v = u.searchParams.get("v") + if(v !== goldmarkVersion) { + $("message").innerHTML = "
This link was created for goldmark@"+v+". Results may differ with this version.
"; + } + } }; if ('instantiateStreaming' in WebAssembly) { @@ -129,6 +138,8 @@

goldmark@{{version}} playground

+
+
diff --git a/src/playground/playground.css b/src/playground/playground.css index e7b28c3..80aecab 100644 --- a/src/playground/playground.css +++ b/src/playground/playground.css @@ -1148,3 +1148,7 @@ button.pre-copy { font-size: .8em; cursor: pointer; } + +#message .warn { + color: var(--color-danger-fg); +}