commonmarker 2.0.2.1 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Cargo.lock +6 -6
- data/README.md +2 -0
- data/ext/commonmarker/Cargo.toml +1 -1
- data/ext/commonmarker/src/node.rs +58 -4
- data/ext/commonmarker/src/options.rs +4 -0
- data/lib/commonmarker/config.rb +1 -0
- data/lib/commonmarker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd35dd9c73bbbcdb424b2680d50c516124bdf98ab9f50b0b11e7d95b776c0690
|
4
|
+
data.tar.gz: 16de701a40fdb6c6d1cf9be4698feac9a761ce785ae5e40a36e0bf25ac2d86a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e78cb36fbb7578b54983810a6702233bba4a93e24e0c28bc05d4f76c744e87639ea35d02b704cd0d1cf669f5c3220a0d1c840a6210761588fbe53d486ef1ed9d
|
7
|
+
data.tar.gz: 34132fff29202f034ba12cef5b2a7840b25e5c4bcfea4da6966b233108fdb05cd885c4ada63fad40d33b85aaf88aef80c089f96530cc1712c329dfbeff465d56
|
data/Cargo.lock
CHANGED
@@ -265,9 +265,9 @@ dependencies = [
|
|
265
265
|
|
266
266
|
[[package]]
|
267
267
|
name = "comrak"
|
268
|
-
version = "0.
|
268
|
+
version = "0.35.0"
|
269
269
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
270
|
-
checksum = "
|
270
|
+
checksum = "52602e10393cfaaf8accaf707f2da743dc22cbe700a343ff8dbc9e5e04bc6b74"
|
271
271
|
dependencies = [
|
272
272
|
"bon",
|
273
273
|
"caseless",
|
@@ -676,18 +676,18 @@ dependencies = [
|
|
676
676
|
|
677
677
|
[[package]]
|
678
678
|
name = "rb-sys"
|
679
|
-
version = "0.9.
|
679
|
+
version = "0.9.108"
|
680
680
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
681
|
-
checksum = "
|
681
|
+
checksum = "1e955384e1a4dc64b71d1e4b39ed0edbd77c7bde4a10dfd5ad208e1160fddfa7"
|
682
682
|
dependencies = [
|
683
683
|
"rb-sys-build",
|
684
684
|
]
|
685
685
|
|
686
686
|
[[package]]
|
687
687
|
name = "rb-sys-build"
|
688
|
-
version = "0.9.
|
688
|
+
version = "0.9.108"
|
689
689
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
690
|
-
checksum = "
|
690
|
+
checksum = "c167c6571889b2550d6fcb315e8aa60bdb95e47e4b64793e3f65a30dc25afc85"
|
691
691
|
dependencies = [
|
692
692
|
"bindgen",
|
693
693
|
"lazy_static",
|
data/README.md
CHANGED
@@ -209,6 +209,8 @@ Commonmarker.to_html('"Hi *there*"', options: {
|
|
209
209
|
| `underline` | Enables the underline extension. | `false` |
|
210
210
|
| `spoiler` | Enables the spoiler extension. | `false` |
|
211
211
|
| `greentext` | Enables the greentext extension. | `false` |
|
212
|
+
| `subscript` | Enables the subscript extension. | `false` |
|
213
|
+
| `alerts` | Enables the alerts extension. | `false` |
|
212
214
|
|
213
215
|
For more information on these options, see [the comrak documentation](https://github.com/kivikakk/comrak#usage).
|
214
216
|
|
data/ext/commonmarker/Cargo.toml
CHANGED
@@ -10,7 +10,7 @@ magnus = { version = "0.7", features = ["rb-sys"] }
|
|
10
10
|
rb-sys = { version = "*", default-features = false, features = [
|
11
11
|
"stable-api-compiled-fallback",
|
12
12
|
] }
|
13
|
-
comrak = { version = "0.
|
13
|
+
comrak = { version = "0.35", features = ["shortcodes"] }
|
14
14
|
syntect = { version = "5.2", features = ["plist-load"] }
|
15
15
|
typed-arena = "2.0"
|
16
16
|
rctree = "0.6"
|
@@ -1,9 +1,9 @@
|
|
1
1
|
use comrak::arena_tree::Node as ComrakNode;
|
2
2
|
use comrak::nodes::{
|
3
|
-
Ast as ComrakAst, AstNode as ComrakAstNode, ListDelimType, ListType,
|
4
|
-
|
5
|
-
NodeLink, NodeList, NodeMath, NodeMultilineBlockQuote,
|
6
|
-
NodeValue as ComrakNodeValue, NodeWikiLink, TableAlignment,
|
3
|
+
AlertType, Ast as ComrakAst, AstNode as ComrakAstNode, ListDelimType, ListType, NodeAlert,
|
4
|
+
NodeCode, NodeCodeBlock, NodeDescriptionItem, NodeFootnoteDefinition, NodeFootnoteReference,
|
5
|
+
NodeHeading, NodeHtmlBlock, NodeLink, NodeList, NodeMath, NodeMultilineBlockQuote,
|
6
|
+
NodeShortCode, NodeTable, NodeValue as ComrakNodeValue, NodeWikiLink, TableAlignment,
|
7
7
|
};
|
8
8
|
use magnus::RArray;
|
9
9
|
use magnus::{function, method, scan_args, Module, Object, RHash, RModule, Symbol, Value};
|
@@ -473,6 +473,59 @@ impl CommonmarkerNode {
|
|
473
473
|
ComrakNodeValue::WikiLink(NodeWikiLink { url })
|
474
474
|
}
|
475
475
|
|
476
|
+
"raw" => {
|
477
|
+
let kwargs = scan_args::get_kwargs::<_, (), (Option<String>,), ()>(
|
478
|
+
args.keywords,
|
479
|
+
&[],
|
480
|
+
&["content"],
|
481
|
+
)?;
|
482
|
+
|
483
|
+
let (content,) = kwargs.optional;
|
484
|
+
|
485
|
+
ComrakNodeValue::Raw(content.unwrap_or_default())
|
486
|
+
}
|
487
|
+
|
488
|
+
"alert" => {
|
489
|
+
let kwargs = scan_args::get_kwargs::<
|
490
|
+
_,
|
491
|
+
(Symbol,),
|
492
|
+
(Option<String>, Option<bool>, Option<usize>, Option<usize>),
|
493
|
+
(),
|
494
|
+
>(
|
495
|
+
args.keywords,
|
496
|
+
&["type"],
|
497
|
+
&["title", "multiline", "fence_length", "fence_offset"],
|
498
|
+
)?;
|
499
|
+
|
500
|
+
let (alert_name,) = kwargs.required;
|
501
|
+
let (title, multiline, fence_length, fence_offset) = kwargs.optional;
|
502
|
+
|
503
|
+
let alert_type = match alert_name.to_string().as_str() {
|
504
|
+
"note" => AlertType::Note,
|
505
|
+
"tip" => AlertType::Tip,
|
506
|
+
"important" => AlertType::Important,
|
507
|
+
"warning" => AlertType::Warning,
|
508
|
+
_ => {
|
509
|
+
return Err(magnus::Error::new(
|
510
|
+
magnus::exception::arg_error(),
|
511
|
+
"alert type must be `note`, `tip`, `important`, or `warning`",
|
512
|
+
));
|
513
|
+
}
|
514
|
+
};
|
515
|
+
|
516
|
+
ComrakNodeValue::Alert(NodeAlert {
|
517
|
+
alert_type,
|
518
|
+
// Overridden title. If None, then use the default title.
|
519
|
+
title,
|
520
|
+
// Originated from a multiline blockquote.
|
521
|
+
multiline: multiline.unwrap_or(false),
|
522
|
+
// The length of the fence (multiline only).
|
523
|
+
fence_length: fence_length.unwrap_or(0),
|
524
|
+
// The indentation level of the fence marker (multiline only)
|
525
|
+
fence_offset: fence_offset.unwrap_or(0),
|
526
|
+
})
|
527
|
+
}
|
528
|
+
|
476
529
|
_ => panic!("unknown node type {}", node_type),
|
477
530
|
};
|
478
531
|
|
@@ -565,6 +618,7 @@ impl CommonmarkerNode {
|
|
565
618
|
ComrakNodeValue::Subscript => Symbol::new("subscript"),
|
566
619
|
ComrakNodeValue::SpoileredText => Symbol::new("spoilered_text"),
|
567
620
|
ComrakNodeValue::EscapedTag(_) => Symbol::new("escaped_tag"),
|
621
|
+
ComrakNodeValue::Alert(..) => Symbol::new("alert"),
|
568
622
|
}
|
569
623
|
}
|
570
624
|
|
@@ -117,6 +117,7 @@ const EXTENSION_UNDERLINE: &str = "underline";
|
|
117
117
|
const EXTENSION_SPOILER: &str = "spoiler";
|
118
118
|
const EXTENSION_GREENTEXT: &str = "greentext";
|
119
119
|
const EXTENSION_SUBSCRIPT: &str = "subscript";
|
120
|
+
const EXTENSION_ALERTS: &str = "alerts";
|
120
121
|
|
121
122
|
fn iterate_extension_options(comrak_options: &mut ComrakOptions, options_hash: RHash) {
|
122
123
|
options_hash
|
@@ -189,6 +190,9 @@ fn iterate_extension_options(comrak_options: &mut ComrakOptions, options_hash: R
|
|
189
190
|
Ok(Cow::Borrowed(EXTENSION_SUBSCRIPT)) => {
|
190
191
|
comrak_options.extension.subscript = TryConvert::try_convert(value)?;
|
191
192
|
}
|
193
|
+
Ok(Cow::Borrowed(EXTENSION_ALERTS)) => {
|
194
|
+
comrak_options.extension.alerts = TryConvert::try_convert(value)?;
|
195
|
+
}
|
192
196
|
_ => {}
|
193
197
|
}
|
194
198
|
Ok(ForEach::Continue)
|
data/lib/commonmarker/config.rb
CHANGED
data/lib/commonmarker/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commonmarker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
- Ashe Connor
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rb_sys
|