commonmarker 1.0.0.pre5 → 1.0.0.pre7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 202b1c7827569df3821acbfbc548d8df974289b2ea0b8d5db6e9b6883c57e837
4
- data.tar.gz: e5e6dc7864c5d3b64b306a0427569284c0accaf70aa1563d042a7f50fd64e727
3
+ metadata.gz: 5c87ce202760202992aca40370ad30e42e650951943541d6ad7fb5450083f832
4
+ data.tar.gz: fea4811ffd8f8cf1d4fdd59597f054268ab83509692edb384f868c675d874209
5
5
  SHA512:
6
- metadata.gz: 74fa322cccfdd20685d2842239437e08adcb52b375d10139c85078f86f9fd5d84abe5e717fb53ca901c8595fa812d843227c7c931361fd797115aac0164b4cbb
7
- data.tar.gz: 66864dbf1640d0e3fac4b7907cd56f8536e9e2a8fc39e9157b3ee9720df05bf883cb32b187c690306f5c83509a37b1cadfd1e84d87c3c15ea3696c353d08b6d6
6
+ metadata.gz: 187e7b0c3470ca3576c3e9d7a055204802e2e615cbb54673ca7403b120333829c5f7c7f64d73789e2c17345fd74c85563bae351fa43b9c40f97577ae2dd0a421
7
+ data.tar.gz: 85bb7242753afc47dd27a00ac54aa4d6cecddec36767bcc66b566ed2baa34a1d5e0669f5039b7f39b6dee3661fa696417e978cb77c7e7125e1a8fe99efc68751
data/Cargo.lock CHANGED
@@ -167,11 +167,12 @@ dependencies = [
167
167
 
168
168
  [[package]]
169
169
  name = "comrak"
170
- version = "0.15.0"
170
+ version = "0.16.0"
171
171
  source = "registry+https://github.com/rust-lang/crates.io-index"
172
- checksum = "c11e55664fcff7f4d37cc2adf3a1996913692f037312f4ab0909047fdd2bf962"
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](#extensions).
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 `render_html` on a string to convert it to HTML:
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
- | `unsafe_` | Allow rendering of raw HTML and potentially dangerous links. | `false` |
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
- extensions: { footnotes: true, description_lists: true },
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.. | `false` |
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. For example:
104
+ providing further niceties.
104
105
 
105
- code = <<~CODE
106
- ```ruby
107
- def hello
108
- puts "hello"
109
- end
106
+ #### Syntax Highlighter Plugin
110
107
 
111
- CODE
108
+ ````ruby
109
+ code = <<~CODE
110
+ ```ruby
111
+ def hello
112
+ puts "hello"
113
+ end
114
+ CODE
112
115
 
113
- Commonmarker.to_html(code, plugins: { syntax_highlighter: { theme: "Inspired GitHub" } })
116
+ puts Commonmarker.to_html(code, plugins: { syntax_highlighter: { theme: "InspiredGitHub" } })
114
117
 
115
- # <pre style="background-color:#ffffff;" lang="ruby"><code>
116
- # <span style="font-weight:bold;color:#a71d5d;">def </span><span style="font-weight:bold;color:#795da3;">hello
117
- # </span><span style="color:#323232;"> </span><span style="color:#62a35c;">puts </span><span style="color:#183691;">&quot;hello&quot;
118
- # </span><span style="font-weight:bold;color:#a71d5d;">end
119
- # </span>
120
- # </code></pre>
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;">&quot;hello&quot;
121
+ # </span><span style="font-weight:bold;color:#a71d5d;">end
122
+ # </span>
123
+ # </code></pre>
124
+ ````
121
125
 
122
- You can disable plugins just the same as with options, by passing `nil`:
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.
@@ -5,7 +5,7 @@ edition = "2021"
5
5
 
6
6
  [dependencies]
7
7
  magnus = "0.4"
8
- comrak = "0.15"
8
+ comrak = { version = "0.16", features = ["shortcodes"] }
9
9
 
10
10
  [lib]
11
11
  name = "commonmarker"
@@ -3,4 +3,4 @@ require "rb_sys/mkmf"
3
3
 
4
4
  require_relative "_util"
5
5
 
6
- create_rust_makefile("commonmarker")
6
+ create_rust_makefile("commonmarker/commonmarker")
@@ -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 = "unsafe_";
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)
@@ -13,7 +13,7 @@ module Commonmarker
13
13
  hardbreaks: true,
14
14
  github_pre_lang: true,
15
15
  width: 80,
16
- unsafe_: false,
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Commonmarker
4
- VERSION = "1.0.0.pre5"
4
+ VERSION = "1.0.0.pre7"
5
5
  end
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.pre5
4
+ version: 1.0.0.pre7
5
5
  platform: ruby
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-08 00:00:00.000000000 Z
12
+ date: 2023-01-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rb_sys
@@ -73,13 +73,12 @@ description: A fast, safe, extensible parser for CommonMark. This wraps the comr
73
73
  email:
74
74
  executables: []
75
75
  extensions:
76
- - ext/commonmarker/Cargo.toml
76
+ - ext/commonmarker/extconf.rb
77
77
  extra_rdoc_files: []
78
78
  files:
79
79
  - Cargo.lock
80
80
  - LICENSE.txt
81
81
  - README.md
82
- - commonmarker.gemspec
83
82
  - ext/commonmarker/Cargo.toml
84
83
  - ext/commonmarker/_util.rb
85
84
  - ext/commonmarker/extconf.rb
@@ -118,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
117
  - !ruby/object:Gem::Version
119
118
  version: 3.3.22
120
119
  requirements: []
121
- rubygems_version: 3.4.3
120
+ rubygems_version: 3.4.4
122
121
  signing_key:
123
122
  specification_version: 4
124
123
  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/Cargo.toml"]
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