Blog Writing Notes

This is some notes during my blog-writing procedure. I will keep some interesting tricks, plugins, or tools inside this notes.

Post Templates

Hexo guide

Bulma

活用 Bulma 美化 Icarus 文章

Tag Plugins

Tag Plugins

Tag plugins should not be wrapped inside Markdown syntax, e.g. is not supported.

Some Usage of Basic Tags

Use the {% post_link filename [title] [escape] %} tag to refer to other posts as the document describes.

Basic usage:

  • {% post_link blog-writing-notes 'Link with escape' %}, which looks like Link <b>with</b> escape.
  • {% post_link blog-writing-notes 'Link Without escape' false %}, which looks like Link Without escape.
  • {% post_path blog-writing-notes %}, which gives the path rather than the hyperlink of post like /2022/09/08/blog-writing-notes/
  • <a href="{% post_path blog-writing-notes %}#Refer-to-Other-Posts">Link with anchor</a>, which allows you to refer to some particular anchor of your post like Link with anchor

Include a PDF file

This is an additional hexo plugin hexo-pdf, which could be installed by npm install --save hexo-pdf. It supports both external links and relative file path with the pdf file placed locally.

Basic usage:

  • {% pdf https://blablabla/test.pdf %}
  • {% pdf https://drive.google.com/file/d/xxxx/preview %}
  • {% pdf //test.pdf %}

Note that when referring to a local pdf file, the root directory for its path is the same as the root directory of the markdown file. For example, when referring to a PDF file placed in /source/files/test.pdf in /source/_posts/test.md, the correct tag should be {% pdf ../files/test.pdf %} rather than {% pdf ./files/test.pdf %}

Adding Emoji

I write a hexo tag for adding emojis conveniently, by inserting {% emoji EMOJI_NAME %} to the post. Check out the details here!

For even more convenience, set a VSCode key biding like this. More specifically, go to File - Preferences - User snippets - markdown.json, and add the following lines:

markdown.json
1
2
3
4
5
6
7
"Add hexo user tag of emoji": {
"prefix": "tag",
"body": [
"{% emoji $0 %}"
],
"description": "Add a hexo user tag for emoji"
}

The $0 means the cursor will stop at this position after inserting it.

Then, navigate to File - Preferences - Keyboard shortcuts, and add the following:

keybindings.json
1
2
3
4
5
6
7
8
9
{
"key": "ctrl+alt+E",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"langId": "markdown",
"name": "Add hexo user tag of emoji"
}
}

Now, entering ctrl + alt + E will insert {% emoji %} for you!

Author

FallCicada

Posted on

2022-09-08

Updated on

2022-09-11

Licensed under

Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×