「Markdown」の版間の差分
提供: MacWiki
(Marked から Marked 2 に変更) |
|||
行4: | 行4: | ||
* [[Wikipedia:Markdown]] | * [[Wikipedia:Markdown]] | ||
− | * [http:// | + | * [http://qiita.com/higuma/items/3344387e0f2cce7f2cfe Markdown文法まとめ - Qiita] |
== 関連するソフトウェア == | == 関連するソフトウェア == | ||
− | === Marked === | + | === Marked 2 === |
− | * [http:// | + | * [http://marked2app.com/ Marked 2 - Smarter tools for smarter writers] |
− | * [ | + | * [https://itunes.apple.com/jp/app/marked-2/id890031187?mt=12 Marked 2 - Mac App Store] |
− | * [http:// | + | * [http://marked2app.com/help/ Marked Help] |
* [http://support.markedapp.com/ Marked Support] | * [http://support.markedapp.com/ Marked Support] | ||
行18: | 行18: | ||
* [http://www.mathjax.org/resources/docsindex/ MathJax documentation] | * [http://www.mathjax.org/resources/docsindex/ MathJax documentation] | ||
− | * [ | + | * [[Wikipedia:MathJax]] |
例えば以下のような標準テキストだと、最初のTitle等のメタデータは非表示になり、数式は解釈されて表示される。 | 例えば以下のような標準テキストだと、最初のTitle等のメタデータは非表示になり、数式は解釈されて表示される。 | ||
行109: | 行109: | ||
write messageText to file tmpFile as «class utf8» | write messageText to file tmpFile as «class utf8» | ||
close access file tmpFile | close access file tmpFile | ||
− | tell application "Marked" | + | tell application "Marked 2" |
activate | activate | ||
open tmpFile as alias | open tmpFile as alias | ||
行119: | 行119: | ||
* MacJournal で選択しているエントリー(標準テキスト)を Marked で開く | * MacJournal で選択しているエントリー(標準テキスト)を Marked で開く | ||
<pre> | <pre> | ||
− | tell | + | tell application "MacJournal" |
activate | activate | ||
− | set selectedEntries to selected entries | + | -- set selectedEntries to selected entries |
+ | set selectedEntries to a reference to selected entries as list | ||
if (count items of selectedEntries) = 0 then | if (count items of selectedEntries) = 0 then | ||
display dialog "標準テキストのエントリーを選択してから実行してください" buttons {"OK"} giving up after 5 default button 1 | display dialog "標準テキストのエントリーを選択してから実行してください" buttons {"OK"} giving up after 5 default button 1 | ||
行129: | 行130: | ||
set entryPath to content file of anEntry | set entryPath to content file of anEntry | ||
tell application "System Events" to set entryInfo to properties of (entryPath as alias) | tell application "System Events" to set entryInfo to properties of (entryPath as alias) | ||
− | if kind of entryInfo is not " | + | if kind of entryInfo is not "標準テキスト書類" then exit repeat |
− | tell application "Marked" | + | tell application "Marked 2" |
activate | activate | ||
open entryPath as alias | open entryPath as alias |
2014年7月27日 (日) 15:15時点における版
Markdown とは?
Markdown は軽量マークアップ言語の1つ。詳しくは以下のところを参照して下さい。
関連するソフトウェア
Marked 2
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
- Mou - Markdown editor for web developers, on Mac OS X
- 参考情報:全部無料で。EvernoteにMarkdownで書いたCSS対応の文書を投稿するやり方- 三等兵(2012-06-02)
Preferences で Enable Math にチェックを入れると、TeXをインストールしていない環境でもMathJaxを利用して数式等をきれいに表示できる。
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 2" activate open tmpFile as alias end tell end repeat end tell
- MacJournal で選択しているエントリー(標準テキスト)を Marked で開く
tell application "MacJournal" activate -- set selectedEntries to selected entries set selectedEntries to a reference to selected entries as list 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 2" activate open entryPath as alias end tell end repeat end repeat end tell