gitlab-glfm-markdown 0.0.33-x86_64-darwin → 0.0.34-x86_64-darwin
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/Cargo.lock +3 -3
- data/README.md +2 -2
- data/ext/glfm_markdown/Cargo.lock +3 -3
- data/ext/glfm_markdown/Cargo.toml +3 -3
- data/ext/glfm_markdown/src/glfm.rs +58 -12
- data/lib/glfm_markdown/3.1/glfm_markdown.bundle +0 -0
- data/lib/glfm_markdown/3.2/glfm_markdown.bundle +0 -0
- data/lib/glfm_markdown/3.3/glfm_markdown.bundle +0 -0
- data/lib/glfm_markdown/3.4/glfm_markdown.bundle +0 -0
- data/lib/glfm_markdown/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d44ed632f02ab1f68d423c7484cee9b6f15c1d925f90494b8eb0593da3ec83d5
|
4
|
+
data.tar.gz: dd7b68dd0b730c552f56d3ad39d2926aef3261c9093e212ab6fdf76c449e04b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad511a2859c548337bdc2e88f3159bec6eccbbe254e53901d99a64bb828a497e8db333c19f1ef3a5d6d2319bd502d13eadcb6af72fce7ab17729df69a939e775
|
7
|
+
data.tar.gz: ee007658a9f16ab00968a10101a6ad4bf5487c2c4f64e22f4a19836c3808e820c0c4705e4f17348a74350515cfef2d508015cf7f6a35feebcca65d7f9d663700
|
data/Cargo.lock
CHANGED
@@ -227,9 +227,9 @@ checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
|
227
227
|
|
228
228
|
[[package]]
|
229
229
|
name = "comrak"
|
230
|
-
version = "0.
|
230
|
+
version = "0.41.1"
|
231
231
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
232
|
-
checksum = "
|
232
|
+
checksum = "9a45df55bc7f91b899160098a7c9b35d6e575dfb4fe22100f014b41a171af2c6"
|
233
233
|
dependencies = [
|
234
234
|
"caseless",
|
235
235
|
"emojis",
|
@@ -320,7 +320,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
|
320
320
|
|
321
321
|
[[package]]
|
322
322
|
name = "glfm_markdown"
|
323
|
-
version = "0.0.
|
323
|
+
version = "0.0.34"
|
324
324
|
dependencies = [
|
325
325
|
"clap",
|
326
326
|
"comrak",
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Implements GLFM (as used by GitLab) using the Rust-based markdown parser [comrak](https://github.com/kivikakk/comrak)
|
7
7
|
and providing a Ruby interface.\
|
8
|
-
_Currently using `comrak 0.
|
8
|
+
_Currently using `comrak 0.41.1`_.
|
9
9
|
|
10
10
|
This project is still in constant flux, so interfaces and functionality can change at any time.
|
11
11
|
|
@@ -95,7 +95,7 @@ of Ruby for the project and the gem. Otherwise you can see unexplained errors wh
|
|
95
95
|
calling into the gem.
|
96
96
|
|
97
97
|
NOTE: This project generates a changelog automatically that gets attached to the release entry.
|
98
|
-
The normal [GitLab changelog entry process](https://docs.gitlab.com/
|
98
|
+
The normal [GitLab changelog entry process](https://docs.gitlab.com/development/changelog.html)
|
99
99
|
should be followed.
|
100
100
|
|
101
101
|
### Releasing a new version
|
@@ -227,9 +227,9 @@ checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
|
227
227
|
|
228
228
|
[[package]]
|
229
229
|
name = "comrak"
|
230
|
-
version = "0.
|
230
|
+
version = "0.41.1"
|
231
231
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
232
|
-
checksum = "
|
232
|
+
checksum = "9a45df55bc7f91b899160098a7c9b35d6e575dfb4fe22100f014b41a171af2c6"
|
233
233
|
dependencies = [
|
234
234
|
"caseless",
|
235
235
|
"emojis",
|
@@ -320,7 +320,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
|
320
320
|
|
321
321
|
[[package]]
|
322
322
|
name = "glfm_markdown"
|
323
|
-
version = "0.0.
|
323
|
+
version = "0.0.34"
|
324
324
|
dependencies = [
|
325
325
|
"clap",
|
326
326
|
"comrak",
|
@@ -1,8 +1,8 @@
|
|
1
1
|
[package]
|
2
2
|
name = "glfm_markdown"
|
3
|
-
version = "0.0.
|
3
|
+
version = "0.0.34"
|
4
4
|
edition = "2021"
|
5
|
-
authors = ["digitalmoksha <bwalker@gitlab.com>"]
|
5
|
+
authors = ["digitalmoksha <bwalker@gitlab.com>", "Asherah Connor <aconnor@gitlab.com>"]
|
6
6
|
description = "GitLab Flavored Markdown parser and formatter. 100% CommonMark-compatible. Experimental."
|
7
7
|
publish = false
|
8
8
|
|
@@ -15,7 +15,7 @@ required-features = ["cli"]
|
|
15
15
|
|
16
16
|
[dependencies]
|
17
17
|
clap = { version = "=4.4.18", optional = true, features = ["derive", "string"] }
|
18
|
-
comrak = { version = "0.
|
18
|
+
comrak = { version = "0.41.1", default-features = false, features = ["shortcodes"] }
|
19
19
|
magnus = "0.6.2"
|
20
20
|
rb-sys = { version = "0.9.86", default-features = false, features = ["stable-api-compiled-fallback"] }
|
21
21
|
regex = "1.11.1"
|
@@ -1,16 +1,16 @@
|
|
1
|
-
use
|
1
|
+
use std::io::{self, Write};
|
2
|
+
|
3
|
+
use comrak::html::{collect_text, format_node_default, render_sourcepos, ChildRendering, Context};
|
2
4
|
use comrak::nodes::{AstNode, ListType, NodeValue};
|
3
5
|
use comrak::{create_formatter, html, parse_document, Arena, Plugins};
|
4
6
|
use lazy_static::lazy_static;
|
5
7
|
use regex::Regex;
|
6
|
-
use std::io;
|
7
|
-
use std::io::{BufWriter, Write};
|
8
8
|
|
9
9
|
lazy_static! {
|
10
10
|
static ref PLACEHOLDER_REGEX: Regex = Regex::new(r"%(\{|%7B)(\w{1,30})(}|%7D)").unwrap();
|
11
11
|
}
|
12
12
|
|
13
|
-
#[derive(Debug
|
13
|
+
#[derive(Debug)]
|
14
14
|
pub struct RenderOptions {
|
15
15
|
pub alerts: bool,
|
16
16
|
pub autolink: bool,
|
@@ -148,11 +148,11 @@ fn render_with_plugins(text: String, render_options: RenderOptions, plugins: &Pl
|
|
148
148
|
|
149
149
|
let arena = Arena::new();
|
150
150
|
let root = parse_document(&arena, &text, &options);
|
151
|
-
let mut bw = BufWriter::new(Vec::new());
|
152
151
|
|
152
|
+
let mut bw = Vec::new();
|
153
153
|
CustomFormatter::format_document_with_plugins(root, &options, &mut bw, plugins, user_data)
|
154
154
|
.unwrap();
|
155
|
-
String::from_utf8(bw
|
155
|
+
String::from_utf8(bw).unwrap()
|
156
156
|
}
|
157
157
|
|
158
158
|
// The important thing to remember is that this overrides the default behavior of the
|
@@ -177,7 +177,10 @@ create_formatter!(CustomFormatter<RenderUserData>, {
|
|
177
177
|
},
|
178
178
|
NodeValue::TaskItem(_) => |context, node, entering| {
|
179
179
|
return render_task_item(context, node, entering);
|
180
|
-
}
|
180
|
+
},
|
181
|
+
NodeValue::Heading(_) => |context, node, entering| {
|
182
|
+
return render_heading(context, node, entering);
|
183
|
+
},
|
181
184
|
});
|
182
185
|
|
183
186
|
fn render_image<'a>(
|
@@ -186,7 +189,7 @@ fn render_image<'a>(
|
|
186
189
|
entering: bool,
|
187
190
|
) -> io::Result<ChildRendering> {
|
188
191
|
let NodeValue::Image(ref nl) = node.data.borrow().value else {
|
189
|
-
|
192
|
+
unreachable!()
|
190
193
|
};
|
191
194
|
|
192
195
|
if !(context.user.placeholder_detection && PLACEHOLDER_REGEX.is_match(nl.url.as_str())) {
|
@@ -243,7 +246,7 @@ fn render_link<'a>(
|
|
243
246
|
entering: bool,
|
244
247
|
) -> io::Result<ChildRendering> {
|
245
248
|
let NodeValue::Link(ref nl) = node.data.borrow().value else {
|
246
|
-
|
249
|
+
unreachable!()
|
247
250
|
};
|
248
251
|
|
249
252
|
if !(context.user.placeholder_detection && PLACEHOLDER_REGEX.is_match(nl.url.as_str())) {
|
@@ -303,7 +306,7 @@ fn render_list<'a>(
|
|
303
306
|
}
|
304
307
|
|
305
308
|
let NodeValue::List(ref nl) = node.data.borrow().value else {
|
306
|
-
|
309
|
+
unreachable!()
|
307
310
|
};
|
308
311
|
|
309
312
|
context.cr()?;
|
@@ -344,7 +347,7 @@ fn render_task_item<'a>(
|
|
344
347
|
}
|
345
348
|
|
346
349
|
let NodeValue::TaskItem(symbol) = node.data.borrow().value else {
|
347
|
-
|
350
|
+
unreachable!()
|
348
351
|
};
|
349
352
|
|
350
353
|
if symbol.is_none() || matches!(symbol, Some('x' | 'X')) {
|
@@ -393,13 +396,14 @@ fn render_task_item<'a>(
|
|
393
396
|
|
394
397
|
Ok(ChildRendering::HTML)
|
395
398
|
}
|
399
|
+
|
396
400
|
fn render_text<'a>(
|
397
401
|
context: &mut Context<RenderUserData>,
|
398
402
|
node: &'a AstNode<'a>,
|
399
403
|
entering: bool,
|
400
404
|
) -> io::Result<ChildRendering> {
|
401
405
|
let NodeValue::Text(ref literal) = node.data.borrow().value else {
|
402
|
-
|
406
|
+
unreachable!()
|
403
407
|
};
|
404
408
|
|
405
409
|
if !(context.user.placeholder_detection && PLACEHOLDER_REGEX.is_match(literal)) {
|
@@ -441,3 +445,45 @@ fn render_text<'a>(
|
|
441
445
|
|
442
446
|
Ok(ChildRendering::HTML)
|
443
447
|
}
|
448
|
+
|
449
|
+
fn render_heading<'a>(
|
450
|
+
context: &mut Context<RenderUserData>,
|
451
|
+
node: &'a AstNode<'a>,
|
452
|
+
entering: bool,
|
453
|
+
) -> io::Result<ChildRendering> {
|
454
|
+
let NodeValue::Heading(ref nh) = node.data.borrow().value else {
|
455
|
+
unreachable!()
|
456
|
+
};
|
457
|
+
|
458
|
+
match context.plugins.render.heading_adapter {
|
459
|
+
None => {
|
460
|
+
// Overrides the default handling in order to render the heading text
|
461
|
+
// inside the anchor tag to better support screen readers
|
462
|
+
if entering {
|
463
|
+
context.cr()?;
|
464
|
+
write!(context, "<h{}", nh.level)?;
|
465
|
+
render_sourcepos(context, node)?;
|
466
|
+
context.write_all(b">")?;
|
467
|
+
|
468
|
+
if let Some(ref prefix) = context.options.extension.header_ids {
|
469
|
+
let mut text_content = Vec::with_capacity(20);
|
470
|
+
collect_text(node, &mut text_content);
|
471
|
+
|
472
|
+
let mut id = String::from_utf8(text_content).unwrap();
|
473
|
+
id = context.anchorizer.anchorize(id);
|
474
|
+
write!(
|
475
|
+
context,
|
476
|
+
r##"<a href="#{id}" class="anchor" id="{prefix}{id}">"##
|
477
|
+
)?;
|
478
|
+
}
|
479
|
+
} else {
|
480
|
+
if context.options.extension.header_ids.is_some() {
|
481
|
+
write!(context, "</a>")?;
|
482
|
+
}
|
483
|
+
writeln!(context, "</h{}>", nh.level)?;
|
484
|
+
}
|
485
|
+
Ok(ChildRendering::HTML)
|
486
|
+
}
|
487
|
+
Some(_adapter) => format_node_default(context, node, entering),
|
488
|
+
}
|
489
|
+
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-glfm-markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.34
|
5
5
|
platform: x86_64-darwin
|
6
6
|
authors:
|
7
7
|
- Brett Walker
|
8
|
+
- Asherah Connor
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2025-
|
12
|
+
date: 2025-09-24 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rb_sys
|
@@ -55,6 +56,7 @@ dependencies:
|
|
55
56
|
description: Markdown processing for GitLab Flavored Markdown
|
56
57
|
email:
|
57
58
|
- bwalker@gitlab.com
|
59
|
+
- aconnor@gitlab.com
|
58
60
|
executables: []
|
59
61
|
extensions: []
|
60
62
|
extra_rdoc_files: []
|