Vim - previmを更新してtextileプレビューに対応しました

previmを更新しました。
今回の変更でtextileも同様にプレビュー出来るようになっています。

サンプル

以下のサンプルコードがあるとして。
(ちなみにコードの中身はhttp://borgar.github.io/textile-js/から引用しています)

h1. Using this tool

This page lets you create HTML by entering text in a simple format that's easy to read and write.

* Type Textile text in the left window
* See the HTML in the right

Textile is a lightweight markup language billed as a "humane web text editor". It originated in the blogging software Textpattern. 

"It is described as":http://textile.thresholdstate.com/:

bq. Textile takes plain text with *simple* markup and produces valid XHTML. It's used in web applications, content management systems, blogging software and online forums. Try it for yourself with the Textile quick reference and preview.

This document is written in Textile; you can see the plain-text version on the left.  To get a feel for Textile's syntax, type some text into the left window and watch the results in the right.  You can see a Textile syntax guide by switching the right-hand window from _Preview_ to _Syntax Guide_.

Textile-js is a JavaScript port of Textile.  You can get the full source code from its "GitHub repository":https://github.com/borgar/js-textile.

**Start with a "(clear)blank page (clear text)":# or edit this document in the left window.**

適当なファイル名で保存します。
仮に拡張子.textileとしても、標準のVimではファイルタイプは無いままだと思います。
ですので:set filetype=textileとして明示的にファイルタイプを変更してください。

あとはMarkdownの時と同じです。
:PrevimOpenが使えるようになりますので、実行してブラウザを起動します。
保存する度にブラウザの表示が反映されます。

f:id:kanno_kanno:20140329125006p:plain

他のフォーマットについて

今回の修正で、構造的には色々なフォーマットに対応しやすくしました。
やりたかったことのメインはこっち。
JavaScriptの変換ライブラリさえあればすぐに対応出来るようになりました。
reStructuredTextとかも対応したかったんですが、まだJavaScriptの変換ライブラリはなさそう。

おわりに

よろしければお使いください。