gitlab-glfm-markdown 0.0.12-aarch64-linux → 0.0.14-aarch64-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 +3 -3
- data/README.md +40 -12
- data/ext/glfm_markdown/Cargo.toml +2 -2
- data/ext/glfm_markdown/src/glfm.rs +8 -0
- data/ext/glfm_markdown/src/lib.rs +28 -20
- data/ext/glfm_markdown/src/main.rs +25 -0
- data/lib/glfm_markdown/2.7/glfm_markdown.so +0 -0
- data/lib/glfm_markdown/3.0/glfm_markdown.so +0 -0
- data/lib/glfm_markdown/3.1/glfm_markdown.so +0 -0
- data/lib/glfm_markdown/3.2/glfm_markdown.so +0 -0
- data/lib/glfm_markdown/3.3/glfm_markdown.so +0 -0
- data/lib/glfm_markdown/version.rb +1 -1
- data/lib/glfm_markdown.rb +3 -0
- 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: 5405a2d6b206c9235a4a6e4852972c6ac532818e12d5d4c71c8b38d9b796e59b
|
4
|
+
data.tar.gz: a19597f76f70b25dd119b3ceb362cf8eed7cae2d477e31a1797c807b1b13cd39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23d84e21cabd188ad684ff22bbb04803b0550ba299ad5b80f757db0dd3d2320b9228915cd784d87fed7145caacdabe8fbeb7e7c82b50e96c8f0463e534d2fb4f
|
7
|
+
data.tar.gz: 7b0025f2472f3686ef4d6c102d3c8ad422c09afc925fe2b7044689a816cfa78a85b1583b1640830e6fc3337cb9d4d01242336af1bec0ea6ff603708c8dca588b
|
data/Cargo.lock
CHANGED
@@ -216,9 +216,9 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
|
|
216
216
|
|
217
217
|
[[package]]
|
218
218
|
name = "comrak"
|
219
|
-
version = "0.
|
219
|
+
version = "0.22.0"
|
220
220
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
221
|
-
checksum = "
|
221
|
+
checksum = "d0436149c9f6a1935b13306206c739b1ba84fa81f551b5eb87fc2ca7a13700af"
|
222
222
|
dependencies = [
|
223
223
|
"derive_builder",
|
224
224
|
"entities",
|
@@ -361,7 +361,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
|
361
361
|
|
362
362
|
[[package]]
|
363
363
|
name = "glfm_markdown"
|
364
|
-
version = "0.0.
|
364
|
+
version = "0.0.14"
|
365
365
|
dependencies = [
|
366
366
|
"clap",
|
367
367
|
"comrak",
|
data/README.md
CHANGED
@@ -3,9 +3,11 @@
|
|
3
3
|
[![Pipeline status](https://gitlab.com/gitlab-org/ruby/gems/gitlab-glfm-markdown/badges/main/pipeline.svg)](https://gitlab.com/gitlab-org/ruby/gems/gitlab-glfm-markdown/-/commits/main)
|
4
4
|
[![Latest Release](https://gitlab.com/gitlab-org/ruby/gems/gitlab-glfm-markdown/-/badges/release.svg)](https://gitlab.com/gitlab-org/ruby/gems/gitlab-glfm-markdown/-/releases)
|
5
5
|
|
6
|
-
Implements GLFM (as used by GitLab) using
|
6
|
+
Implements GLFM (as used by GitLab) using the Rust-based markdown parser [comrak](https://github.com/kivikakk/comrak)
|
7
|
+
and providing a Ruby interface.\
|
8
|
+
_Currently using `comrak 0.22.0`_.
|
7
9
|
|
8
|
-
This project is
|
10
|
+
This project is still in constant flux, so interfaces and functionality can change at any time.
|
9
11
|
|
10
12
|
## Installation
|
11
13
|
|
@@ -25,9 +27,37 @@ Try on command line:
|
|
25
27
|
rake compile
|
26
28
|
bin/console
|
27
29
|
|
28
|
-
GLFMMarkdown.to_html('# header', options: {
|
30
|
+
GLFMMarkdown.to_html('# header', options: { sourcepos: true })
|
29
31
|
```
|
30
32
|
|
33
|
+
### Options
|
34
|
+
|
35
|
+
| Option name | Description |
|
36
|
+
|------------------------------|---------------------------------------------------------------------------------------|
|
37
|
+
| `autolink` | Enable the `autolink` extension |
|
38
|
+
| `description_lists` | Enable the `description-lists` extension |
|
39
|
+
| `escape` | Escape raw HTML instead of clobbering it |
|
40
|
+
| `escape_char_spans` | Wrap escaped characters in a `<span>` to allow any post-processing to recognize them |
|
41
|
+
| `footnotes` | Enable the `footnotes` extension |
|
42
|
+
| `full_info_string` | Enable full info strings for code blocks |
|
43
|
+
| `github_pre_lang` | Use GitHub-style `<pre lang>` for code blocks |
|
44
|
+
| `hardbreaks` | Treat newlines as hard line breaks |
|
45
|
+
| `header_ids <PREFIX>` | Enable the `header-id` extension, with the given ID prefix |
|
46
|
+
| `math_code` | Enables `math code` extension, using math code syntax |
|
47
|
+
| `math_dollars` | Enables `math dollars` extension, using math dollar syntax |
|
48
|
+
| `multiline_block_quotes` | Enable the `multiline-block-quotes` extension |
|
49
|
+
| `relaxed_autolinks` | Enable relaxing of autolink parsing, allowing links to be recognized when in brackets |
|
50
|
+
| `relaxed_tasklist_character` | Enable relaxing which character is allowed in tasklists |
|
51
|
+
| `sourcepos` | Include source mappings in HTML attributes |
|
52
|
+
| `smart` | Use smart punctuation |
|
53
|
+
| `strikethrough` | Enable the `strikethrough` extension |
|
54
|
+
| `superscript` | Enable the `superscript` extension |
|
55
|
+
| `table` | Enable the `table` extension |
|
56
|
+
| `tagfilter` | Enable the `tagfilter` extension |
|
57
|
+
| `tasklist` | Enable the `tasklist` extension |
|
58
|
+
| `unsafe` | Allow raw HTML and dangerous URLs |
|
59
|
+
| `debug` | Show debug information |
|
60
|
+
|
31
61
|
## Dingus / Demo
|
32
62
|
|
33
63
|
A demo is running via GitLab Pages, and can be accessed at:
|
@@ -50,18 +80,16 @@ directly to the gem's source directory, make sure that you're using the same ver
|
|
50
80
|
of Ruby for the project and the gem. Otherwise you can see unexplained errors when
|
51
81
|
calling into the gem.
|
52
82
|
|
53
|
-
|
83
|
+
NOTE: This project generates a changelog automatically that gets attached to the release entry.
|
84
|
+
The normal [GitLab changelog entry process](https://docs.gitlab.com/ee/development/changelog.html)
|
85
|
+
should be followed.
|
54
86
|
|
55
|
-
|
87
|
+
### Releasing a new version
|
56
88
|
|
57
|
-
|
58
|
-
1. Update `CHANGELOG.md` with the changes in the release.
|
59
|
-
1. Create a merge request and merge it to `master`.
|
60
|
-
1. Push a new tag to the repository.
|
89
|
+
To release a new version, create a merge request and use the `Release` template, following it's instructions.
|
61
90
|
|
62
|
-
|
63
|
-
published to [RubyGems](https://rubygems.org/gems/gitlab-glfm-markdown)
|
64
|
-
pipeline for the tag completes.
|
91
|
+
Once merged, the new version with precompiled, native gems will automatically be
|
92
|
+
published to [RubyGems](https://rubygems.org/gems/gitlab-glfm-markdown).
|
65
93
|
|
66
94
|
## Contributing
|
67
95
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[package]
|
2
2
|
name = "glfm_markdown"
|
3
|
-
version = "0.0.
|
3
|
+
version = "0.0.14"
|
4
4
|
edition = "2021"
|
5
5
|
authors = ["digitalmoksha <bwalker@gitlab.com>"]
|
6
6
|
description = "GitLab Flavored Markdown parser and formatter. 100% CommonMark-compatible. Experimental."
|
@@ -15,7 +15,7 @@ required-features = ["cli"]
|
|
15
15
|
|
16
16
|
[dependencies]
|
17
17
|
clap = { version = "4.0", optional = true, features = ["derive", "string"] }
|
18
|
-
comrak = { version = "0.
|
18
|
+
comrak = { version = "0.22.0", default-features = false }
|
19
19
|
magnus = "0.6.2"
|
20
20
|
rb-sys = { version = "0.9.86", default-features = false, features = ["stable-api-compiled-fallback"] }
|
21
21
|
|
@@ -3,10 +3,14 @@ pub struct RenderOptions {
|
|
3
3
|
pub autolink: bool,
|
4
4
|
pub escape: bool,
|
5
5
|
pub description_lists: bool,
|
6
|
+
pub escaped_char_spans: bool,
|
6
7
|
pub footnotes: bool,
|
7
8
|
pub full_info_string: bool,
|
8
9
|
pub github_pre_lang: bool,
|
9
10
|
pub hardbreaks: bool,
|
11
|
+
pub header_ids: Option<String>,
|
12
|
+
pub math_code: bool,
|
13
|
+
pub math_dollars: bool,
|
10
14
|
pub multiline_block_quotes: bool,
|
11
15
|
pub relaxed_autolinks: bool,
|
12
16
|
pub relaxed_tasklist_character: bool,
|
@@ -32,6 +36,9 @@ fn render_comrak(text: String, options: RenderOptions) -> String {
|
|
32
36
|
comrak_options.extension.autolink = options.autolink;
|
33
37
|
comrak_options.extension.description_lists = options.description_lists;
|
34
38
|
comrak_options.extension.footnotes = options.footnotes;
|
39
|
+
comrak_options.extension.header_ids = options.header_ids;
|
40
|
+
comrak_options.extension.math_code = options.math_code;
|
41
|
+
comrak_options.extension.math_dollars = options.math_dollars;
|
35
42
|
comrak_options.extension.multiline_block_quotes = options.multiline_block_quotes;
|
36
43
|
comrak_options.extension.strikethrough = options.strikethrough;
|
37
44
|
comrak_options.extension.superscript = options.superscript;
|
@@ -40,6 +47,7 @@ fn render_comrak(text: String, options: RenderOptions) -> String {
|
|
40
47
|
comrak_options.extension.tasklist = options.tasklist;
|
41
48
|
|
42
49
|
comrak_options.render.escape = options.escape;
|
50
|
+
comrak_options.render.escaped_char_spans = options.escaped_char_spans;
|
43
51
|
comrak_options.render.full_info_string = options.full_info_string;
|
44
52
|
comrak_options.render.github_pre_lang = options.github_pre_lang;
|
45
53
|
comrak_options.render.hardbreaks = options.hardbreaks;
|
@@ -5,31 +5,39 @@ use glfm::{render, RenderOptions};
|
|
5
5
|
|
6
6
|
/// Lookup symbol in provided `RHash`. Returns `false` if the key is not present
|
7
7
|
/// or value cannot be converted to a boolean.
|
8
|
-
fn
|
8
|
+
fn get_bool_opt(arg: &str, options: RHash) -> bool {
|
9
9
|
options.lookup(Symbol::new(arg)).unwrap_or_default()
|
10
10
|
}
|
11
11
|
|
12
|
+
fn get_string_opt(arg: &str, options: RHash) -> Option<String> {
|
13
|
+
options.lookup(Symbol::new(arg)).ok()
|
14
|
+
}
|
15
|
+
|
12
16
|
pub fn render_to_html_rs(text: String, options: RHash) -> String {
|
13
17
|
let render_options = RenderOptions {
|
14
|
-
autolink:
|
15
|
-
description_lists:
|
16
|
-
escape:
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
18
|
+
autolink: get_bool_opt("autolink", options),
|
19
|
+
description_lists: get_bool_opt("description_lists", options),
|
20
|
+
escape: get_bool_opt("escape", options),
|
21
|
+
escaped_char_spans: get_bool_opt("escaped_char_spans", options),
|
22
|
+
footnotes: get_bool_opt("footnotes", options),
|
23
|
+
full_info_string: get_bool_opt("full_info_string", options),
|
24
|
+
github_pre_lang: get_bool_opt("github_pre_lang", options),
|
25
|
+
hardbreaks: get_bool_opt("hardbreaks", options),
|
26
|
+
header_ids: get_string_opt("header_ids", options),
|
27
|
+
math_code: get_bool_opt("math_code", options),
|
28
|
+
math_dollars: get_bool_opt("math_dollars", options),
|
29
|
+
multiline_block_quotes: get_bool_opt("multiline_block_quotes", options),
|
30
|
+
relaxed_autolinks: get_bool_opt("relaxed_autolinks", options),
|
31
|
+
relaxed_tasklist_character: get_bool_opt("relaxed_tasklist_character", options),
|
32
|
+
sourcepos: get_bool_opt("sourcepos", options),
|
33
|
+
smart: get_bool_opt("smart", options),
|
34
|
+
strikethrough: get_bool_opt("strikethrough", options),
|
35
|
+
superscript: get_bool_opt("superscript", options),
|
36
|
+
table: get_bool_opt("table", options),
|
37
|
+
tagfilter: get_bool_opt("tagfilter", options),
|
38
|
+
tasklist: get_bool_opt("tasklist", options),
|
39
|
+
unsafe_: get_bool_opt("unsafe", options),
|
40
|
+
debug: get_bool_opt("debug", options),
|
33
41
|
};
|
34
42
|
|
35
43
|
render(text, render_options)
|
@@ -24,6 +24,10 @@ struct Args {
|
|
24
24
|
#[arg(long)]
|
25
25
|
escape: bool,
|
26
26
|
|
27
|
+
/// Wrap escaped characters in a `<span>` to allow any post-processing to recognize them
|
28
|
+
#[arg(long)]
|
29
|
+
escaped_char_spans: bool,
|
30
|
+
|
27
31
|
/// Enable 'footnotes' extension
|
28
32
|
#[arg(long)]
|
29
33
|
footnotes: bool,
|
@@ -40,6 +44,22 @@ struct Args {
|
|
40
44
|
#[arg(long)]
|
41
45
|
hardbreaks: bool,
|
42
46
|
|
47
|
+
/// Enable the 'header IDs` extension, with the given ID prefix
|
48
|
+
#[arg(long, value_name = "PREFIX")]
|
49
|
+
header_ids: Option<String>,
|
50
|
+
|
51
|
+
/// Enables `math code` extension, using math code syntax
|
52
|
+
#[arg(long)]
|
53
|
+
math_code: bool,
|
54
|
+
|
55
|
+
/// Enables `math dollar` extension, using math dollar syntax
|
56
|
+
#[arg(long)]
|
57
|
+
math_dollars: bool,
|
58
|
+
|
59
|
+
/// Enable 'multiline block quotes' extension
|
60
|
+
#[arg(long)]
|
61
|
+
multiline_block_quotes: bool,
|
62
|
+
|
43
63
|
/// Write output to FILE instead of stdout
|
44
64
|
#[arg(short, long, value_name = "FILE")]
|
45
65
|
output: Option<String>,
|
@@ -107,10 +127,15 @@ fn main() {
|
|
107
127
|
autolink: cli.autolink,
|
108
128
|
description_lists: cli.description_lists,
|
109
129
|
escape: cli.escape,
|
130
|
+
escaped_char_spans: cli.escaped_char_spans,
|
110
131
|
footnotes: cli.footnotes,
|
111
132
|
full_info_string: cli.full_info_string,
|
112
133
|
github_pre_lang: cli.github_pre_lang,
|
113
134
|
hardbreaks: cli.hardbreaks,
|
135
|
+
header_ids: cli.header_ids,
|
136
|
+
math_code: cli.math_code,
|
137
|
+
math_dollars: cli.math_dollars,
|
138
|
+
multiline_block_quotes: cli.multiline_block_quotes,
|
114
139
|
relaxed_autolinks: cli.relaxed_autolinks,
|
115
140
|
relaxed_tasklist_character: cli.relaxed_tasklist_character,
|
116
141
|
sourcepos: cli.sourcepos,
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/glfm_markdown.rb
CHANGED
@@ -8,10 +8,13 @@ load_rust_extension
|
|
8
8
|
module GLFMMarkdown
|
9
9
|
GLFM_DEFAULT_OPTIONS = {
|
10
10
|
autolink: true,
|
11
|
+
escaped_char_spans: false,
|
11
12
|
footnotes: true,
|
12
13
|
full_info_string: true,
|
13
14
|
github_pre_lang: false,
|
14
15
|
hardbreaks: false,
|
16
|
+
math_code: false,
|
17
|
+
math_dollars: false,
|
15
18
|
multiline_block_quotes: true,
|
16
19
|
relaxed_autolinks: false,
|
17
20
|
sourcepos: true,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.14
|
5
5
|
platform: aarch64-linux
|
6
6
|
authors:
|
7
7
|
- Brett Walker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rb_sys
|