SeaPig is converter from markdown to html with marked.js and highlight.js.
SeaPig v0.3.0 で viz.js サポートは実装済みで dot 記法から、グラフ画像を埋め込めるようにはしていたのですが、SeaPig v0.5.0 では、uiflowを内蔵し、uiflow の記法にも対応しました。実装の際に困ったことを記録として残しておきます。
筆者の環境
- VineSeed (Vine Linux 開発版) 64bit
- nodebrew use v4.4.7(LTS)
uiflow 使用に際し、困ったこと
uiflowをライブラリとして使うを参考に実装前に node インタープリタで試してみたのですが、筆者の環境では以下のエラーが出てうまく行きませんでした。
$ node
> var uiflow = require("uiflow");
undefined
> uiflow.compile("[テスト]\nユーザーが見るもの\nユーザがすること\n");
ReferenceError: d is not defined
at Object.uiflow.compile (/home/yasumichi/other/guiflow/node_modules/uiflow/index.js:112:37)
at repl:1:8
at REPLServer.defaultEval (repl.js:262:27)
at bound (domain.js:287:14)
at REPLServer.runBound [as eval] (domain.js:300:12)
at REPLServer.<anonymous> (repl.js:431:12)
at emitOne (events.js:82:20)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:211:10)
at REPLServer.Interface._line (readline.js:550:8)
原因を調査している過程で @tkrkt さんのローカル画像生成サーバ作ってMarkdown記事執筆を加速する - Qiitaという記事に出会い、その途中に以下の記述を見つけました。
※uiflowでエラー出るならこっちで。
$ npm install uiflow@git+https://github.com/tkrkt/uiflow.git#fix-argument-in-compile
という訳で @tkrkt さんの修正版をインストールして同様の実験を行なったところ、問題なく動作しました。(参考:修正版の差分)