OrgNote¶
OrgNote 是一个基于Emacs的org-mode模式写博客的工具
目录:
安装¶
通过 pip 安装:
$ sudo pip install orgnote
通过 easy_install 安装:
$ sudo easy_install orgnote
源码安装:
$ git clone git@github.com:LeslieZhu/OrgNote.git
$ cd OrgNote
$ sudo python setup.py install
快速使用¶
首先,你应该在 GitHub 上建立一个项目 yourname.github.com,这里的 yourname 是你在GitHub上的用户名.
然后按照步骤执行:
$ git clone git@github.com:yourname/yourname.github.com.git
$ cd yourname.github.com
$ orgnote init # 初始化目录
$ orgnote new note-name # 添加一篇博文
$ orgnote list # 列出所有博文
$ orgnote status # 查看博文是否在发布列表中
$ orgnote publish note-name # 将博文添加到发布列表中
$ orgnote generate # 生成博客
$ orgnote server [port] # 在本地预览效果,默认通过 localhost:8080 查看效果
$ orgnote deploy # 部署到服务器
配置¶
更新 _config.yml 文件:
注解
由于YAML对中文支持不好,配置文件里面最好一律使用英文。
博客与作者信息¶
# OrgNote Configuration
## Docs: http://lesliezhu.github.io/OrgNote/
## Source: https://github.com/LeslieZhu/OrgNote
# Site
title: OrgNote
subtitle: "A simple org-mode blog, write blog by org-mode in Emacs"
author: OrgNote
email: pythonisland@gmail.com
language: zh-CN
注解
language 最好设置为 zh-CN ,虽然设置为 en 也可以,但OrgNote使用中文比较稳妥。
博客描述与关键字¶
# About this blog
description: "Use OrgNote."
keywords: "OrgNote,Emacs,org-mode,blog,python,geek"
注解
这个 description 会作为 About 页面的内容,支持HTML标签方式。
博客文件目录设置¶
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://yoursite.com
root: /
# Directory
# if the source_dir is ./notes, then set 'source_dir' as 'notes', not include the '/'
public_dir: public
source_dir: notes
注解
如果为自己的某个GitHub项目创建网页,并且使用了OrgNote,则由于GitHub会对该项目使用类似 http://yoursite.github.io/child 的URL,则root应该设置为 /child/.
对于 public_dir, source_dir 目录前后都不需要增加 / 字符。
主题与外观¶
# Category & Tag
default_tag: "札记"
# Theme
# the default is 'freemind' and it's only theme for OrgNote now
theme: freemind
# Pagination
## the note num of each page
per_page: 6
注解
目前OrgNote只能使用默认的freemind主题。
边框布局¶
# layout
## 1: enable
## 0: disable
### if 'sidebar_show` is disable, igore all `sidebar` option
### the sidebar item display as the config order, sidebar items list:
### sidebar_latest,sidebar_tags,sidebar_time,sidebar_weibo,sidebar_link
sidebar_show: 1
sidebar:
- sidebar_latest
- sidebar_tags
- sidebar_time
- sidebar_link
注解
右边的边框内容,显示顺序是根据这里的排列顺序,如果不需要某个内容,则不要写到这里即可。
链接¶
# links, each link should setting url,name,icon
links:
link1:
url: http://lesliezhu.github.com
name: Leslie Zhu
icon: fa fa-github
link2:
url: https://github.com/LeslieZhu/OrgNote
name: OrgNote
icon: fa fa-github
注解
对于每个连接的 link1, link2 等名字都无所谓,但建议使用 link-num 的形式。
用户指南¶
$ orgnote help
Usage: orgnote <command>
Commands:
init Create a new OrgNote folder
new Create a new .org post
list List this blog notes
status Status of those notes
publish Auto Publish a note
generate Generate static files
server Start the server
deploy Deploy your website
help Get help on a command
version Display version information
OrgNote使用起来很简单,基本就这几条命令.
命令自动补全¶
在Bash中自动补全 OrgNote 命令.
安装¶
全局设置:
$ git clone git@github.com:LeslieZhu/orgnote-bash-completion.git
$ sudo cp ./orgnote-bash-completion/orgnote /etc/bash_completion.d/
$ . /etc/bash_completion.d/orgnote
本地设置:
$ mkdir -p ~/bash_completion.d
$ cp ./orgnote-bash-completion/orgnote ~/bash_completion.d/
$ echo "" >> ~/.bashrc
$ echo 'if [ -f "$HOME/bash_completion.d/orgnote" ] ; then' >> ~/.bashrc
$ echo ' . $HOME/bash_completion.d/orgnote' >> ~/.bashrc
$ echo "fi" >> ~/.bashrc
$ . ~/bash_completion.d/orgnote
用法¶
列出orgnote命令的选项:
$ orgnote [TAB]
init new list status publish generate server deploy help version
自动补全命令:
$ orgnote i[TAB]
$ orgnote init
更新记录¶
2016-04-03 Leslie Zhu <pythonisland@gmail.com>
- orgnote/parser.py (OrgNote.contain_page): use bs4 html parser
(OrgNote.contain_page): use pygments code highlight
2016-03-12 Leslie Zhu <pythonisland@gmail.com>
- orgnote/parser.py (OrgNote.do_generate):
In emacs batch mode, use scripts/init-orgnote.el can generate highlight code in htm this will force generate all raw-html again in emacs batch mode, work as a backed feature.
generate options: all: re-generate all notes’s raw-html file xxx.org: re-generate the note’s raw-html file num: re-generate last num notes’s raw-html file blank: ignore raw-html re-generate step
2016-03-10 Leslie Zhu <pythonisland@gmail.com>
- orgnote/parser.py (OrgNote.scan): update note filename in scan function
2016-03-09 Leslie Zhu <pythonisland@gmail.com>
- orgnote/parser.py: sort the links in _config.yml
- orgnote/config.py: add sidebar_contact configure item
2016-03-07 Leslie Zhu <pythonisland@gmail.com>
- orgnote/util.py: update the note file glob regex
2014-12-08 Leslie Zhu <pythonisland@gmail.com>
- 0.4.0:
- use YAML configure file, not use .ini file anymore
- all speciall config read from YAML configure file
- the public url format with yeam/month/date
- auto publish the file user input, not publish all in backend
- the default org file init wiht configure options
2014-11-24 Leslie Zhu <pythonisland@gmail.com>
- 0.3.0: new design
- add Config system, so user can configure OrgNote easy
- add setup.py, so user can install it as a python package
- add more command like init,`list`..etc, so it more Hexo-like
- only support default theme
- only support emacs org-html.el convert,not use HTML parser in this verion
2014-11-13 Leslie Zhu <pythonisland@gmail.com>
- 0.2.0: the basic functions ready
- orgnote.py: split homepage as small pages
2014-10-13 Leslie Zhu <pythonisland@gmail.com>
- 0.1.4: add feature show the notes by month in slidebar.