zoukankan      html  css  js  c++  java
  • 如何使用bluecloth

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

    BlueCloth is a Ruby implementation of Markdown, a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).
    bluecloth作为老牌的著名rubygem扩展,其拥有稳定的性能和庞大的用户群体。最近bluecloth升级至2.0,其最大的改变为重写了转换核心,使得转换速度提升了不少。

    bluecloth的使用非常简单,如下面代码所示

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

      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个__

    更多内容请参考这里

  • 相关阅读:
    table 如何不越过父级div
    sqlite3_column_type 与 SQLITE_NULL的区别
    lua 协程的理解
    linux 信号
    linux 查看文件夹大小
    linux 僵屍进程
    软件架构的理解
    jquery正则表达式
    linux C遍历目录下文件
    linux 进程间同步互斥
  • 原文地址:https://www.cnblogs.com/nbkhic/p/2114840.html
Copyright © 2011-2022 走看看