「Markdown」の版間の差分
提供: MacWiki
行15: | 行15: | ||
* [http://support.markedapp.com/ Marked Support] | * [http://support.markedapp.com/ Marked Support] | ||
− | Markdownなどの形式で書かれたUTF-8の標準テキスト(プレーンテキスト)を解釈して表示するビューアーです。拡張されたMarkdownを解釈でき、[[TeX]] | + | Markdownなどの形式で書かれたUTF-8の標準テキスト(プレーンテキスト)を解釈して表示するビューアーです。拡張されたMarkdownを解釈でき、[[TeX]]をインストールしていない環境でもMathJaxを利用して数式等をきれいに表示したり、プログラミング言語のコードをシンタックスハイライトして表示することもできる。 |
+ | |||
+ | * [http://www.mathjax.org/resources/docsindex/ MathJax documentation] | ||
+ | * [http://en.wikipedia.org/wiki/MathJax MathJax - Wikipedia] | ||
+ | |||
+ | 例えば以下のような標準テキストだと、最初のTitle等のメタデータは非表示になり、数式は解釈されて表示される。 | ||
<pre> | <pre> | ||
行22: | 行27: | ||
Date: 2012-07-16 | Date: 2012-07-16 | ||
− | # | + | # <span style="color:red">二項定理</span>の話 |
## はじめに | ## はじめに | ||
行42: | 行47: | ||
| 5 | \\(a^5 + 5a^4b + 10a^3b^2 + 10a^2b^3 + 5ab^4 + b^5\\) | | | 5 | \\(a^5 + 5a^4b + 10a^3b^2 + 10a^2b^3 + 5ab^4 + b^5\\) | | ||
− | 一般に\\(n\\) | + | 一般に\\(n\\)乗の場合は以下のようになる[^fn1]。 |
\\[ | \\[ | ||
\text{二項定理: } (a+b)^n = \sum_{k=0}^n \binom{n}{k}a^{n-k}b^k | \text{二項定理: } (a+b)^n = \sum_{k=0}^n \binom{n}{k}a^{n-k}b^k | ||
行50: | 行55: | ||
この式\eqref{binomial_theorem}より〜 | この式\eqref{binomial_theorem}より〜 | ||
+ | |||
+ | [^fn1]: \\(\binom{n}{k}\\) は \\({}_n\mathrm{C}_k\\) と同じ | ||
## 参考 | ## 参考 |
2012年7月22日 (日) 19:43時点における版
Markdown とは?
Markdown は軽量マークアップ言語の1つ。詳しくは以下のところを参照して下さい。
- Wikipedia:Markdown
- Markdown文法の全訳 - blog::2310(2008-05-30)
関連するソフトウェア
Marked
Markdownなどの形式で書かれたUTF-8の標準テキスト(プレーンテキスト)を解釈して表示するビューアーです。拡張されたMarkdownを解釈でき、TeXをインストールしていない環境でもMathJaxを利用して数式等をきれいに表示したり、プログラミング言語のコードをシンタックスハイライトして表示することもできる。
例えば以下のような標準テキストだと、最初のTitle等のメタデータは非表示になり、数式は解釈されて表示される。
Title: 下書き Author: わたくし Date: 2012-07-16 # <span style="color:red">二項定理</span>の話 ## はじめに \\(a\\)と\\(b\\)の和の2乗を計算すると \\[ \eqalign{ (a+b)^2 &= (a+b)(a+b) \\ &= a^2 + ab + ba + b^2 \\ &= a^2 + 2ab + b^2 } \\] となる。3乗、4乗、⋯と進めていくと、以下のようになる。 | \\(k\\) | \\((a+b)^k\\) | |:-------:|:------------------------------------------------------| | 3 | \\(a^3 + 3a^2b + 3ab^2 + b^3\\) | | 4 | \\(a^4 + 4a^3b + 6a^2b^2 + 4ab^3 + b^4\\) | | 5 | \\(a^5 + 5a^4b + 10a^3b^2 + 10a^2b^3 + 5ab^4 + b^5\\) | 一般に\\(n\\)乗の場合は以下のようになる[^fn1]。 \\[ \text{二項定理: } (a+b)^n = \sum_{k=0}^n \binom{n}{k}a^{n-k}b^k \tag{1} \label{binomial_theorem} \\] この式\eqref{binomial_theorem}より〜 [^fn1]: \\(\binom{n}{k}\\) は \\({}_n\mathrm{C}_k\\) と同じ ## 参考 * [二項定理 - Wikipedia](http://ja.wikipedia.org/wiki/%E4%BA%8C%E9%A0%85%E5%AE%9A%E7%90%86)
Mou
Markdown editor (for MacOSX 10.7+)
AppleScript
- Markdown から XHTML を生成する(テキストエディットの最前面の文書を処理)
Perl で書かれた Markdown.pl(Daring Fireball: Markdown からダウンロードできる)を利用します。Markdown.pl は好きなところに置いていいですが、ここでは /Applications/Markdown_1.0.1/ のフォルダ内に置かれていると仮定しています。
tell application "TextEdit" activate if not (exists front document) then return if not (exists path of front document) then display dialog "文書を標準テキストで保存してから実行して下さい" buttons {"OK"} giving up after 5 default button 1 return end if set thePath to path of front document -- 最前面の文書のパス set perlCode to quoted form of "/Applications/Markdown_1.0.1/Markdown.pl" -- Markdown.pl を /Applications/Markdown_1.0.1/ に置いた場合 -- set perlCode to quoted form of (POSIX path of (path to applications folder) & "Markdown_1.0.1/Markdown.pl") set newText to do shell script "perl " & perlCode & space & quoted form of thePath set newDoc to make new document -- 新規文書として作成する場合 -- set newDoc to front document -- 元の文書と置き換える場合 set text of newDoc to newText end tell
- Mail.app で選択しているメッセージを Marked で開く
メールが Markdown の形式で書かれていれば便利かもしれません
tell application "Mail" activate set selectedMessages to selection if (count items of selectedMessages) = 0 then display dialog "メッセージを選択してから実行してください" buttons {"OK"} giving up after 5 default button 1 end if -- 選択されたメッセージを temporary items フォルダに保存する repeat with aMessage in selectedMessages set messageText to (content of aMessage) as string set tmpName to "Mail_" & message id of aMessage & ".txt" set tmpFile to ((path to temporary items from user domain) as string) & tmpName open for access file tmpFile with write permission write messageText to file tmpFile as «class utf8» close access file tmpFile tell application "Marked" activate open tmpFile as alias end tell end repeat end tell
- MacJournal で選択しているエントリー(標準テキスト)を Marked で開く
tell front document of application "MacJournal" activate set selectedEntries to selected entries if (count items of selectedEntries) = 0 then display dialog "標準テキストのエントリーを選択してから実行してください" buttons {"OK"} giving up after 5 default button 1 end if repeat with anEntry in selectedEntries repeat 1 times set entryPath to content file of anEntry tell application "System Events" to set entryInfo to properties of (entryPath as alias) if kind of entryInfo is not "標準テキスト" then exit repeat tell application "Marked" activate open entryPath as alias end tell end repeat end repeat end tell