首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

怎么使用bluecloth

2012-10-25 
如何使用blueclothbluecloth是一种ruby语言实现的text to html转换器。关于bluecloth的介绍如下:\#encoding

如何使用bluecloth

bluecloth是一种ruby语言实现的text to html转换器。关于bluecloth的介绍如下:

\#encoding: utf-8require 'rubygems'require 'bluecloth'puts BlueCloth.new(ARGF.read).to_html

将上面的代码保存为bluecloth.rb,然后打开命令行输入

ruby bluecloth.rb 1.txt > 1.html


这样就可以将1.txt转换成hmtl了。bluecloth的转换速度卓绝,哪怕是比较大的txt文档,其转换起来依然是轻松自然,效率高超。
Markdown语法简介

    标题(h1…h7):使用#号来标记。#表示h1, ##表示h2依次类推,如    ## This is h2    列表(li):使用*号来标记。如    * this is the first item    链接(a):[]表示链接文字,后跟()标明链接,如    [google] (http://www.google.com)    code(code):缩进4个空格或1个tab即被当成是code处理    引用(backquote):>表示    加粗(strong):2个*号或者2个__

更多内容请参考[这里] (http://daringfireball.net/projects/markdown/syntax#em)

热点排行