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

    更多内容请参考这里

  • 相关阅读:
    js 实现加入收藏/加入首页功能
    js 获取网页宽/高度
    js 飞机大战
    js 实现分享功能
    前端开发的工具,库和资源总结
    网站更新后客户端缓存问题
    js 实现图片无限横向滚动效果
    js 实现 文字打印效果
    js 构造函数创建钟表
    Css3 实现关键帧动画
  • 原文地址:https://www.cnblogs.com/nbkhic/p/2114840.html
Copyright © 2011-2022 走看看