Skip to content

Instantly share code, notes, and snippets.

@kozy4324
Last active December 16, 2015 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kozy4324/5405200 to your computer and use it in GitHub Desktop.
Save kozy4324/5405200 to your computer and use it in GitHub Desktop.
Markdown maruku拡張記法 (v0.7.0.beta1)

http://maruku.rubyforge.org/maruku.html

Meta-data to block-level elements and span-level elements

Markdownから出力されるHTML要素に任意の属性を追加できるようにする拡張記法. 基本形は以下.

{: #id .class key=value ref_id}

以下記述例.

paragraph
{: style="margin: 0px"}

# header1
{: style="margin: 1px"}

## header2 {: style="margin: 2px"}

paragraph *emphasis*{: class=emphasis}
{: ref_1}

paragraph 
{: ref_2}

{:ref_1: style="margin: 3px;"}
{ref_2}: style="margin: 4px;"

blockレベルの直後の行に記述できる.

paragraph
{: style="margin: 0px"}

ヘッダーの場合は行末でもよい.

# header1
{: style="margin: 1px"}

## header2 {: style="margin: 2px"}

PHP Markdown Extraと同様にidclassが記述できる.

{: #id .class}

spanレベルへの適用は直後に記述する(spaceを含んではダメ).

paragraph *emphasis*{: class=emphasis}

定義は別に記述してIDで参照する記述も可能.

paragraph
{: ref_1}

paragraph 
{: ref_2}

{:ref_1: style="margin: 3px;"}
{ref_2}: style="margin: 4px;"

参照されるほうのネーミングがattribute lists definitionsAttributeDefinitionListで表記にゆれがあるのが謎. あと記述自体も2パターンいけるっぽい(ドキュメントに記載のあるパターンと内部ロジックを確認して発見したパターン).

Meta-data for the document

email headers形式でドキュメントに対しての属性を設定できる. 以下タイトルを設定する例.

title: A sample of maruku extra syntax

header1
=======

paragraph

サポートされている属性は ドキュメント を参考.

Table of contents

headersからtable of contentsのリストを自動生成してくれる.

* This will become a table of contents (this text will be scraped).
{:toc} 

単一のリストに対して{:toc}を指定する. なお該当のリストアイテム文章は表示されない.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment