diff --git a/playground/playgrounds.go b/playground/playgrounds.go index ea35788..490a413 100644 --- a/playground/playgrounds.go +++ b/playground/playgrounds.go @@ -55,7 +55,7 @@ func IndexHandler(w http.ResponseWriter, r *http.Request) { // try to load file code := conf.HelloWorld - fileName := "8b7cc38b4c12e6fde5c4d15a4f2f32e5.go" // MD5 of HelloWorld.go + fileName := "6c5595ec6fbadf4cfce3edbfcfd8c6d0.go" // MD5 of HelloWorld.go if strings.HasSuffix(r.URL.Path, ".go") { fileNameArg := r.URL.Path[len("/playground/"):] diff --git a/static/js/playground.js b/static/js/playground.js index 32411e8..e170422 100644 --- a/static/js/playground.js +++ b/static/js/playground.js @@ -303,11 +303,19 @@ var playground = { playground.pid = data.pid; - var output = data.output; + var output = $("#output").html(); + if ("" === output) { + output = "
" + data.output + "
"; + } else { + output = output.replace(/<\/pre>$/g, data.output + ''); + } output = output.replace(/\r/g, ''); output = output.replace(/\n/g, '
'); - var oldOutput = $("#output").html(); - $("#output").html(oldOutput + output); + if (-1 !== output.indexOf("
")) { + output = Autolinker.link(output); + } + + $("#output").html(output); }; playgroundWS.onclose = function (e) { console.log('[playground onclose] disconnected (' + e.code + ')'); diff --git a/views/playground/index.html b/views/playground/index.html index f8c8957..608e7e8 100644 --- a/views/playground/index.html +++ b/views/playground/index.html @@ -98,7 +98,7 @@ - +