# BloggerでMarkdownを使うために、[marked.js](https://github.com/chjj/marked) 導入中、、、
やりたいことは、
- 基本的な Markdownでの記述
- 数式や行列が表示できること
- 画像が表示できること
いろいろ問題有りつつ、なんとか使い物になりそうになってきたが、
少々クセがあって慣れるの時間がかかりそうです。
Blogger自体にデフォルトでサポートしてほしい!!
もっと簡単な方法を知っている人は教えて下さい!!
## Script
実際に導入したスクリプトは、このページのソース解析して、
<head> 直後と、</body>直前の <script>処理を参照して下さい。
## Markdown記述する時
Markdownを使用したい部分を以下で囲みます。
Markdownを使用
一部の数式を書く時、
上記囲んだ部分に書くと、うまく表示できないことがあります。
そのため、囲みの外に書く必用があります。
面倒くさいですが、、、
# Markdown Basics
## ヘッダー
~~~
# ヘッダー1
## ヘッダー2
### ヘッダー3
~~~
# ヘッダー1
## ヘッダー2
### ヘッダー3
## リンクの書き方
このように書くと
~~~
[marked.js](https://github.com/chjj/marked)
~~~
こうなります。
[marked.js](https://github.com/chjj/marked)
# プログラムコードの記述
## 6文字スペースを文頭に入れる
スペースを入れないと表示が崩れてしまう。
// Code is just text indented a bit
which(is_easy) to_remember();
## 〜〜〜 code 〜〜〜 で挟む方法
文頭に1文字スペースを入れないと、行番号とかぶってしまう、、、
~~~
// Markdown extra adds un-indented code blocks too
if (this_is_more_code == true && !indented) {
// tild wrapped code blocks, also not indented
}
~~~
## 文字装飾など
Emphasis, aka italics, with *asterisks* or _underscores_.
Strong emphasis, aka bold, with **asterisks** or __underscores__.
Combined emphasis with **asterisks and _underscores_**.
Strikethrough uses two tildes. ~~Scratch this.~~
## イメージ・画像


## イメージ・画像2

SVGなどのベクトルファイルも使えるみたい。
## 引用・バッククオート
現状うまく表示できない(泣)
たぶんテーマテンプレートのScript変更が必用だろうけど、
少しいじったが未解決。
> Blockquotes are like quoted text in email replies
>> And, they can be nested
## リスト
* Bullet lists are easy too
- Another one
+ Another one
1. A numbered list
2. Which is numbered
3. With periods and a space
## 文字列フォーマット
現状、入力したとおりに表示され、ラッピングされない。
文字列
Text with
two trailing spaces
(on the right)
can be used
for things like poems
## 罫線
* * * *
****
--------------------------
## テーブル・表
| Header | Header | Right |
| ------ | ------ | -----: |
| Cell | Cell | $10 |
| Cell | Cell | $20 |
| Header | Header | Right
| ------ | ------ | -----:
| Cell | Cell | $10
| Cell | Cell | $20
* Outer pipes on tables are optional
* Colon used for alignment (right versus left)
## Markdown plus definition lists ##
Bottled water
: $ 1.25
: $ 1.55 (Large)
Milk
Pop
: $ 1.75
* Multiple definitions and terms are possible
* Definitions can include multiple paragraphs too
## ABREVIATIONS
*[ABBR]: Markdown plus abbreviations (produces an
tag)
# 数式
## 行の中に数式を埋め込むには \$ \$で挟む
~~~
このように $\theta$ 書くと表示はこうなります。
~~~
このように $\theta$ 書くと表示はこうなります。
## ページの中心に表示する場合は、\$\$ \$\$で挟む
$$
\frac{a}{b}
$$
## 2行にわたる数式
$$
\begin{matrix}
f & = & 2 + x + 3 \\
& = & 5 + x
\end{matrix}
$$
## 行列
インラインの場合は、$\begin{pmatrix}x\\y\end{pmatrix}$
ページ中心の場合は、
### matrix
$$\begin{matrix}x\\y\end{matrix}$$
### pmatrix
$$\begin{pmatrix}x\\y\end{pmatrix}$$
### bmatrix
$$\begin{bmatrix}x\\y\end{bmatrix}$$
## ちょっと複雑な式
目的関数
$$
J(\theta_0, \theta_1) = \frac{1}{2m}\sum^{m}_{i=1}(h_\theta(x^{(i)})-y^{(i)})^2
$$
(カオス・ニューロン・モデル)
$$
x(t+1) = f[a(t)
-a\sum^{t}_{d=0} k^d g(x(t-d)) + \theta]
]
$$
# うまく行かない所・行っていない所
## 投稿内容が思ったように綺麗にレイアウトされてない。
行間幅やフォントが気に入らない。時間があったら調整しよう。
## 一部の数式は、Markdown記述と混在できない
<div></div>囲みの外に数式を記述しなければならないことがある。
## Backquoteによる引用が思ったように表示できない
> これは Blockquote です
## プログラムコード表現の最後に空行が表示されてしまう。
~~~
// comment line
if (this_is_more_code == true && !indented) {
// if code blocks, also not indented
}
~~~
## StackEditも試したが、、
ネットで評判の良い [StackEdit](https://stackedit.io/app) も試してみたが、保留中
- 行列表記一部の数式が思ったように表示できない
- Bloggerに投稿された後、Blogger上で編集しにくい
あまり時間を掛けたくないので、
とりあえずこの辺で妥協しよう。
Comments
Post a Comment