-
Notifications
You must be signed in to change notification settings - Fork 10
/
config.rb
60 lines (48 loc) · 1.26 KB
/
config.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
###
# Page options, layouts, aliases and proxies
###
set :version, "3.8.3"
activate :i18n, langs: %i[en zh-CN], mount_at_root: :en
set :markdown_engine, :redcarpet
set :markdown, fenced_code_blocks: true,
gh_blockcode: true,
tables: true,
# 避免 Ruby 的变量 foo_bar_dar 被认为下划线
no_intra_emphasis: true,
underline: true,
disable_indented_code_blocks: true,
autolink: true,
html: true
# Per-page layout changes:
#
# With no layout
page "/*.xml", layout: false
page "/*.json", layout: false
page "/*.txt", layout: false
page "/docs/*", layout: "docs"
configure :development do
activate :livereload
end
activate :directory_indexes
###
# Helpers
###
# Methods defined in the helpers block are available in templates
helpers do
def markdown(&block)
raise ArgumentError, "Missing block" unless block_given?
content = capture_html(&block)
puts content
concat Tilt["markdown"].new { content }.render
end
end
# Build-specific configuration
configure :build do
# Minify CSS on build
activate :minify_css
# Minify Javascript on build
activate :minify_javascript
end
after_build do |_builder|
`cp CNAME build/CNAME`
end