THIS PROJECT IS NO LONGER MAINTAINED for I am not using org-mode for blog anymore. If someone have interest in maintaining, please contact me.
Hexo renderer plugin for emacs org-mode
中文动态:标签: hexo-renderer-org | M-x codefalling
Cd to your hexo blog.Run
npm install https://github.com/CodeFalling/hexo-renderer-org#emacs --save
You can also install it from npm,too.
Then restart your hexo server.
You can configure this plugin in _config.yml
.
org:
emacs: '/Applications/Emacs.app/Contents/MacOS/Emacs'
common: |
#+OPTIONS: toc:nil
#+BIND: org-html-postamble \"Last Updated %C.</br>Render by <a href='https://github.com/CodeFalling/hexo-renderer-org'>hexo-renderer-org</a> with %c\"
cachedir: './hexo-org-cache/'
emacs
is execute file of emacscommon
is common org content or you want to insert before renderer every org file.This is a example to disable toc.cachedir
is where your cache file located.With this optionhexo-org-renderer
will enable cache. Recommend for a much faster speed. Default enable.
org:
emacs: '/Applications/Emacs.app/Contents/MacOS/Emacs'
common: |
#+OPTIONS: toc:nil num:nil
<script>
function editAtGithub(isRaw){
var url_parts = document.location.pathname.split('/');
var postname = url_parts[url_parts.length - 2];
if(url_parts.length == 3){ // is a page(wiki about etc)
postname = postname + '/index.org';
}else{
postname = '_posts/' + postname + '.org';
}
var url = 'https://github.com/CodeFalling/codefalling.com/tree/source/source/' + postname;
if(isRaw)
url = 'https://raw.githubusercontent.com/CodeFalling/codefalling.com/source/source/' + postname;
window.open(url);
}
</script>
#+BIND: org-html-postamble \"<div style='font-size: 14px;padding: 5px;line-height: 20px;border: 1px solid;'><a href='javascript: editAtGithub();'>Edit Me at Github</a> - <a href='javascript: editAtGithub(true)'>Org Source</a> - Last Updated %C.</br>Render by <a href='https://github.com/CodeFalling/hexo-renderer-org'>hexo-renderer-org</a> with %c</div>\"
This example add a Edit Me at Github - Org Source
at every org page.
Create balbala.org
in source/_posts/,there is a template:
#+TITLE: Hello,orgmode
#+DATE: <2015-11-15 Sun 17:00>
#+TAGS: emacs, orgmode, hexo
#+LAYOUT: post
#+CATEGORIES: orgmode
* Orgmode
** Why org
#+BEGIN_SRC js
console.log('hello');
#+END_SRC
我编不下去了。。
Place
#+BEGIN_HTML
<!--more-->
#+END_HTML
or for org-mode version 9
#+BEGIN_EXPORT html
<!--more-->
#+END_EXPORT
in where you would like to add a Read more
Hexo use `alt` as title of image.
So just use
#+ATTR_HTML: :alt caption [[image url]]
See CodeFalling/hexo-renderer-org at old-js-version for old pure-js version.
Orgmode has its own way to describe meta info of post,such as title,date etc.
Front-matter | Orgmode | Value |
---|---|---|
layout | #+LAYOUT | post/page |
title | #+TITLE | string |
date | #+DATE | <2015-11-16 Mon 20:45>, you can use M-x org-time-stamp in emacs |
comments | #+COMMENTS | yes/no |
tags | #+TAGS | tag1, tag2, tag3 |
categories | #+CATEGORIES |
Config in your _config.yml
highlight: enable: true number: false
org:
common: |
#+OPTIONS: num: nil