Including code from any website in your Hexo posts, modified from https://github.com/hexojs/hexo/blob/master/lib/plugins/tag/include_code.js and https://github.com/zbicin/hexo-github-include
npm install --save hexo-tag-icodeweb
{% icodeweb type [title:title] [lang:language] [from:line] [to:line] path/to/file %}
Usage of lang
, from
and to
is same as include_code Tag in Hexo
Config like this:
icodeweb:
lang_default:
types:
- name: # type name
lang_default:
website: # website
prefix:
suffix:
codehead:
For example:
icodeweb:
lang_default: plaintext
types:
- name: icwexample
lang_default: cpp
website: https://raw.githubusercontent.com
prefix:
- Tiphereth-A
- Tiphereth-A.github.io
- gh-pages
- code
suffix:
- .cpp
codehead: "// example"
Then you can write
{% icodeweb icwexample about/init %}
to include https://raw.githubusercontent.com/Tiphereth-A/Tiphereth-A.github.io/gh-pages/code/about/init.cpp into your posts