用了这么长时间的octopress总该扩展一点点事情了,在Blogging的时候,总有一些信息是需要被特殊标记的,但是我并不喜欢简单的加粗或是斜体。类似的东西在Apple Document中有很多
Apple Document Note sample
这里我就把这个功能照搬到octopress中了。
1.在plugins目录创建一个notebox.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| module Jekyll
class Notebox < Liquid::Block
def initialize(name, id, tokens)
super
@id = id
end
def render(context)
stressText = paragraphize(super)
source = "#{stressText}
|
"
source
end
def paragraphize(input)
"#{input.lstrip.rstrip.gsub(/\n\n/, ''
).gsub(/\n/, '
')}"
end
end
end
Liquid::Template.register_tag('notebox', Jekyll::Notebox)
2.在sass/custom中的文件_stype.scss的最后添加下面的代码
1
2
3
4
5
6
7
8
9
| .notebox {
border:1px;
border-style: solid;
border-color: #5088C5;
background-color:#fff;
margin:.75em 0 1.5em;
padding:.75em .667em .75em .750em;
text-align:left;
}
|
3.markdown的语法(因为格式问题写成了%,需要替换成%)
{% notebox %}
the text to note
{% endnotebox %}
效果