0.2.6 • Published 7 years ago

hexo-renderer-org v0.2.6

Weekly downloads
1
License
GPL-3.0
Repository
github
Last release
7 years ago

[https://travis-ci.org/CodeFalling/hexo-renderer-org] [https://www.npmjs.com/package/hexo-renderer-org]

  • hexo-renderer-org

Hexo renderer plugin for emacs org-mode

中文动态:[https://codefalling.com/tags/hexo-renderer-org/]

  • Usage

Cd to your hexo blog.Run

#+BEGIN_SRC shell npm install https://github.com/CodeFalling/hexo-renderer-org#emacs --save #+END_SRC

You can also install it from npm,too.

Then restart your hexo server.

  • Options

You can configure this plugin in ~_config.yml~.

#+BEGIN_SRC yml org: emacs: '/Applications/Emacs.app/Contents/MacOS/Emacs' common: | #+OPTIONS: toc:nil #+BIND: org-html-postamble \"Last Updated %C.Render by hexo-renderer-org with %c\" cachedir: './hexo-org-cache/' #+END_SRC

  1. ~emacs~ is execute file of emacs
  2. ~common~ is common org content or you want to insert before renderer every org file.This is a example to disable toc.
  3. ~cachedir~ is where your cache file located.With this option ~hexo-org-renderer~ will enable cache. Recommend for a much faster speed. Default enable.

** A more functional example #+BEGIN_SRC yml org: emacs: '/Applications/Emacs.app/Contents/MacOS/Emacs'
common: | #+OPTIONS: toc:nil num:nil #+BEGIN_HTML

          <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>
        #+END_HTML
        #+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>\"

#+END_SRC

This example add a ~Edit Me at Github - Org Source~ at every org page.

  • How to create new post

Create ~balbala.org~ in source/_posts/,there is a template:

#+BEGIN_SRC org ,#+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 我编不下去了。。 #+END_SRC

  • Q&A

** How to add ~Read more~ button?

Place

#+BEGIN_SRC org ,#+BEGIN_HTML

,#+END_HTML #+END_SRC

in where you would like to add a ~Read more~

** How to set caption of image? Hexo use alt as title of image.

So just use #+BEGIN_EXAMPLE #+ATTR_HTML: :alt caption [image url] #+END_EXAMPLE ** Old pure-js version

See [https://github.com/CodeFalling/hexo-renderer-org/tree/old-js-version] for old pure-js version.

** Front-matter not work?

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

** How to enable line number? Config in your ~_config.yml~

#+BEGIN_EXAMPLE highlight: enable: true number: false #+END_EXAMPLE

** Disable number of outline

#+BEGIN_SRC yaml org: common: | #+OPTIONS: num: nil #+END_SRC

0.2.6

7 years ago

0.2.5

7 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.0

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago