hexo-insert-markdown

A Hexo plugin that allows you to insert Markdown files in your posts.

Usage no npm install needed!

<script type="module">
  import hexoInsertMarkdown from 'https://cdn.skypack.dev/hexo-insert-markdown';
</script>

README

hexo-insert-markdown

A Hexo plugin that allows you to insert Markdown files in existing Markdown files.

Usage

  1. Add this plugin to your Hexo site with npm install hexo-insert-markdown --save
  2. Open your Markdown file (a page or post) and include this custom tag:
{% insertmd your/file.md %}

If you want to specify a custom separator, that is rendered after each include, you can use:

{% insertmd your/file.md '---' %}

It is also possible to include all top-level Markdown files from a directory:

{% insertmd your/directory/with/includes '---' %}

Note: The path to file includes must be relative to the source directory of your Hexo installation.

You also have to rebuild your site to see the effect of this plugin:

hexo clean && hexo generate

FAQ

  • Why is this plugin using tags ({% ... %}) instead of helpers (<%- ... %>)?

Helpers cannot be used in source files, that's why this plugin has to use tags.

  • What was your motivation?

This plugin was inspired by hexo-include-markdown. It extends its functionality with syntax highlighting for code blocks.