Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
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 20 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.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.