How to include markdown (.md) files inside HTML files?

Sometimes, we want to include markdown (.md) files inside HTML files.

In this article, we’ll look at how to include markdown (.md) files inside HTML files.

How to include markdown (.md) files inside HTML files?

To include markdown (.md) files inside HTML files, we can use the zero-md web component.

For instance, we write:

<script type="module" src="https://cdn.jsdelivr.net/gh/zerodevx/zero-md@1/src/zero-md.min.js"></script>

<zero-md>
  <script type="text/markdown">
    # **This** is my [markdown](https://example.com)
  </script>
</zero-md>

We add the zero-md web component with a script inside that contains the Markdown code.

It’ll be rendered if we set the type attribute to text/markdown.

Conclusion

To include markdown (.md) files inside HTML files, we can use the zero-md web component.