How to create self-parsing HTML file?

I have successfully installed Commonmark.js through the NPM and successfully can convert md files to HTML, this way:

commonmark test.md > test.html

Okay.

And after that, I tried to create this HTML file:

<script src="commonmark.js"></script>
<script type="text/javascript" src="commonmark.js"></script>

# header

text

text

(Also I previously downloaded javascript file itself and placed it together with HTML).

But when I open this file in web browser, I see just not formatted HTML:

# header text text

Instead of desired result:

What I’m doing wrong?

(There are no errors shown in Chrome Developer Tools).

I want it just for myselft. In other words, as replacement of Word. Open it with Sublime Text, write something, then open in Chrome and see the result. Something like Strapdown. Maybe I’m on a wrong way?

Including the Markdown in the HTML file directly won’t work because web browsers don’t understand Markdown natively. The browser is currently just treating the Markdown as plain text; you’ll need to tell the web browser how to use commonmark.js to render the Markdown as HTML so that the web browser can understand it (usually with a JavaScript function). You could look at the source code of the dingus for an example of how this is done.

Thanks, Chris! Short and understandable answer.

Markdeep is using this technique, though It’s not CommonMark compliant