markdown
比wiki语法要简单,github上的代码几乎都是readme.md,这种易读易写的脚本语言已经变得非常流行.$sudo pip install markdown
$sudo easy install markdown
class Category(models.Model): name = models.CharField(max_length=20) def __unicode__(self): return self.name class Post(models.Model): category = models.ForeignKey(Category) title = models.CharField(max_length=60) body = models.TextField() date = models.DateTimeField(auto_now_add=True) def __unicode__(self): return self.title
from markdown import markdown
for post in posts: post.body = markdown(post.body)
> ## This is a header. > > 1. This is the first list item. > 2. This is the second list item. > > Here‘s some example code: > > return shell_exec("echo $input | $markdown_script");
在Django中使用markdown,布布扣,bubuko.com
原文地址:http://blog.csdn.net/feelang/article/details/25626725