.title { text-align: center; margin-bottom: .2em }
.subtitle { text-align: center; font-size: medium; font-weight: bold; margin-top: 0 }
.todo { font-family: monospace; color: red }
.done { font-family: monospace; color: green }
.priority { font-family: monospace; color: orange }
.tag { background-color: #eee; font-family: monospace; padding: 2px; font-size: 80%; font-weight: normal }
.timestamp { color: #bebebe }
.timestamp-kwd { color: #5f9ea0 }
.org-right { margin-left: auto; margin-right: 0px; text-align: right }
.org-left { margin-left: 0px; margin-right: auto; text-align: left }
.org-center { margin-left: auto; margin-right: auto; text-align: center }
.underline { text-decoration: underline }
#postamble p,#preamble p { font-size: 90%; margin: .2em }
p.verse { margin-left: 3% }
pre { border: 1px solid #ccc; padding: 8pt; font-family: monospace; overflow: auto; margin: 1.2em }
pre.src { position: relative; overflow: visible; padding-top: 1.2em }
pre.src::before { display: none; position: absolute; background-color: white; top: -10px; right: 10px; padding: 3px; border: 1px solid black }
pre.src:hover::before { display: inline }
pre.src-asymptote::before { content: "Asymptote" }
pre.src-awk::before { content: "Awk" }
pre.src-C::before { content: "C" }
pre.src-clojure::before { content: "Clojure" }
pre.src-css::before { content: "CSS" }
pre.src-D::before { content: "D" }
pre.src-ditaa::before { content: "ditaa" }
pre.src-dot::before { content: "Graphviz" }
pre.src-calc::before { content: "Emacs Calc" }
pre.src-emacs-lisp::before { content: "Emacs Lisp" }
pre.src-fortran::before { content: "Fortran" }
pre.src-gnuplot::before { content: "gnuplot" }
pre.src-haskell::before { content: "Haskell" }
pre.src-hledger::before { content: "hledger" }
pre.src-java::before { content: "Java" }
pre.src-js::before { content: "Javascript" }
pre.src-latex::before { content: "LaTeX" }
pre.src-ledger::before { content: "Ledger" }
pre.src-lisp::before { content: "Lisp" }
pre.src-lilypond::before { content: "Lilypond" }
pre.src-lua::before { content: "Lua" }
pre.src-matlab::before { content: "MATLAB" }
pre.src-mscgen::before { content: "Mscgen" }
pre.src-ocaml::before { content: "Objective Caml" }
pre.src-octave::before { content: "Octave" }
pre.src-org::before { content: "Org mode" }
pre.src-oz::before { content: "OZ" }
pre.src-plantuml::before { content: "Plantuml" }
pre.src-processing::before { content: "Processing.js" }
pre.src-python::before { content: "Python" }
pre.src-R::before { content: "R" }
pre.src-ruby::before { content: "Ruby" }
pre.src-sass::before { content: "Sass" }
pre.src-scheme::before { content: "Scheme" }
pre.src-screen::before { content: "Gnu Screen" }
pre.src-sed::before { content: "Sed" }
pre.src-sh::before { content: "shell" }
pre.src-sql::before { content: "SQL" }
pre.src-sqlite::before { content: "SQLite" }
pre.src-forth::before { content: "Forth" }
pre.src-io::before { content: "IO" }
pre.src-J::before { content: "J" }
pre.src-makefile::before { content: "Makefile" }
pre.src-maxima::before { content: "Maxima" }
pre.src-perl::before { content: "Perl" }
pre.src-picolisp::before { content: "Pico Lisp" }
pre.src-scala::before { content: "Scala" }
pre.src-shell::before { content: "Shell Script" }
pre.src-ebnf2ps::before { content: "ebfn2ps" }
pre.src-cpp::before { content: "C++" }
pre.src-abc::before { content: "ABC" }
pre.src-coq::before { content: "Coq" }
pre.src-groovy::before { content: "Groovy" }
pre.src-bash::before { content: "bash" }
pre.src-csh::before { content: "csh" }
pre.src-ash::before { content: "ash" }
pre.src-dash::before { content: "dash" }
pre.src-ksh::before { content: "ksh" }
pre.src-mksh::before { content: "mksh" }
pre.src-posh::before { content: "posh" }
pre.src-ada::before { content: "Ada" }
pre.src-asm::before { content: "Assembler" }
pre.src-caml::before { content: "Caml" }
pre.src-delphi::before { content: "Delphi" }
pre.src-html::before { content: "HTML" }
pre.src-idl::before { content: "IDL" }
pre.src-mercury::before { content: "Mercury" }
pre.src-metapost::before { content: "MetaPost" }
pre.src-modula-2::before { content: "Modula-2" }
pre.src-pascal::before { content: "Pascal" }
pre.src-ps::before { content: "PostScript" }
pre.src-prolog::before { content: "Prolog" }
pre.src-simula::before { content: "Simula" }
pre.src-tcl::before { content: "tcl" }
pre.src-tex::before { content: "TeX" }
pre.src-plain-tex::before { content: "Plain TeX" }
pre.src-verilog::before { content: "Verilog" }
pre.src-vhdl::before { content: "VHDL" }
pre.src-xml::before { content: "XML" }
pre.src-nxml::before { content: "XML" }
pre.src-conf::before { content: "Configuration File" }
table { border-collapse: collapse }
caption.t-above { caption-side: top }
caption.t-bottom { caption-side: bottom }
td,th { vertical-align: top }
th.org-right { text-align: center }
th.org-left { text-align: center }
th.org-center { text-align: center }
td.org-right { text-align: right }
td.org-left { text-align: left }
td.org-center { text-align: center }
dt { font-weight: bold }
.footpara { display: inline }
.footdef { margin-bottom: 1em }
.figure { padding: 1em }
.figure p { text-align: center }
.inlinetask { padding: 10px; border: 2px solid gray; margin: 10px; background: #ffffcc }
#org-div-home-and-up { text-align: right; font-size: 70%; white-space: nowrap }
textarea { }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00 }
.org-info-js_info-navigation { border-style: none }
#org-info-js_console-label { font-size: 10px; font-weight: bold; white-space: nowrap }
.org-info-js_search-highlight { background-color: #ffff00; color: #000000; font-weight: bold }
.org-svg { width: 90% }
pre.src { background-color: #292b2e; color: #b2b2b2 }
pre.src { background-color: #292b2e; color: #b2b2b2 }
pre.src { background-color: #292b2e; color: #b2b2b2 }
pre.src { background-color: #292b2e; color: #b2b2b2 }
pre.src { background-color: #292b2e; color: #b2b2b2 }
pre.src { background-color: #292b2e; color: #b2b2b2 }
pre.src { background-color: #292b2e; color: #b2b2b2 }
pre.src { background-color: #292b2e; color: #b2b2b2 }
cnblogs和org2blog使用总结
Table of Contents
- 1. 前言
- 2. 功能
- 3. spacemacs安装cnblogs
- 4. 遇到的坑
- 5. 一些实用的代码
1 前言
只要用过emacs的人,肯定都明白org-mode的强大,无论是记事,写博客,还是进行gtd,都是非常好用的。
作为接触emacs和org-mode一段时间的人,我也按耐不住要用他来写博客了,目前的只在博客园写过博客,
于是经过一番查找,锁定了cnblogs和org2blog这两个插件,下面做下对比。
2 功能
两者配置好后都可以向博客园推送文章,修改文章等等,但由于cnblogs是国人专门为了向博客园发布文章写的插件,
所以功能更专一,默认的快捷键也非常的舒服,c-c c p即可发布一篇新的博客
org2blog相对来说功能更多,但实际用的上的也就那么三四个,而且在全都试用过后,发现cnblogs发布出来
的页面更加好看,所以我最后选择的是cnblogs,即使这个已经好几年没更新了,但确实很好用,感谢作者Open Soure的开源。
3 spacemacs安装cnblogs
在这之前先报一下我的电脑环境情况
- manjaro linux 64位
- emacs 26.1
- spacemacs v200.13
之前emacs的配置是自己来管理的,用着也还算舒服,但自从用了spacemacs之后,我只能说——真香!
好了,回到正题,说下我安装cnblogs的步骤,首先新的插件要放到spacemacs的新的层中:
Configuration layers
然后在该作者的博客中了解到如何配置:
用Emacs管理博客园博客
在上面下载压缩包或者去github找到地址后在本地克隆一份cnblogs插件:
管理博客园博客的Emacs扩展
接下来在emacs中新建层,名为blog,在package.el中填写配置:
(defconst blog-packages ‘( (cnblogs :location local) )) (defun blog/init-cnblogs () (use-package cnblogs) (add-hook ‘org-mode-hook ‘cnblogs-minor-mode) )
在新建的层的目录里新建local文件夹,将插件文件夹重命名为cnblogs,放到local下,这样配置就结束了。
然而事情没那么简单
4 遇到的坑
在完成以上步骤之后,我以为大功告成,可以享受org-mode加上这个插件带来的方便了,毕竟他们的教程里也是
做完这些就顺利使用,而我这里却出了些问题
首先,按照教程先设置登录信息,其中id为自己博客地址栏的那个英文,我的就是recallfuture,
username指的是登录用户名,不是昵称,所以我的还是recallfuture。
设置好后会问是否需要将博客同步到本地,这个选是就可以。
到这里为止也一切顺利,不过接下来当我随便写了点东西发布的时候,却怎么也发布不上去,为了找到问题所在,
我又按照网上的教程配置好了org2blog,结果都是同样的问题:
error in process sentinel: url-http-create-request: Multibyte text in HTTP request: POST /xmlrpc.php HTTP/1.1
接着用各种不同的方式测试,最后发现只要博客中不出现任意中文,就能成功发送…是bug没错了
在百度查询无果,最后在谷歌找到了关于这个bug的讨论:
Why can not support Chinese in the .org file?
bug的原因大意就是, 无法正确计算带有中文的buffer的字节数,于是在向服务器post数据的时候填写了错误的长度数值,
服务器无法正确读取post数据,从而造成无响应的状况。
解决方案是用修复过的xml-rpc.el文件:
xml-rpc.el
用这个替换cnblogs和org2blog插件目录里的xml-rpc.el文件,之后就可以正常发布带中文的博客了
5 一些实用的代码
美化博客中的引用代码,加上自定义snippet:
使用org-mode写cnblogs博客
Date: 2018-06-16 19:01
Author: su
Created: 2018-06-16 六 20:22
原文地址:https://www.cnblogs.com/recallfuture/p/9191308.html