Question about the marked.min.js file

Question about the marked.min.js file
0.0 0


Hi, first off the codepen for what I’m asking about is here:

My current problem is that marked.min.js is giving the error Uncaught SyntaxError: Unexpected token : 

when I’m using the code:

function refreshText() {
  var text = document.getElementById('txt_input').innerHTML;
  document.getElementById('result_text').innerHTML = marked(text);

document.getElementById('txt_input').onkeyup = refreshText();
document.getElementById('txt_input').onblur = refreshText();

I clicked the link to the file location of where the error is and it’s in the file I copied starting at the “:” after version. I haven’t had this issue before with any of the other code modules I’ve imported so I was wondering if anybody knew a fix for this. I should also mention that the code works on startup and will translate markdown correctly but after changes are made using the onkeyup properties nothing changes because of the above errors.


This Stack question addresses the problem. A source map is JSON. When you pull in a source map via a script tag, it needs to have the type defined like this: type="application/json"

Best I can tell, there’s no way to do this from “Add External Scripts/Pens” but you can do it if you manually write a script tag in the document head. You can do that in the HTML tab of “Pen Settings.”

Here’s a working fork:

However, I’d recommend instead you just include the unminified version in your pen. You use minified source files when you’re concerned about bandwidth, usually in production. I don’t think that should be a big concern for you on this Codepen.


Thank you for the reply, I did remove the min files and just kept the markdown regular file and it works perfectly after some code tweaks. Thanks again!