Emacs major-mode & tools for Hexo. σ(´∀`*)
- hexo
- Emacs >= 24.3
- bash or any POSIX-compatible shell
hexo.el
is available on MELPA now.
(add-to-list 'load-path "~/path/to/hexo.el/dir")
(require 'hexo)
You can define your function to open a specified hexo repository directly like this:
(defun hexo-my-blog ()
(interactive)
(hexo "~/my-blog/"))
You can check the compatibility of the version combinations of NodeJS & Hexo in Hexo’s official documentation: https://hexo.io/docs/#Required-Node-js-version
hexo.el
will always try to find the hexo
binary in repo local node_modules
first, then system-wide hexo
.
If you want to execute hexo
with the Node version against system’s via nvm, you should add the following settings:
(setq hexo-nvm-enabled t)
(setq hexo-nvm-dir (getenv "NVM_DIR")) ; Optional. If your Emacs environment has no this envvar set, please set manually.
(setq hexo-nvm-use-version "6") ; This means "nvm use 6"
If you’re using a shell beyond bash
/ zsh
(ex: fish
), you may have set shell-file-name
to your prefered shell. However this would broken some functions of hexo.el
. To prevent this, please specify the path to a POSIX-compatible shell.
(setq hexo-posix-compatible-shell-file-path "/bin/bash")
hexo.el
now experimentally supports Org-mode via CodeFalling’s hexo-renderer-org. If you encounter any problem, please feel free to open issue for that. Thanks!
Create a .dir-locals.el file at the root path of the hexo repository with the following contents:
((nil . ((hexo-new-format . org))
))
Now within this repository, M-x hexo-new
will generate org-mode format file.
M-x hexo
to use hexo-mode
.
The following commands are available in markdown-mode
, dired-mode
, hexo-mode
Command | Description |
---|---|
hexo-new | Create new post anywhere. |
hexo-move-article | Move article between _post/ and _draft/ . |
hexo-touch-files-in-dir-by-time | Touch all files by their timestamp to make files sortable in file-manager. |
hexo-server-run | Open Hexo server process (posts only / posts + drafts) |
hexo-server-stop | Stop Hexo server process |
hexo-server-deploy | Deploy |
The following commands are only available in markdown-mode
Command | Description |
---|---|
hexo-insert-article-link | Insert a link to specific article in _posts/ . |
hexo-insert-file-link | Insert a link to file. (not article) |
hexo-update-current-article-date | Update article’s date stamp by current time. This may change its permanent link! |
hexo-follow-post-link | Open the article file link under the cursor. <ex> [Hello](/2016/05/hello/) |
The following commands & key-bindings are available in hexo-mode
.
Prefix
hexo-command-
means the function is only available underhexo-mode
Command | Key | Description |
---|---|---|
File | ||
hexo-command-open-file | RET | Open file |
hexo-command-show-article-info | SPC | Show article info |
hexo-new | n | Create file |
hexo-command-rename-file | R , [f2] | Rename file |
hexo-command-delete-file | D | Delete file |
View | ||
hexo-command-revert-tabulated-list | g | Refresh |
tabulated-list-sort | S | Sort according to this column header |
hexo-command-filter-tag | f | Filter article by tag |
Edit | ||
hexo-touch-files-in-dir-by-time | T T | touch all files by their timestamp to make files sortable in file-manager. |
hexo-toggle-article-status | T S | Toggle article status (Move file between _posts/ and _drafts/ ) |
hexo-command-tags-toggler | t | Add / Remove tags of a single article |
Mark | ||
hexo-command-mark | m | Mark article |
hexo-command-unmark | u | Unmark article |
hexo-command-add-tags | M a | Add tags to all marked articles |
hexo-command-remove-tags | M r | Remove tags from all marked articles |
Server | ||
hexo-server-run | s r | Open Hexo server process (posts only / posts + drafts) |
hexo-server-stop | s s | Stop Hexo server process |
hexo-server-deploy | s d | Deploy |
Mode | ||
hexo-command-help | h , ? | Show key-binding cheat sheet |
kill-buffer-and-window | Q | Quit |
MIT
Copyright (c) 2014-2016 ono hiroko (kuanyui)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.