raindown 0.25.4 → 0.25.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/lexemes/endpoint_lexeme.rb +1 -1
- data/lib/raindown/variables.rb +3 -2
- data/lib/raindown.rb +15 -12
- data/lib/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bc25f6ab6c241d112ddc7bfa9eba374ae62156f1664dfd3fcb236e27253c6d69
|
|
4
|
+
data.tar.gz: e3ebcad9b3481cfa905ac9380440696337cb0991f6e3489d7181d6940bad53f9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4af4c1dcc4f12de88af50c3dfffe976a44ac36b62eea991f5a63526b2cc9fb3270d79a51f7ae3dbdc7ea8b904facec2afd97ee6e853aa65d1f5515e9885b9371
|
|
7
|
+
data.tar.gz: 4e204309e4aa39e3ac8bb7e50830dda6de508d18db77130ac4415d896382070d7d148c3580cb3e7712628c58f4ab17721fe9837773168b611ece8b7f22fbe9c0
|
data/lib/raindown/variables.rb
CHANGED
|
@@ -60,8 +60,9 @@ module Raindown
|
|
|
60
60
|
end
|
|
61
61
|
alias inspect to_s
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
# Antlers' compiled templates read a variable by calling it. Unknown names are nil.
|
|
64
|
+
def method_missing(name, *)
|
|
65
|
+
@values[name.to_sym]
|
|
65
66
|
end
|
|
66
67
|
|
|
67
68
|
def respond_to_missing?(*)
|
data/lib/raindown.rb
CHANGED
|
@@ -33,12 +33,16 @@ module Raindown
|
|
|
33
33
|
CODE_BRACES = { '{' => "\u{E000}", '}' => "\u{E001}" }.freeze
|
|
34
34
|
CODE_BRACE_ENTITIES = { "\u{E000}" => '{', "\u{E001}" => '}' }.freeze
|
|
35
35
|
|
|
36
|
-
#
|
|
37
|
-
MARKDOWN_OPTIONS = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
# GitHub's extensions and heading ids as Commonmarker is plain CommonMark without them. Front matter is left out.
|
|
37
|
+
MARKDOWN_OPTIONS = {
|
|
38
|
+
extension: { alerts: true, front_matter_delimiter: '---', strikethrough: true, table: true, autolink: true,
|
|
39
|
+
tasklist: true, shortcodes: true, header_ids: '' }
|
|
40
|
+
}.freeze
|
|
41
|
+
# Directives are HTML comments until Antlers renders them and escaped characters like "\#" stay plain text.
|
|
42
|
+
HTML_OPTIONS = { **MARKDOWN_OPTIONS, render: { unsafe: true, hardbreaks: true, escaped_char_spans: false } }.freeze
|
|
43
|
+
# Highlighted code blocks look like <pre lang="ruby" style="…"> and others like <pre><code class="language-ruby">.
|
|
44
|
+
HIGHLIGHTED_OPTIONS = { **HTML_OPTIONS, render: { **HTML_OPTIONS[:render], github_pre_lang: true } }.freeze
|
|
45
|
+
HIGHLIGHTER = { syntax_highlighter: { theme: 'base16-ocean.dark' } }.freeze
|
|
42
46
|
|
|
43
47
|
# Stands in for an app's metadata when there isn't any, so list: lists nothing.
|
|
44
48
|
module NoMetadata
|
|
@@ -118,17 +122,16 @@ module Raindown
|
|
|
118
122
|
doc = parse_markdown(hide_directives(markdown: TableFormatter.gfm(markdown)))
|
|
119
123
|
preserve_code(doc:)
|
|
120
124
|
|
|
121
|
-
html = highlight_code?
|
|
125
|
+
html = if highlight_code?
|
|
126
|
+
doc.to_html(options: HIGHLIGHTED_OPTIONS, plugins: HIGHLIGHTER)
|
|
127
|
+
else
|
|
128
|
+
doc.to_html(options: HTML_OPTIONS)
|
|
129
|
+
end
|
|
122
130
|
html = html.gsub('<!-- ANTLERS', '<{').gsub('ANTLERS -->', '}>')
|
|
123
131
|
# Each placeholder's found as text, which is several times faster than a regex of both.
|
|
124
132
|
CODE_BRACE_ENTITIES.reduce(html) { |text, (brace, entity)| text.gsub(brace, entity) }
|
|
125
133
|
end
|
|
126
134
|
|
|
127
|
-
# Code blocks without highlighting, with a language class for highlighting in the browser.
|
|
128
|
-
def unhighlighted_html(doc:)
|
|
129
|
-
doc.to_html(options: UNHIGHLIGHTED_OPTIONS, plugins: { syntax_highlighter: nil })
|
|
130
|
-
end
|
|
131
|
-
|
|
132
135
|
# Commonmarker escapes directives, so they're hidden in HTML comments until it's done.
|
|
133
136
|
def hide_directives(markdown:)
|
|
134
137
|
markdown.gsub('<{', '<!-- ANTLERS').gsub('}>', 'ANTLERS -->').force_encoding('UTF-8')
|
data/lib/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: raindown
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.25.
|
|
4
|
+
version: 0.25.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- maedi
|
|
@@ -15,28 +15,28 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 1.5.
|
|
18
|
+
version: 1.5.5
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 1.5.
|
|
25
|
+
version: 1.5.5
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: commonmarker
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
|
-
- - "
|
|
30
|
+
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '0'
|
|
32
|
+
version: '3.0'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
|
-
- - "
|
|
37
|
+
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '0'
|
|
39
|
+
version: '3.0'
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: csv
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|