commonmarker 1.0.0.pre6-x86_64-linux → 1.0.0.pre7-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Cargo.lock +52 -2
- data/README.md +36 -20
- data/ext/commonmarker/Cargo.toml +1 -1
- data/ext/commonmarker/src/options.rs +5 -1
- data/lib/commonmarker/3.1/commonmarker.so +0 -0
- data/lib/commonmarker/3.2/commonmarker.so +0 -0
- data/lib/commonmarker/config.rb +2 -1
- data/lib/commonmarker/version.rb +1 -1
- metadata +3 -4
- data/commonmarker.gemspec +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b835cb8791f4bc3c174e543b0a28e2e0a55dfd0f215dc1059f505581c41c9bd
|
4
|
+
data.tar.gz: 9102f14c6de4c6d5fa894321066ab57dc933bb564dd9ec7be6ca03e5cbcb9ee6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 964fe79f32f42ddff91184c4053b4e5c8236217e6ebeb68d74f3b2202f01b1f80df38c2909abab65fcb064282592966ff137aacbac3a9750c1f5f91b5d25e576
|
7
|
+
data.tar.gz: 6ed797f924b9ca48d758d394f5ab411c7f1db14ae0d651b54669f62b4ff37abe01b493b8872866f35cec6c714305b91f5d582a160682f0028912f79218139e00
|
data/Cargo.lock
CHANGED
@@ -167,11 +167,12 @@ dependencies = [
|
|
167
167
|
|
168
168
|
[[package]]
|
169
169
|
name = "comrak"
|
170
|
-
version = "0.
|
170
|
+
version = "0.16.0"
|
171
171
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
172
|
-
checksum = "
|
172
|
+
checksum = "784836d0812dade01579cc0cc9b1684847044e716fd7aa6bffbc172e42199500"
|
173
173
|
dependencies = [
|
174
174
|
"clap",
|
175
|
+
"emojis",
|
175
176
|
"entities",
|
176
177
|
"memchr",
|
177
178
|
"once_cell",
|
@@ -179,6 +180,7 @@ dependencies = [
|
|
179
180
|
"pest_derive",
|
180
181
|
"regex",
|
181
182
|
"shell-words",
|
183
|
+
"slug",
|
182
184
|
"syntect",
|
183
185
|
"typed-arena",
|
184
186
|
"unicode_categories",
|
@@ -213,6 +215,12 @@ dependencies = [
|
|
213
215
|
"typenum",
|
214
216
|
]
|
215
217
|
|
218
|
+
[[package]]
|
219
|
+
name = "deunicode"
|
220
|
+
version = "0.4.3"
|
221
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
222
|
+
checksum = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690"
|
223
|
+
|
216
224
|
[[package]]
|
217
225
|
name = "digest"
|
218
226
|
version = "0.10.6"
|
@@ -243,6 +251,15 @@ dependencies = [
|
|
243
251
|
"winapi",
|
244
252
|
]
|
245
253
|
|
254
|
+
[[package]]
|
255
|
+
name = "emojis"
|
256
|
+
version = "0.5.2"
|
257
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
258
|
+
checksum = "44fe60b864b6544ad211d4053ced474a9b9d2c8d66b77f01d6c6bcfed10c6bf0"
|
259
|
+
dependencies = [
|
260
|
+
"phf",
|
261
|
+
]
|
262
|
+
|
246
263
|
[[package]]
|
247
264
|
name = "entities"
|
248
265
|
version = "1.0.1"
|
@@ -568,6 +585,24 @@ dependencies = [
|
|
568
585
|
"sha1",
|
569
586
|
]
|
570
587
|
|
588
|
+
[[package]]
|
589
|
+
name = "phf"
|
590
|
+
version = "0.11.1"
|
591
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
592
|
+
checksum = "928c6535de93548188ef63bb7c4036bd415cd8f36ad25af44b9789b2ee72a48c"
|
593
|
+
dependencies = [
|
594
|
+
"phf_shared",
|
595
|
+
]
|
596
|
+
|
597
|
+
[[package]]
|
598
|
+
name = "phf_shared"
|
599
|
+
version = "0.11.1"
|
600
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
601
|
+
checksum = "e1fb5f6f826b772a8d4c0394209441e7d37cbbb967ae9c7e0e8134365c9ee676"
|
602
|
+
dependencies = [
|
603
|
+
"siphasher",
|
604
|
+
]
|
605
|
+
|
571
606
|
[[package]]
|
572
607
|
name = "pkg-config"
|
573
608
|
version = "0.3.26"
|
@@ -785,6 +820,21 @@ version = "1.1.0"
|
|
785
820
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
786
821
|
checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
|
787
822
|
|
823
|
+
[[package]]
|
824
|
+
name = "siphasher"
|
825
|
+
version = "0.3.10"
|
826
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
827
|
+
checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
|
828
|
+
|
829
|
+
[[package]]
|
830
|
+
name = "slug"
|
831
|
+
version = "0.1.4"
|
832
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
833
|
+
checksum = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373"
|
834
|
+
dependencies = [
|
835
|
+
"deunicode",
|
836
|
+
]
|
837
|
+
|
788
838
|
[[package]]
|
789
839
|
name = "strsim"
|
790
840
|
version = "0.10.0"
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Ruby wrapper for Rust's [comrak](https://github.com/kivikakk/comrak) crate.
|
|
7
7
|
|
8
8
|
It passes all of the CommonMark test suite, and is therefore spec-complete. It also includes extensions to the CommonMark spec as documented in the [GitHub Flavored Markdown spec](http://github.github.com/gfm/), such as support for tables, strikethroughs, and autolinking.
|
9
9
|
|
10
|
-
For more information on available extensions, see [the documentation below](#
|
10
|
+
For more information on available extensions, see [the documentation below](#extension-options).
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
|
@@ -27,7 +27,7 @@ Or install it yourself as:
|
|
27
27
|
|
28
28
|
### Converting to HTML
|
29
29
|
|
30
|
-
Call `
|
30
|
+
Call `to_html` on a string to convert it to HTML:
|
31
31
|
|
32
32
|
```ruby
|
33
33
|
require 'commonmarker'
|
@@ -68,14 +68,14 @@ Note that there is a distinction in comrak for "parse" options and "render" opti
|
|
68
68
|
| `hardbreaks` | [Soft line breaks](http://spec.commonmark.org/0.27/#soft-line-breaks) translate into hard line breaks. | `true` |
|
69
69
|
| `github_pre_lang` | GitHub-style `<pre lang="xyz">` is used for fenced code blocks with info tags. | `true` |
|
70
70
|
| `width` | The wrap column when outputting CommonMark. | `80` |
|
71
|
-
| `
|
71
|
+
| `unsafe` | Allow rendering of raw HTML and potentially dangerous links. | `false` |
|
72
72
|
| `escape` | Escape raw HTML instead of clobbering it. | `false` |
|
73
73
|
|
74
74
|
As well, there are several extensions which you can toggle in the same manner:
|
75
75
|
|
76
76
|
```ruby
|
77
77
|
Commonmarker.to_html('"Hi *there*"', options: {
|
78
|
-
|
78
|
+
extension: { footnotes: true, description_lists: true },
|
79
79
|
render: { hardbreaks: false}
|
80
80
|
})
|
81
81
|
```
|
@@ -92,34 +92,38 @@ Commonmarker.to_html('"Hi *there*"', options: {
|
|
92
92
|
| `superscript` | Enables the superscript Comrak extension. | `false` |
|
93
93
|
| `header_ids` | Enables the header IDs Comrak extension. from the GFM spec. | `""` |
|
94
94
|
| `footnotes` | Enables the footnotes extension per `cmark-gfm`. | `false` |
|
95
|
-
| `description_lists` | Enables the description lists extension
|
95
|
+
| `description_lists` | Enables the description lists extension. | `false` |
|
96
96
|
| `front_matter_delimiter` | Enables the front matter extension. | `""` |
|
97
|
+
| `shortcodes` | Enables the shortcodes extension. | `true` |
|
97
98
|
|
98
99
|
For more information on these options, see [the comrak documentation](https://github.com/kivikakk/comrak#usage).
|
99
100
|
|
100
101
|
### Plugins
|
101
102
|
|
102
103
|
In addition to the possibilities provided by generic CommonMark rendering, Commonmarker also supports plugins as a means of
|
103
|
-
providing further niceties.
|
104
|
+
providing further niceties.
|
104
105
|
|
105
|
-
|
106
|
-
```ruby
|
107
|
-
def hello
|
108
|
-
puts "hello"
|
109
|
-
end
|
106
|
+
#### Syntax Highlighter Plugin
|
110
107
|
|
111
|
-
|
108
|
+
````ruby
|
109
|
+
code = <<~CODE
|
110
|
+
```ruby
|
111
|
+
def hello
|
112
|
+
puts "hello"
|
113
|
+
end
|
114
|
+
CODE
|
112
115
|
|
113
|
-
|
116
|
+
puts Commonmarker.to_html(code, plugins: { syntax_highlighter: { theme: "InspiredGitHub" } })
|
114
117
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
118
|
+
# <pre style="background-color:#ffffff;" lang="ruby"><code>
|
119
|
+
# <span style="font-weight:bold;color:#a71d5d;">def </span><span style="font-weight:bold;color:#795da3;">hello
|
120
|
+
# </span><span style="color:#62a35c;">puts </span><span style="color:#183691;">"hello"
|
121
|
+
# </span><span style="font-weight:bold;color:#a71d5d;">end
|
122
|
+
# </span>
|
123
|
+
# </code></pre>
|
124
|
+
````
|
121
125
|
|
122
|
-
|
126
|
+
To disable this plugin, pass `nil`:
|
123
127
|
|
124
128
|
```ruby
|
125
129
|
Commonmarker.to_html(code, plugins: { syntax_highlighter: nil })
|
@@ -127,6 +131,18 @@ Commonmarker.to_html(code, plugins: { syntax_highlighter: nil })
|
|
127
131
|
Commonmarker.to_html(code, plugins: { syntax_highlighter: { theme: nil } })
|
128
132
|
```
|
129
133
|
|
134
|
+
##### Available themes
|
135
|
+
|
136
|
+
Here's [a list of available themes](https://docs.rs/syntect/5.0.0/syntect/highlighting/struct.ThemeSet.html#implementations):
|
137
|
+
|
138
|
+
- `"base16-ocean.dark"`
|
139
|
+
- `"base16-eighties.dark"`
|
140
|
+
- `"base16-mocha.dark"`
|
141
|
+
- `"base16-ocean.light"`
|
142
|
+
- `"InspiredGitHub"`
|
143
|
+
- `"Solarized (dark)"`
|
144
|
+
- `"Solarized (light)"`
|
145
|
+
|
130
146
|
## Output formats
|
131
147
|
|
132
148
|
Commonmarker can currently only generate output in one format: HTML.
|
data/ext/commonmarker/Cargo.toml
CHANGED
@@ -29,7 +29,7 @@ fn iterate_parse_options(comrak_options: &mut ComrakOptions, options_hash: RHash
|
|
29
29
|
const RENDER_HARDBREAKS: &str = "hardbreaks";
|
30
30
|
const RENDER_GITHUB_PRE_LANG: &str = "github_pre_lang";
|
31
31
|
const RENDER_WIDTH: &str = "width";
|
32
|
-
const RENDER_UNSAFE: &str = "
|
32
|
+
const RENDER_UNSAFE: &str = "unsafe";
|
33
33
|
const RENDER_ESCAPE: &str = "escape";
|
34
34
|
|
35
35
|
fn iterate_render_options(comrak_options: &mut ComrakOptions, options_hash: RHash) {
|
@@ -68,6 +68,7 @@ const EXTENSION_HEADER_IDS: &str = "header_ids";
|
|
68
68
|
const EXTENSION_FOOTNOTES: &str = "footnotes";
|
69
69
|
const EXTENSION_DESCRIPTION_LISTS: &str = "description_lists";
|
70
70
|
const EXTENSION_FRONT_MATTER_DELIMITER: &str = "front_matter_delimiter";
|
71
|
+
const EXTENSION_SHORTCODES: &str = "shortcodes";
|
71
72
|
|
72
73
|
fn iterate_extension_options(comrak_options: &mut ComrakOptions, options_hash: RHash) {
|
73
74
|
options_hash
|
@@ -103,6 +104,9 @@ fn iterate_extension_options(comrak_options: &mut ComrakOptions, options_hash: R
|
|
103
104
|
Ok(Cow::Borrowed(EXTENSION_FRONT_MATTER_DELIMITER)) => {
|
104
105
|
comrak_options.extension.front_matter_delimiter = try_convert_string(value);
|
105
106
|
}
|
107
|
+
Ok(Cow::Borrowed(EXTENSION_SHORTCODES)) => {
|
108
|
+
comrak_options.extension.shortcodes = value.try_convert::<bool>()?;
|
109
|
+
}
|
106
110
|
_ => {}
|
107
111
|
}
|
108
112
|
Ok(ForEach::Continue)
|
Binary file
|
Binary file
|
data/lib/commonmarker/config.rb
CHANGED
@@ -13,7 +13,7 @@ module Commonmarker
|
|
13
13
|
hardbreaks: true,
|
14
14
|
github_pre_lang: true,
|
15
15
|
width: 80,
|
16
|
-
|
16
|
+
unsafe: false,
|
17
17
|
escape: false,
|
18
18
|
}.freeze,
|
19
19
|
extension: {
|
@@ -27,6 +27,7 @@ module Commonmarker
|
|
27
27
|
footnotes: false,
|
28
28
|
description_lists: false,
|
29
29
|
front_matter_delimiter: nil,
|
30
|
+
shortcodes: true,
|
30
31
|
},
|
31
32
|
format: [:html].freeze,
|
32
33
|
}.freeze
|
data/lib/commonmarker/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commonmarker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.pre7
|
5
5
|
platform: x86_64-linux
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-01-
|
12
|
+
date: 2023-01-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rb_sys
|
@@ -78,7 +78,6 @@ files:
|
|
78
78
|
- Cargo.lock
|
79
79
|
- LICENSE.txt
|
80
80
|
- README.md
|
81
|
-
- commonmarker.gemspec
|
82
81
|
- ext/commonmarker/Cargo.toml
|
83
82
|
- ext/commonmarker/_util.rb
|
84
83
|
- ext/commonmarker/extconf.rb
|
@@ -122,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
121
|
- !ruby/object:Gem::Version
|
123
122
|
version: 3.3.22
|
124
123
|
requirements: []
|
125
|
-
rubygems_version: 3.4.
|
124
|
+
rubygems_version: 3.4.4
|
126
125
|
signing_key:
|
127
126
|
specification_version: 4
|
128
127
|
summary: CommonMark parser and renderer. Written in Rust, wrapped in Ruby.
|
data/commonmarker.gemspec
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
lib = File.expand_path("lib", __dir__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require "commonmarker/version"
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec|
|
8
|
-
spec.name = "commonmarker"
|
9
|
-
spec.version = Commonmarker::VERSION
|
10
|
-
spec.summary = "CommonMark parser and renderer. Written in Rust, wrapped in Ruby."
|
11
|
-
spec.description = "A fast, safe, extensible parser for CommonMark. This wraps the comrak Rust crate."
|
12
|
-
spec.authors = ["Garen Torikian", "Ashe Connor"]
|
13
|
-
spec.license = "MIT"
|
14
|
-
spec.homepage = "https://github.com/gjtorikian/commonmarker"
|
15
|
-
|
16
|
-
spec.required_ruby_version = "~> 3.1"
|
17
|
-
# https://github.com/rubygems/rubygems/pull/5852#issuecomment-1231118509
|
18
|
-
spec.required_rubygems_version = ">= 3.3.22"
|
19
|
-
|
20
|
-
spec.files = ["LICENSE.txt", "README.md", "commonmarker.gemspec", "Cargo.lock"]
|
21
|
-
spec.files += Dir.glob("lib/**/*.rb")
|
22
|
-
spec.files += Dir.glob("ext/**/*.{rs,toml,lock,rb}")
|
23
|
-
spec.bindir = "exe"
|
24
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
25
|
-
|
26
|
-
spec.require_paths = ["lib"]
|
27
|
-
spec.extensions = ["ext/commonmarker/extconf.rb"]
|
28
|
-
|
29
|
-
spec.metadata = {
|
30
|
-
"allowed_push_host" => "https://rubygems.org",
|
31
|
-
"funding_uri" => "https://github.com/sponsors/gjtorikian/",
|
32
|
-
"source_code_uri" => "https://github.com/gjtorikian/commonmarker",
|
33
|
-
"rubygems_mfa_required" => "true",
|
34
|
-
}
|
35
|
-
|
36
|
-
spec.add_dependency("rb_sys", "~> 0.9")
|
37
|
-
|
38
|
-
spec.add_development_dependency("rake", "~> 13.0")
|
39
|
-
spec.add_development_dependency("rake-compiler", "~> 1.2")
|
40
|
-
spec.add_development_dependency("rake-compiler-dock", "~> 1.2")
|
41
|
-
end
|