md4c 0.0.1

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.
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright (C) 2026 gemmaro
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify
5
+ * it under the terms of the GNU General Public License as published by
6
+ * the Free Software Foundation, either version 3 of the License, or
7
+ * (at your option) any later version.
8
+ *
9
+ * This program is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ * GNU General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License
15
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ #ifndef RB_MD4C_H
19
+ #define RB_MD4C_H 1
20
+
21
+ #include <ruby.h>
22
+
23
+ RUBY_FUNC_EXPORTED void Init_md4c (void);
24
+
25
+ #endif /* RB_MD4C_H */
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ #--
4
+ # Copyright (C) 2026 gemmaro
5
+ #
6
+ # This program is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
18
+ #++
19
+
20
+ module MD4C
21
+ VERSION = "0.0.1"
22
+ end
data/lib/md4c.rb ADDED
@@ -0,0 +1,148 @@
1
+ # frozen_string_literal: true
2
+
3
+ #--
4
+ # Copyright (C) 2026 gemmaro
5
+ #
6
+ # This program is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
18
+ #++
19
+
20
+ require_relative "md4c/version"
21
+ require "md4c/md4c"
22
+
23
+ # The class naming is based off the CommonMark specification, the
24
+ # GitHub Flavored Markdown specification, and the MDN document about
25
+ # HTML.
26
+ module MD4C
27
+ class StringAttribute
28
+ include Enumerable
29
+ end
30
+
31
+ class UnorderedList
32
+ attr_reader :mark
33
+
34
+ def tight?
35
+ @tight
36
+ end
37
+ end
38
+
39
+ class OrderedList
40
+ attr_reader :start, :mark_delimiter
41
+
42
+ def tight?
43
+ @tight
44
+ end
45
+ end
46
+
47
+ class ListItem
48
+ attr_reader :task_mark, :task_mark_offset
49
+
50
+ def task?
51
+ @task
52
+ end
53
+ end
54
+
55
+ class Heading
56
+ attr_reader :level
57
+
58
+ def ==(other)
59
+ self.class == other.class && level == other.level
60
+ end
61
+
62
+ def deconstruct_keys(*keys)
63
+ { level: @level }
64
+ end
65
+ end
66
+
67
+ class CodeBlock
68
+ attr_reader :info, :lang, :fence_char
69
+ end
70
+
71
+ class Table
72
+ attr_reader :col_count, :head_row_count, :body_row_count
73
+ end
74
+
75
+ class TableHeader
76
+ attr_reader :align
77
+ end
78
+
79
+ class TableData
80
+ attr_reader :align
81
+ end
82
+
83
+ class Anchor
84
+ attr_reader :href, :title
85
+
86
+ def autolink?
87
+ @autolink
88
+ end
89
+ end
90
+
91
+ class Image
92
+ attr_reader :src, :title
93
+ end
94
+
95
+ class WikiLink
96
+ attr_reader :target
97
+ end
98
+
99
+ module EqualByContent
100
+ def ==(other)
101
+ self.class == other.class && @content == other.content
102
+ end
103
+
104
+ def deconstruct
105
+ [@content]
106
+ end
107
+ end
108
+
109
+ class NormalText
110
+ attr_reader :content
111
+ include EqualByContent
112
+ end
113
+
114
+ class NullChar
115
+ attr_reader :content
116
+ include EqualByContent
117
+ end
118
+
119
+ class HardBreak
120
+ attr_reader :content
121
+ include EqualByContent
122
+ end
123
+
124
+ class SoftBreak
125
+ attr_reader :content
126
+ include EqualByContent
127
+ end
128
+
129
+ class Entity
130
+ attr_reader :content
131
+ include EqualByContent
132
+ end
133
+
134
+ class CodeText
135
+ attr_reader :content
136
+ include EqualByContent
137
+ end
138
+
139
+ class HTMLText
140
+ attr_reader :content
141
+ include EqualByContent
142
+ end
143
+
144
+ class LaTeXMathText
145
+ attr_reader :content
146
+ include EqualByContent
147
+ end
148
+ end
data/sig/md4c.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module MD4C
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: md4c
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - gemmaro
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: MD4C gem is a MD4C C library binding for CRuby. It can parse Markdown
13
+ documents with various syntax extensions on top of CommonMark and can convert Markdown
14
+ documents into HTML.
15
+ email:
16
+ - gemmaro.dev@gmail.com
17
+ executables: []
18
+ extensions:
19
+ - ext/md4c/extconf.rb
20
+ extra_rdoc_files: []
21
+ files:
22
+ - ".clang-format"
23
+ - ".envrc"
24
+ - CHANGELOG.md
25
+ - COPYING
26
+ - README.md
27
+ - Rakefile
28
+ - compile_flags.txt
29
+ - ext/md4c/extconf.rb
30
+ - ext/md4c/rb_md4c.c
31
+ - ext/md4c/rb_md4c.h
32
+ - lib/md4c.rb
33
+ - lib/md4c/version.rb
34
+ - sig/md4c.rbs
35
+ homepage: https://codeberg.org/gemmaro/ruby-md4c
36
+ licenses: []
37
+ metadata:
38
+ homepage_uri: https://codeberg.org/gemmaro/ruby-md4c
39
+ source_code_uri: https://codeberg.org/gemmaro/ruby-md4c.git
40
+ rdoc_options: []
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 3.2.0
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ requirements: []
54
+ rubygems_version: 4.0.6
55
+ specification_version: 4
56
+ summary: Markdown parser and HTML converter
57
+ test_files: []