tdiary-style-markdown 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +12 -1
- data/lib/tdiary/style/markdown.rb +6 -8
- data/lib/tdiary/style/markdown/version.rb +1 -1
- data/tdiaty-style-markdown.gemspec +1 -1
- data/test/tdiary/style/markdown-test.rb +23 -16
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 813eba40c02dfa8d534b87fa14f7afa019b6c3e4
|
4
|
+
data.tar.gz: 66c14010055ff983960bc368eef48caa029a99e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db1f5f7bb6dd4bfe204c4e37a6d08ce643fc166de0dd45dafed3588b9a3e3c50f9dde9967e9d6c1f2dd0cf62f44cc82266fa60172d80d2a5fc4878beb7a22ae9
|
7
|
+
data.tar.gz: 76ab1c326848a3a1b3eaad4be613d1d56bcfc465f61fbc4a4dfa02da2bd2e655fa0a3f586281a80a9f96118e403cde8ece8138604409a2a6fb8c7087d73aa182
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -20,10 +20,21 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
|
23
|
+
If you want to use this style, add @style into tdiary.conf below:
|
24
24
|
|
25
25
|
@style = 'Markdown'
|
26
26
|
|
27
|
+
### Style sheet
|
28
|
+
|
29
|
+
Use [rouge](https://github.com/jneen/rouge) for syntax highlighting.
|
30
|
+
|
31
|
+
```text
|
32
|
+
$ rougify style github > public/github.css
|
33
|
+
```
|
34
|
+
|
35
|
+
Add `@import url("/github.css");` to your style sheet via tdiary
|
36
|
+
configuration.
|
37
|
+
|
27
38
|
## Contributing
|
28
39
|
|
29
40
|
1. Fork it
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'redcarpet'
|
2
|
-
require '
|
2
|
+
require 'rouge'
|
3
|
+
require 'rouge/plugins/redcarpet'
|
3
4
|
require 'twitter-text'
|
4
5
|
|
5
6
|
module TDiary
|
@@ -61,7 +62,7 @@ module TDiary
|
|
61
62
|
end
|
62
63
|
|
63
64
|
# 2. Apply markdown conversion
|
64
|
-
renderer = Redcarpet::Markdown.new(
|
65
|
+
renderer = Redcarpet::Markdown.new(HTMLwithRouge,
|
65
66
|
fenced_code_blocks: true,
|
66
67
|
tables: true,
|
67
68
|
autolink: true,
|
@@ -124,7 +125,7 @@ module TDiary
|
|
124
125
|
end
|
125
126
|
end
|
126
127
|
|
127
|
-
footnote_stashes =
|
128
|
+
footnote_stashes = HTMLwithRouge.tdiary_style_markdown_footnote_stashes
|
128
129
|
footnote_stashes.each do |num, raw_content|
|
129
130
|
if r["@@tdiary-style-markdown-footnote-#{num}@@"]
|
130
131
|
r["@@tdiary-style-markdown-footnote-#{num}@@"] = raw_content
|
@@ -199,17 +200,14 @@ module TDiary
|
|
199
200
|
end
|
200
201
|
end
|
201
202
|
|
202
|
-
class
|
203
|
+
class HTMLwithRouge < Redcarpet::Render::HTML
|
204
|
+
include Rouge::Plugins::Redcarpet
|
203
205
|
@@tdiary_style_markdown_footnote_stashes = []
|
204
206
|
|
205
207
|
def self.tdiary_style_markdown_footnote_stashes
|
206
208
|
@@tdiary_style_markdown_footnote_stashes
|
207
209
|
end
|
208
210
|
|
209
|
-
def block_code(code, language)
|
210
|
-
Pygments.highlight(code, lexer: language)
|
211
|
-
end
|
212
|
-
|
213
211
|
def footnotes(content)
|
214
212
|
""
|
215
213
|
end
|
@@ -33,8 +33,9 @@ honbun
|
|
33
33
|
<h4>subTitleH4</h4>
|
34
34
|
|
35
35
|
<p>honbun</p>
|
36
|
-
<
|
37
|
-
</pre
|
36
|
+
<pre class="highlight plaintext"><code># comment in code block
|
37
|
+
</code></pre>
|
38
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
38
39
|
</div>
|
39
40
|
EOF
|
40
41
|
assert_equal(@html, @diary.to_html)
|
@@ -171,8 +172,9 @@ http://example.com is example.com
|
|
171
172
|
<div class="section">
|
172
173
|
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
173
174
|
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
174
|
-
<
|
175
|
-
</pre
|
175
|
+
<pre class="highlight ruby"><code><span class="vi">@foo</span>
|
176
|
+
</code></pre>
|
177
|
+
|
176
178
|
<p><a href="http://example.com">http://example.com</a> is example.com</p>
|
177
179
|
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
178
180
|
</div>
|
@@ -282,10 +284,11 @@ http://example.com is example.com
|
|
282
284
|
<div class="section">
|
283
285
|
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
284
286
|
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
285
|
-
<
|
286
|
-
<span class="vi">@foo</span> <span class="o">=</span> <span class="s1"
|
287
|
+
<pre class="highlight ruby"><code> <span class="k">def</span> <span class="nf">class</span>
|
288
|
+
<span class="vi">@foo</span> <span class="o">=</span> <span class="s1">'bar'</span>
|
287
289
|
<span class="k">end</span>
|
288
|
-
</pre
|
290
|
+
</code></pre>
|
291
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
289
292
|
</div>
|
290
293
|
EOF
|
291
294
|
assert_equal(@html, @diary.to_html)
|
@@ -327,8 +330,9 @@ p :some_code
|
|
327
330
|
<div class="section">
|
328
331
|
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
329
332
|
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
330
|
-
<
|
331
|
-
</pre
|
333
|
+
<pre class="highlight ruby"><code><span class="nb">p</span> <span class="ss">:some_code</span>
|
334
|
+
</code></pre>
|
335
|
+
|
332
336
|
<p>@a_matsuda is amatsuda</p>
|
333
337
|
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
334
338
|
</div>
|
@@ -395,9 +399,10 @@ p :some_code
|
|
395
399
|
<div class="section">
|
396
400
|
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
397
401
|
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
398
|
-
<
|
399
|
-
|
400
|
-
</pre
|
402
|
+
<pre class="highlight plaintext"><code>:sushi: は
|
403
|
+
美味しい
|
404
|
+
</code></pre>
|
405
|
+
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
401
406
|
</div>
|
402
407
|
EOF
|
403
408
|
assert_equal(@html, @diary.to_html)
|
@@ -460,8 +465,9 @@ ruby -e "puts \"hello, world.\""
|
|
460
465
|
<div class="section">
|
461
466
|
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
462
467
|
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
463
|
-
<
|
464
|
-
</pre
|
468
|
+
<pre class="highlight plaintext"><code>ruby -e "puts \"hello, world.\""
|
469
|
+
</code></pre>
|
470
|
+
|
465
471
|
<p><code>ruby -e "puts \"hello, world.\""</code></p>
|
466
472
|
|
467
473
|
<p><%=plugin "\0", "\1", "\2"%></p>
|
@@ -490,8 +496,9 @@ NOTE: `{{.NetworkSettings.IPAddress}}` is golang template.
|
|
490
496
|
<%=section_enter_proc( Time.at( 1041346800 ) )%>
|
491
497
|
<h3><%= subtitle_proc( Time.at( 1041346800 ), "subTitle" ) %></h3>
|
492
498
|
<p>Get IP Address of Docker Container:</p>
|
493
|
-
<
|
494
|
-
</pre
|
499
|
+
<pre class="highlight plaintext"><code>% docker inspect -f "{{.NetworkSettings.IPAddress}} {{.Config.Hostname}} # Name:{{.Name}}" `docker ps -q`
|
500
|
+
</code></pre>
|
501
|
+
|
495
502
|
<p>NOTE: <code>{{.NetworkSettings.IPAddress}}</code> is golang template.</p>
|
496
503
|
<%=section_leave_proc( Time.at( 1041346800 ) )%>
|
497
504
|
</div>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tdiary-style-markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenji Okimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redcarpet
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rouge
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.
|
150
|
+
rubygems_version: 2.5.1
|
151
151
|
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: Markdown Style for tDiary
|