gitlab-glfm-markdown 0.0.47-aarch64-linux-gnu → 0.1.0-aarch64-linux-gnu
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/gitlab_glfm_markdown/Cargo.lock +3 -3
- data/ext/gitlab_glfm_markdown/Cargo.toml +2 -2
- data/ext/gitlab_glfm_markdown/src/formatter.rs +39 -8
- data/ext/gitlab_glfm_markdown/src/glfm.rs +15 -6
- data/lib/gitlab_glfm_markdown/3.1/gitlab_glfm_markdown.so +0 -0
- data/lib/gitlab_glfm_markdown/3.2/gitlab_glfm_markdown.so +0 -0
- data/lib/gitlab_glfm_markdown/3.3/gitlab_glfm_markdown.so +0 -0
- data/lib/gitlab_glfm_markdown/3.4/gitlab_glfm_markdown.so +0 -0
- data/lib/gitlab_glfm_markdown/4.0/gitlab_glfm_markdown.so +0 -0
- data/lib/gitlab_glfm_markdown/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: 5a8592713f7aed9e7413d78a2d939c3850ead2e1054b5139ccce221db0c55ea5
|
|
4
|
+
data.tar.gz: 7a34224ef93b20e9dfaa3cf1a9e1ce8f88b0ab90abe461424ca31f3ad7291679
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d7aebe916fec59ab9ef814a88f0cbd3f9cb1e6d14e793291c9cf967097227558e320e53cb28fd03de55c2284a70771deec16717456e350811e924e0f2d340df6
|
|
7
|
+
data.tar.gz: adda504dd55e3188d406418092e859166d9ba958d6997dcfbb4b6813659ef38d807098030ce2f00d8eecb88d2171f1807aa9bffe1d38b221cc26a8c26b34b416
|
data/Cargo.lock
CHANGED
|
@@ -220,9 +220,9 @@ checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
|
|
220
220
|
|
|
221
221
|
[[package]]
|
|
222
222
|
name = "comrak"
|
|
223
|
-
version = "0.
|
|
223
|
+
version = "1.0.0"
|
|
224
224
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
225
|
-
checksum = "
|
|
225
|
+
checksum = "d981d666dca19afb3cc090dc7c381560cb8ba76582dda6e2c14686ff39fd547f"
|
|
226
226
|
dependencies = [
|
|
227
227
|
"caseless",
|
|
228
228
|
"emojis",
|
|
@@ -345,7 +345,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
|
|
345
345
|
|
|
346
346
|
[[package]]
|
|
347
347
|
name = "gitlab-glfm-markdown"
|
|
348
|
-
version = "0.0
|
|
348
|
+
version = "0.1.0"
|
|
349
349
|
dependencies = [
|
|
350
350
|
"clap",
|
|
351
351
|
"comrak",
|
data/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://gitlab.com/gitlab-org/ruby/gems/gitlab-glfm-markdown/-/releases)
|
|
5
5
|
|
|
6
6
|
Implements GLFM (as used by GitLab) using the Rust-based Markdown parser
|
|
7
|
-
[Comrak](https://github.com/kivikakk/comrak) (0.
|
|
7
|
+
[Comrak](https://github.com/kivikakk/comrak) (1.0.0), providing a Ruby interface.
|
|
8
8
|
|
|
9
9
|
This project is still in constant flux, so interfaces and functionality can change at any time.
|
|
10
10
|
|
|
@@ -65,7 +65,7 @@ GLFMMarkdown.to_html('# header', options: { glfm: true, sourcepos: false })
|
|
|
65
65
|
| `greentext` | Enable the `greentext` extension - requires at least one space after a `>` character to generate a blockquote, and restarts blockquote nesting across unique lines of input |
|
|
66
66
|
| `hardbreaks` | Treat newlines as hard line breaks |
|
|
67
67
|
| `header_accessibility` | Use new header/anchor combination in HTML output, per [!112](https://gitlab.com/gitlab-org/ruby/gems/gitlab-glfm-markdown/-/merge_requests/112). Requires `header_id_prefix` to be set. |
|
|
68
|
-
| `header_id_prefix <PREFIX>` |
|
|
68
|
+
| `header_id_prefix <PREFIX>` | Generate IDs for headings and description list terms with the given prefix. Use an empty string for unprefixed IDs. |
|
|
69
69
|
| `header_id_prefix_in_href` | Include `header_id_prefix` in the heading anchor's `href`. Requires `header_id_prefix` to be set. |
|
|
70
70
|
| `header_slug_prefix <PREFIX>` | Prefix to prepend to heading anchor slugs. When set, slugs become `{header_slug_prefix}{anchorized_text}`. Requires `header_accessibility` to be set. |
|
|
71
71
|
| `ignore_empty_links` | Ignore empty links in input |
|
|
@@ -220,9 +220,9 @@ checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
|
|
220
220
|
|
|
221
221
|
[[package]]
|
|
222
222
|
name = "comrak"
|
|
223
|
-
version = "0.
|
|
223
|
+
version = "1.0.0"
|
|
224
224
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
225
|
-
checksum = "
|
|
225
|
+
checksum = "d981d666dca19afb3cc090dc7c381560cb8ba76582dda6e2c14686ff39fd547f"
|
|
226
226
|
dependencies = [
|
|
227
227
|
"caseless",
|
|
228
228
|
"emojis",
|
|
@@ -345,7 +345,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
|
|
345
345
|
|
|
346
346
|
[[package]]
|
|
347
347
|
name = "gitlab-glfm-markdown"
|
|
348
|
-
version = "0.0
|
|
348
|
+
version = "0.1.0"
|
|
349
349
|
dependencies = [
|
|
350
350
|
"clap",
|
|
351
351
|
"comrak",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "gitlab-glfm-markdown"
|
|
3
|
-
version = "0.0
|
|
3
|
+
version = "0.1.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
authors = ["digitalmoksha <bwalker@gitlab.com>", "Asherah Connor <aconnor@gitlab.com>"]
|
|
6
6
|
description = "GitLab Flavored Markdown parser and formatter. 100% CommonMark-compatible."
|
|
@@ -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 = "
|
|
18
|
+
comrak = { version = "1", default-features = false, features = ["shortcodes"] }
|
|
19
19
|
magnus = "0.8.2"
|
|
20
20
|
rb-sys = { version = "0.9.124", default-features = false, features = ["stable-api-compiled-fallback"] }
|
|
21
21
|
regex = "1.11.1"
|
|
@@ -72,6 +72,9 @@ create_formatter!(CustomFormatter<RenderUserData>, {
|
|
|
72
72
|
NodeValue::Heading(ref nh) => |context, node, entering| {
|
|
73
73
|
return render_heading(context, node, entering, nh);
|
|
74
74
|
},
|
|
75
|
+
NodeValue::DescriptionTerm => |context, node, entering| {
|
|
76
|
+
return render_description_term(context, node, entering);
|
|
77
|
+
},
|
|
75
78
|
});
|
|
76
79
|
|
|
77
80
|
fn render_text(
|
|
@@ -142,6 +145,7 @@ fn render_link(
|
|
|
142
145
|
if !nl.title.is_empty() {
|
|
143
146
|
context.write_str(" title=\"")?;
|
|
144
147
|
context.escape(&nl.title)?;
|
|
148
|
+
context.write_str("\"")?;
|
|
145
149
|
}
|
|
146
150
|
|
|
147
151
|
// This path only taken if placeholder detection is enabled, and the regex matched.
|
|
@@ -378,7 +382,7 @@ fn render_table_cell<T>(
|
|
|
378
382
|
};
|
|
379
383
|
let row = &row_node.data().value;
|
|
380
384
|
let in_header = match *row {
|
|
381
|
-
NodeValue::TableRow(
|
|
385
|
+
NodeValue::TableRow(ref ntr) => ntr.header,
|
|
382
386
|
_ => panic!("rendered a table cell contained by something other than a table row"),
|
|
383
387
|
};
|
|
384
388
|
|
|
@@ -487,13 +491,7 @@ fn render_heading(
|
|
|
487
491
|
write!(context, "<h{}", nh.level)?;
|
|
488
492
|
|
|
489
493
|
if let Some(ref prefix) = context.options.extension.header_id_prefix {
|
|
490
|
-
let
|
|
491
|
-
let id = context.anchorizer.anchorize(&text_content);
|
|
492
|
-
let id = if let Some(ref slug_prefix) = context.user.header_slug_prefix {
|
|
493
|
-
format!("{slug_prefix}{id}")
|
|
494
|
-
} else {
|
|
495
|
-
id
|
|
496
|
-
};
|
|
494
|
+
let id = anchor_slug(context, node);
|
|
497
495
|
write!(context, r##" id="{prefix}{id}""##)?;
|
|
498
496
|
context.user.last_heading = Some(id);
|
|
499
497
|
}
|
|
@@ -523,6 +521,39 @@ fn render_heading(
|
|
|
523
521
|
Ok(ChildRendering::HTML)
|
|
524
522
|
}
|
|
525
523
|
|
|
524
|
+
fn render_description_term(
|
|
525
|
+
context: &mut Context<RenderUserData>,
|
|
526
|
+
node: Node<'_>,
|
|
527
|
+
entering: bool,
|
|
528
|
+
) -> Result<ChildRendering, fmt::Error> {
|
|
529
|
+
let (true, Some(prefix)) = (entering, &context.options.extension.header_id_prefix) else {
|
|
530
|
+
return format_node_default(context, node, entering);
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
let slug = anchor_slug(context, node);
|
|
534
|
+
context.write_str(r#"<dt id=""#)?;
|
|
535
|
+
context.escape(prefix)?;
|
|
536
|
+
context.escape(&slug)?;
|
|
537
|
+
context.write_str("\"")?;
|
|
538
|
+
render_sourcepos(context, node)?;
|
|
539
|
+
context.write_str(">")?;
|
|
540
|
+
|
|
541
|
+
Ok(ChildRendering::HTML)
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
fn anchor_slug(context: &mut Context<RenderUserData>, node: Node<'_>) -> String {
|
|
545
|
+
let slug = context.anchorizer.anchorize(&node.collect_text());
|
|
546
|
+
match context
|
|
547
|
+
.user
|
|
548
|
+
.header_slug_prefix
|
|
549
|
+
.as_ref()
|
|
550
|
+
.filter(|_| context.user.header_accessibility)
|
|
551
|
+
{
|
|
552
|
+
Some(prefix) => format!("{prefix}{slug}"),
|
|
553
|
+
None => slug,
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
526
557
|
/// If the given node has a single text child, apply a function to the text content
|
|
527
558
|
/// of that node. Otherwise, return the given default value.
|
|
528
559
|
fn with_node_text_content<U, F>(node: Node<'_>, default: U, f: F) -> U
|
|
@@ -122,22 +122,31 @@ impl From<&RenderOptions> for comrak::Options<'_> {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
pub fn render(text: &str, options: &RenderOptions) -> String {
|
|
125
|
-
render_with_plugins(
|
|
125
|
+
render_with_plugins(
|
|
126
|
+
text,
|
|
127
|
+
options,
|
|
128
|
+
&comrak::Options::from(options),
|
|
129
|
+
&Plugins::default(),
|
|
130
|
+
)
|
|
126
131
|
}
|
|
127
132
|
|
|
128
|
-
fn render_with_plugins(
|
|
133
|
+
pub fn render_with_plugins(
|
|
134
|
+
text: &str,
|
|
135
|
+
render_options: &RenderOptions,
|
|
136
|
+
options: &comrak::Options,
|
|
137
|
+
plugins: &Plugins,
|
|
138
|
+
) -> String {
|
|
129
139
|
let user_data = RenderUserData::from(render_options);
|
|
130
|
-
let options = comrak::Options::from(render_options);
|
|
131
140
|
|
|
132
141
|
if user_data.default_html {
|
|
133
|
-
return comrak::markdown_to_html_with_plugins(text,
|
|
142
|
+
return comrak::markdown_to_html_with_plugins(text, options, plugins);
|
|
134
143
|
}
|
|
135
144
|
|
|
136
145
|
let arena = Arena::new();
|
|
137
|
-
let root = parse_document(&arena, text,
|
|
146
|
+
let root = parse_document(&arena, text, options);
|
|
138
147
|
|
|
139
148
|
let mut out = String::new();
|
|
140
|
-
CustomFormatter::format_document_with_plugins(root,
|
|
149
|
+
CustomFormatter::format_document_with_plugins(root, options, &mut out, plugins, user_data)
|
|
141
150
|
.unwrap();
|
|
142
151
|
out
|
|
143
152
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.1.0
|
|
5
5
|
platform: aarch64-linux-gnu
|
|
6
6
|
authors:
|
|
7
7
|
- Brett Walker
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-
|
|
12
|
+
date: 2026-11-20 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rb_sys
|