Drkcore

24 08 2011 javascript Tweet

fjkwをMarkdownに対応させた

Node.jsでWikiを作っているわけですが。

jeditableのドキュメントをきちんと読んだら、loadurlでraw_text引っ張ればmarkdownでもなんでもいいらしいので。

wiki.jade

script.jeditable
  $(".editable_textarea").editable("#{title}", { 
      type   : 'textarea',
      submitdata: { _method: "post" },
      name     : 'body',
      loadurl  : '/md/' + "#{title}",
      rows     : 10,
      submit : 'OK',
      cancel : 'cancel',
      cssclass : "editable"
  });

app.js

htmlに変換する前のmarkdown書式のテキストを返すURLを追加した

app.get('/md/:title', function(req, res){
  WikiContent.findOne({title: req.params.title}, function (err, content) {
    res.send(content.body);
  });
});

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021