summaryrefslogtreecommitdiff
path: root/_plugins/admonition_md.rb
blob: 614e09a3960868cbaa44d70b7ce96b1be5a094fe (plain)
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
module Jekyll
	class AdmonitionMarkdownBlock < Liquid::Block
		@type = ""

		def initialize(tag_name, text, tokens)
			super

			@type = text
		end

		require "redcarpet"

		def render(context)
			content = super

			'<div class="admonitionblock">
				<table>
					<tbody>
						<tr>
							<td class="icon">
								<div class="title">' + @type + '</div>
							</td>
							<td class="content">
								<div class="paragraph">' +
									Redcarpet::Markdown.new(Redcarpet::Render::HTML).render(content) + '
								</div>
							</td>
						</tr>
					</tbody>
				</table>
			</div>'
		end
	end
end

Liquid::Template.register_tag('admonition_md', Jekyll::AdmonitionMarkdownBlock)