このリファレンス内では、BlueFeather が拡張した Markdown 記法のことを指して「BFMarkdown 記法」と書く。
BlueFeather
モジュール
BlueFeather.parse(str)
BlueFeather.parse_text(str)
BlueFeather.parse_file(path)
BlueFeather.parse_text_file(path)
BlueFeather.parse_document(str, default_enc = EncodingType::UTF8)
BlueFeather.parse_document_file(path, default_enc = EncodingType::UTF8)
BlueFeather::VERSION
BlueFeather::VERSION_NUMBER
BlueFeather::Document
クラス
BlueFeather::Parser
クラス
BlueFeather::EncodingType
モジュール
BlueFeather
モジュールBlueFeather.parse(str)
BlueFeather.parse_text(str)
BFMarkdown 記法で書かれた文字列をパースして、結果のHTML片(String)を返す。
BlueFeather.parse_file(path)
BlueFeather.parse_text_file(path)
ファイル path
の内容を読み取ってパースし、結果のHTML片(String)を返す。以下の記述と同じ。
BlueFeather.parse_text(File.read(path))
BlueFeather.parse_document(str, default_enc = EncodingType::UTF8)
BFMarkdown 記法で書かれた文字列をパースして、結果のHTML文書を返す。
default_enc は EncodingType 定数で指定することができる。 詳細についてはエンコーディングの取り扱いを参照。
BlueFeather.parse_document_file(path, default_enc = EncodingType::UTF8)
ファイル path
の内容を読み取ってパースし、結果のHTML文書を返す。以下の記述と同じ。
BlueFeather.parse_document(File.read(path), default_enc)
BlueFeather::VERSION
BlueFeather::VERSION_NUMBER
BlueFeather のバージョンを表す定数。VERSION は文字列、VERSION_NUMBER は小数(Float)である。
BlueFeather::Document
クラス文書のメタデータと Markdown テキストの組を保持するクラス。
Document.parse(str, default_enc = EncodingType::UTF8)
BFMarkdown記法で書かれた文字列をパースして、Document オブジェクトを返す。この時点ではテキストの変換は行わない。
default_enc は EncodingType 定数で指定することができる。 詳細についてはエンコーディングの取り扱いを参照。
Document.parse_io(io, default_enc = EncodingType::UTF8)
引数として IO オブジェクトを受け取ること以外は Document.parse
と同じ。
Document.new(headers = {}, body = '')
メタデータ(Hash)とテキスト(String)から、Document オブジェクトを生成して返す。この時点ではテキストの変換は行わない。
headers
body
その文書が持つメタデータ(Hash)と元テキスト(String)へのアクセサ。
self[key]
self[key] = value
メタデータの値を取得/設定する。key
は Symbol か String で、小文字と大文字は区別されない。
title
css
それぞれ doc['title']
, doc['css']
と同じ。
encoding_type
その文書のエンコーディングを取得する。返り値は EncodingType モジュール内の定数か、もしくは nil。
to_html
その文書をHTML文書に変換する。返り値は String。
BlueFeather::Parser
クラスBFMarkdown 記法で書かれたテキストをパースするためのクラス。
BlueFeather.parse
などのメソッドでは、内部的に Parser を生成して使用している。
Parser.new(*restrictions)
Parser オブジェクトを生成する。*restrictions
には以下の Symbol を与えることができる。
parse(str)
parse_text(str)
parse_document(str)
parse_file(path)
parse_text_file(path)
parse_document_file(path)
それぞれ BlueFeather モジュールに定義された同名のメソッドと同じ。
use_header_id
use_header_id = bool
見出しにIDを付ける機能を有効にするかどうかのスイッチ(標準では true)。この機能をオフにすると、BFMarkdown の目次は利用できない。
display_warnings
display_warnings = bool
BlueFeather では不正なIDなどを見つけたときに、出力されるHTMLの中に警告を含める機能がある。これを有効にするかどうかのスイッチ(標準では true)。
BlueFeather::EncodingType
モジュールUTF8
, UTF_8
EUC
, EUCJP
, EUC_JP
SJIS
, SHIFT_JIS
ASCII
, US_ASCII
BlueFeather におけるエンコーディングの種類を表す定数(String)。