Skip to content

kuanyui/hexo.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

hexo.el

Emacs major-mode & tools for Hexo. σ(´∀`*)

Screenshots

screenshots/screenshot_1.png

screenshots/screenshot_2.png

Requirement

  • hexo
  • Emacs >= 24.3
  • bash or any POSIX-compatible shell

Install

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/"))

Node Version & Hexo Version

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 Version

hexo.el will always try to find the hexo binary in repo local node_modules first, then system-wide hexo.

Node Version

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"

Not A Bash / Zsh User?

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")

Org-mode Support

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.

Usage

M-x hexo to use hexo-mode.

Common Commands

The following commands are available in markdown-mode, dired-mode, hexo-mode

CommandDescription
hexo-newCreate new post anywhere.
hexo-move-articleMove article between _post/ and _draft/.
hexo-touch-files-in-dir-by-timeTouch all files by their timestamp to make files sortable in file-manager.
hexo-server-runOpen Hexo server process (posts only / posts + drafts)
hexo-server-stopStop Hexo server process
hexo-server-deployDeploy

Commands for Markdown

The following commands are only available in markdown-mode

CommandDescription
hexo-insert-article-linkInsert a link to specific article in _posts/.
hexo-insert-file-linkInsert a link to file. (not article)
hexo-update-current-article-dateUpdate article’s date stamp by current time. This may change its permanent link!
hexo-follow-post-linkOpen the article file link under the cursor. <ex> [Hello](/2016/05/hello/)

Commands for hexo-mode

The following commands & key-bindings are available in hexo-mode.

Prefix hexo-command- means the function is only available under hexo-mode

CommandKeyDescription
File
hexo-command-open-fileRETOpen file
hexo-command-show-article-infoSPCShow article info
hexo-newnCreate file
hexo-command-rename-fileR, [f2]Rename file
hexo-command-delete-fileDDelete file
View
hexo-command-revert-tabulated-listgRefresh
tabulated-list-sortSSort according to this column header
hexo-command-filter-tagfFilter article by tag
Edit
hexo-touch-files-in-dir-by-timeT Ttouch all files by their timestamp to make files sortable in file-manager.
hexo-toggle-article-statusT SToggle article status (Move file between _posts/ and _drafts/)
hexo-command-tags-togglertAdd / Remove tags of a single article
Mark
hexo-command-markmMark article
hexo-command-unmarkuUnmark article
hexo-command-add-tagsM aAdd tags to all marked articles
hexo-command-remove-tagsM rRemove tags from all marked articles
Server
hexo-server-runs rOpen Hexo server process (posts only / posts + drafts)
hexo-server-stops sStop Hexo server process
hexo-server-deploys dDeploy
Mode
hexo-command-helph, ?Show key-binding cheat sheet
kill-buffer-and-windowQQuit

License

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.

About

Use Hexo in Emacs elegantly

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published