How Markdown is converted to HTML?

How Markdown is converted to HTML?
0

#1

hello campers.
I am in the challenge Build a Markdown Previewer ,everthing goes well , one thing I don’t know is how do I can convert markdown into html ,is it by CDN or what ?
I am using code pen to pass this challenge ,it seems I will stuck if no help is provided ,
however thanks in advance .


#2

Hi @mustaphason

You must follow the instrucctios of chalenge at the verbatim.

This link provides the CDN of the library. I see https://cdnjs.cloudflare.com/ajax/libs/marked/0.5.1/marked.js This CDN must be added at your pen.

This link provides the use of the library.

<!doctype html>
<html>
<head>
  <meta charset="utf-8"/>
  <title>Marked in the browser</title>
</head>
<body>
  <div id="content"></div>
  <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
  <script>
    document.getElementById('content').innerHTML =
      marked('# Marked in the browser\n\nRendered by **marked**.');
  </script>
</body>
</html>

I hope this helps.


#3

I thank you ,you saved me .


#5

I didn’t understand ,should I put this page in Javascript section ?


#6

@mustaphason You are two options:

Add the CDN link on the pen settings:
image

If you are using the React.js, select Babel as JavaScript Preprocessor.

The second option is the <script> element in your HTML editor.:

<script src='your-CDN-link.js'></script>

#7

ถูกแก้ไขแล้วอย่างถูกต้อง