Firstly thanks for reading this issue.
In _config.yml, I found there's a setting named code_dir: downloads/code.
Is this setting means that the author can put any source_code.tar or some files in. And write a download-link into your post.
Make sure dir /downloads/code is exist.
Put any file in downloads/code. For example. file.tar
In post, write a download_link. like: [download](/downloads/code/file.tar)
Whatever I use /downloads/code/file.tar or downloads/code/file.tar are not right.
Is there any elegant way to use variable like <% balabala.foo.bar %> or something like [file](foo.bar) etc...
Thanks
I just looked up "code_dir" on the repo and got this file:
https://github.com/hexojs/hexo/blob/106980eaba36ac6cdc473792edacddfe32c89d97/lib/plugins/tag/include_code.js#L12-L17
Looks like it insert a block of code and adds a download link. The doc comment gives the syntax, but I am not quite sure which engine it uses or how to enable it. (code_dir is used when resolving path/to/file)
@demurgos Merci.
One day ago, It's so easy to do it. No more copy&paste just 2 steps.
/source/downloads/code existed. And put your source code file in it.bash
> ls source/downloads/code/
filename.py
bash
{% include_code filename lang:python filename.py %}
Most helpful comment
@demurgos Merci.
One day ago, It's so easy to do it. No more copy&paste just 2 steps.
Make sure dir
/source/downloads/codeexisted. And put your source code file in it.bash > ls source/downloads/code/ filename.pybash {% include_code filename lang:python filename.py %}Voilà it works.