showdownjs / showdown

A bidirectional Markdown to HTML to Markdown converter written in Javascript
http://www.showdownjs.com/
MIT License
14.26k stars 1.56k forks source link

How to import outside .md content? #759

Open CheKaiWei opened 4 years ago

CheKaiWei commented 4 years ago

I struggle in how to how to import outside .md content? I write the code like this, and I wish to see the content of my markdown file in chrome.

<!DOCTYPE html>
<html>
<head>
    <title>MarkDown</title>
    <script src="dist/showdown.min.js"></script>
</head>

<body>
    <p id="content" class="hide">{{ blog.content }} </p>
    <p id="output">test</p>
    <script>
        var converter = new showdown.Converter(),
            text = document.getElementById('content').innerText,
            html = converter.makeHtml(text);
        document.getElementById('output').innerHTML = html;
    </script>

</body>
</html>

However, I just got this:

{{ blog.content }}

{{ blog.content }}