分享

Vim中使用Markdown撰写Wordpress博文 | Cherrot

 看见就非常 2012-05-14

作为一名coder,你是不是向我一样厌倦了在网页中写博客的工作?是不是向我一样想着如果写博客也能像写代码一样轻松惬意?

那么你可能听说了markdown,也听说了Octopress,但是用Wordpress用习惯了懒得去换博客系统,或者喜欢数据库保存博客的方式而不是全静态化的方式?

其实,Wordpress也可以使用markdown来撰写博文,可以轻轻松松地在vim中写文章,而且拥有markdown语法高亮功能,让你所见即所想地撰写博客!

我不需要重复造轮子了,把链接奉献给各位:

关于markdown的语法,推荐下面的链接:

可能是我看的不仔细或者哪里操作有误吧,单纯安装了vim-markdown插件后并不能在vim中自动对 .md 或 .mkd 等文件定义filetype 并启用markdown语法高亮。不过解决方法也很简单,参考的这篇文章

mkdir ~/.vim/syntax
mkdir ~/.vim/ftdetect
ln -s ~/.vim/bundle/vim-markdown/syntax/markdown.vim ~/.vim/syntax/
ln -s ~/.vim/bundle/vim-markdown/ftdetect/markdown.vim ~/.vim/ftdetect/

说明一下:

  • ~/.vim/syntax中存放关键的语法解析文件,里面是关于语法高亮的详细定义。
  • ~/.vim/ftdetect中存放自动解析文件类型的定义文件。

下面是github最新版本中的定义方式,支持的后缀名包括花括号中的内容,如果有新的定义,可以自己添加
au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} set filetype=mkd

CodeHilite支持语言列表(输入命令 pygmentize -L lexers | grep ‘^*’ 查看):

* Cucumber, cucumber, Gherkin, gherkin:
* abap:
* ada, ada95ada2005:
* ahk:
* antlr-as, antlr-actionscript:
* antlr-cpp:
* antlr-csharp, antlr-c#:
* antlr-java:
* antlr-objc:
* antlr-perl:
* antlr-python:
* antlr-ruby, antlr-rb:
* antlr:
* apacheconf, aconf, apache:
* applescript:
* as, actionscript:
* as3, actionscript3:
* aspx-cs:
* aspx-vb:
* asy, asymptote:
* basemake:
* bash, sh, ksh:
* bat:
* bbcode:
* befunge:
* blitzmax, bmax:
* boo:
* brainfuck, bf:
* c-objdump:
* c:
* cfm:
* cfs:
* cheetah, spitfire:
* clojure, clj:
* cmake:
* coffee-script, coffeescript:
* common-lisp, cl:
* console:
* control:
* cpp, c++:
* cpp-objdump, c++-objdumb, cxx-objdump:
* csharp, c#:
* css+django, css+jinja:
* css+erb, css+ruby:
* css+genshitext, css+genshi:
* css+mako:
* css+myghty:
* css+php:
* css+smarty:
* css:
* cython, pyx:
* d-objdump:
* d:
* delphi, pas, pascal, objectpascal:
* diff, udiff:
* django, jinja:
* dpatch:
* duel, Duel Engine, Duel View, JBST, jbst, JsonML+BST:
* dylan:
* erb:
* erl:
* erlang:
* evoque:
* factor:
* felix, flx:
* fortran:
* gas:
* genshi, kid, xml+genshi, xml+kid:
* genshitext:
* glsl:
* gnuplot:
* go:
* gooddata-cl:
* groff, nroff, man:
* haml, HAML:
* haskell, hs:
* html+cheetah, html+spitfire:
* html+django, html+jinja:
* html+evoque:
* html+genshi, html+kid:
* html+mako:
* html+myghty:
* html+php:
* html+smarty:
* html+velocity:
* html:
* hx, haXe:
* hybris, hy:
* ini, cfg:
* io:
* ioke, ik:
* irc:
* jade, JADE:
* java:
* js+cheetah, javascript+cheetah, js+spitfire, javascript+spitfire:
* js+django, javascript+django, js+jinja, javascript+jinja:
* js+erb, javascript+erb, js+ruby, javascript+ruby:
* js+genshitext, js+genshi, javascript+genshitext, javascript+genshi:
* js+mako, javascript+mako:
* js+myghty, javascript+myghty:
* js+php, javascript+php:
* js+smarty, javascript+smarty:
* js, javascript:
* jsp:
* lhs, literate-haskell:
* lighty, lighttpd:
* llvm:
* logtalk:
* lua:
* make, makefile, mf, bsdmake:
* mako:
* maql:
* mason:
* matlab, octave:
* matlabsession:
* minid:
* modelica:
* modula2, m2:
* moocode:
* mupad:
* mxml:
* myghty:
* mysql:
* nasm:
* newspeak:
* nginx:
* numpy:
* objdump:
* objective-c, objectivec, obj-c, objc:
* objective-j, objectivej, obj-j, objj:
* ocaml:
* ooc:
* perl, pl:
* php, php3, php4, php5:
* postscript:
* pot, po:
* pov:
* prolog:
* properties:
* protobuf:
* py3tb:
* pycon:
* pytb:
* python, py:
* python3, py3:
* ragel-c:
* ragel-cpp:
* ragel-d:
* ragel-em:
* ragel-java:
* ragel-objc:
* ragel-ruby, ragel-rb:
* ragel:
* raw:
* rb, ruby, duby:
* rbcon, irb:
* rconsole, rout:
* rebol:
* redcode:
* rhtml, html+erb, html+ruby:
* rst, rest, restructuredtext:
* sass, SASS:
* scala:
* scaml, SCAML:
* scheme, scm:
* scss:
* smalltalk, squeak:
* smarty:
* sourceslist, sources.list:
* splus, s, r:
* sql:
* sqlite3:
* squidconf, squid.conf, squid:
* ssp:
* tcl:
* tcsh, csh:
* tex, latex:
* text:
* trac-wiki, moin:
* v:
* vala, vapi:
* vb.net, vbnet:
* velocity:
* vim:
* xml+cheetah, xml+spitfire:
* xml+django, xml+jinja:
* xml+erb, xml+ruby:
* xml+evoque:
* xml+mako:
* xml+myghty:
* xml+php:
* xml+smarty:
* xml+velocity:
* xml:
* xquery, xqy:
* xslt:
* yaml:

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多