Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kuanyui/hexo.el
Use Hexo in Emacs elegantly
https://github.com/kuanyui/hexo.el
emacs hexo
Last synced: about 2 months ago
JSON representation
Use Hexo in Emacs elegantly
- Host: GitHub
- URL: https://github.com/kuanyui/hexo.el
- Owner: kuanyui
- Created: 2016-02-17T18:00:30.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-11-30T17:31:39.000Z (about 2 years ago)
- Last Synced: 2024-08-10T11:02:13.898Z (5 months ago)
- Topics: emacs, hexo
- Language: Emacs Lisp
- Homepage:
- Size: 444 KB
- Stars: 86
- Watchers: 9
- Forks: 14
- Open Issues: 3
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
* hexo.el
Emacs major-mode & tools for [[https://github.com/hexojs/hexo][Hexo]]. σ(´∀`*)* Screenshots
[[file:screenshots/screenshot_1.png]][[file:screenshots/screenshot_2.png]]
* Requirement
- hexo
- Emacs >= 24.3
- bash or any POSIX-compatible shell* Install
=hexo.el= is available on [[https://github.com/melpa/melpa][MELPA]] now.
#+BEGIN_SRC elisp
(add-to-list 'load-path "~/path/to/hexo.el/dir")
(require 'hexo)
#+END_SRCYou can define your function to open a specified hexo repository directly like this:
#+BEGIN_SRC elisp
(defun hexo-my-blog ()
(interactive)
(hexo "~/my-blog/"))
#+END_SRC** 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 [[https://github.com/nvm-sh/nvm][nvm]], you should add the following settings:
#+begin_src elisp
(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"
#+end_src** 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.
#+BEGIN_SRC elisp
(setq hexo-posix-compatible-shell-file-path "/bin/bash")
#+END_SRC** Org-mode Support
=hexo.el= now experimentally supports Org-mode via [[https://github.com/CodeFalling/hexo-renderer-org][CodeFalling's hexo-renderer-org]]. If you encounter any problem, please feel free to open issue for that. Thanks!Create a [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html][.dir-locals.el]] file at the root path of the hexo repository with the following contents:
#+BEGIN_SRC elisp
((nil . ((hexo-new-format . org))
))
#+END_SRCNow 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=
| 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 |** Commands for Markdown
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. ~[Hello](/2016/05/hello/)~ |** Commands for ~hexo-mode~
The following commands & key-bindings are available in ~hexo-mode~.
#+BEGIN_QUOTE
Prefix ~hexo-command-~ means the function is only available under ~hexo-mode~
#+END_QUOTE| 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 |* License
MITCopyright (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.