Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
hexo-insert-markdown
Advanced tools
A Hexo plugin that allows you to insert Markdown files in your posts.
A Hexo plugin that allows you to insert Markdown files in existing Markdown files.
npm install hexo-insert-markdown --save
{% insertmd %}
tag in your posts or pages to include Markdown content from fileshexo clean && hexo generate
Note: The path to file includes must be relative to the source directory of your Hexo installation. Files in subdirectories of the specified path will also be inserted.
Open your Markdown file (a post or page) 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 '---' %}
Include all Markdown files from a directory (and its subdirectories):
{% insertmd your/directory/with/includes '---' %}
If you want to render a table of contents (TOC) on top of your includes, you have to supply an empty object ({}
) as third parameter to insertmd
:
{% insertmd your/directory/with/includes '---' '{}' %}
All options from the hexo-util tocObj are supported, so you can define the minimum and maximum level of TOC headings:
{% insertmd error-ts/includes '---' '{ "max_depth": 2 }' %}
It works without using a separator too:
{% insertmd error-ts/includes '{ "max_depth": 2 }' %}
Note: The TOC options must be valid JSON (curly braces around objects and double quotes around property names).
What was your motivation?
This plugin was inspired by hexo-include-markdown. It extends its functionality with syntax highlighting for code blocks.
Why is this plugin using tags (
{% ... %}
) instead of helpers (<%- ... %>
)?
Helpers cannot be used in source files (source) which is why this plugin uses tags.
How can I embed code?
To include code (JavaScript, TypeScript, etc.) you can use Hexo's built-in codeblock or include_code syntax. It works like this:
{% include_code lang:javascript my-code.js %}
Note: Your code files must be stored in the source/downloads/code
directory of your Hexo blog.
FAQs
A Hexo plugin that allows you to insert Markdown files in your posts.
The npm package hexo-insert-markdown receives a total of 21 weekly downloads. As such, hexo-insert-markdown popularity was classified as not popular.
We found that hexo-insert-markdown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.