inkmark 0.1.0-arm64-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 +7 -0
- data/CHANGELOG.md +3 -0
- data/LICENSE.txt +21 -0
- data/NOTICE +16 -0
- data/README.md +1166 -0
- data/lib/inkmark/3.3/inkmark.bundle +0 -0
- data/lib/inkmark/3.4/inkmark.bundle +0 -0
- data/lib/inkmark/4.0/inkmark.bundle +0 -0
- data/lib/inkmark/event.rb +342 -0
- data/lib/inkmark/native.rb +8 -0
- data/lib/inkmark/options.rb +698 -0
- data/lib/inkmark/toc.rb +40 -0
- data/lib/inkmark/version.rb +6 -0
- data/lib/inkmark.rb +711 -0
- data/sig/inkmark.rbs +219 -0
- metadata +178 -0
data/sig/inkmark.rbs
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
class Inkmark
|
|
2
|
+
VERSION: String
|
|
3
|
+
|
|
4
|
+
class Error < StandardError
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
class Options
|
|
8
|
+
type key = Symbol
|
|
9
|
+
type value = bool | String | Integer | Array[String] | Hash[Symbol, untyped] | nil
|
|
10
|
+
type defaults_hash = Hash[key, value]
|
|
11
|
+
|
|
12
|
+
# Nested element-policy hash types. Writers accept partial hashes
|
|
13
|
+
# (deep-merge semantics) so any subset of keys is valid on write;
|
|
14
|
+
# readers return the full hash with defaults filled in.
|
|
15
|
+
type headings_options = { attributes: bool, ids: bool }
|
|
16
|
+
type images_options = {
|
|
17
|
+
lazy: bool,
|
|
18
|
+
allowed_hosts: Array[String]?,
|
|
19
|
+
allowed_schemes: Array[String]?
|
|
20
|
+
}
|
|
21
|
+
type links_options = {
|
|
22
|
+
autolink: bool,
|
|
23
|
+
nofollow: bool,
|
|
24
|
+
allowed_hosts: Array[String]?,
|
|
25
|
+
allowed_schemes: Array[String]?
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
DEFAULTS: defaults_hash
|
|
29
|
+
PRESETS: Hash[Symbol, Hash[Symbol, untyped]]
|
|
30
|
+
DEFAULT_PRESET: Symbol
|
|
31
|
+
PRESETS_NATIVE_HASH: Hash[Symbol, Hash[Symbol, untyped]]
|
|
32
|
+
|
|
33
|
+
# +overrides+ accepts every option key, plus the pseudo-option
|
|
34
|
+
# +:preset+ (Symbol) which names a bundle from {PRESETS}.
|
|
35
|
+
def initialize: (?Hash[Symbol, untyped] overrides) -> void
|
|
36
|
+
def []: (key key) -> value
|
|
37
|
+
def []=: (key key, value value) -> value
|
|
38
|
+
def to_h: () -> defaults_hash
|
|
39
|
+
def to_native_hash: () -> Hash[Symbol, untyped]
|
|
40
|
+
def to_native_hash_frozen: () -> Hash[Symbol, untyped]
|
|
41
|
+
def merge: (defaults_hash | Inkmark::Options other) -> Inkmark::Options
|
|
42
|
+
def ==: (untyped other) -> bool
|
|
43
|
+
alias eql? ==
|
|
44
|
+
def initialize_copy: (Inkmark::Options orig) -> void
|
|
45
|
+
|
|
46
|
+
# Class-method fast path that skips allocating an Options instance.
|
|
47
|
+
# Marked +@api private+ in YARD; surfaced here because specs and
|
|
48
|
+
# the Inkmark class-method layer call it with an explicit receiver.
|
|
49
|
+
def self.native_hash_from: (Hash[Symbol, untyped] overrides) -> Hash[Symbol, untyped]
|
|
50
|
+
|
|
51
|
+
# Auto-generated accessors—one pair per DEFAULTS key.
|
|
52
|
+
def gfm: () -> bool
|
|
53
|
+
def gfm=: (bool) -> bool
|
|
54
|
+
def gfm_tag_filter: () -> bool
|
|
55
|
+
def gfm_tag_filter=: (bool) -> bool
|
|
56
|
+
def tables: () -> bool
|
|
57
|
+
def tables=: (bool) -> bool
|
|
58
|
+
def strikethrough: () -> bool
|
|
59
|
+
def strikethrough=: (bool) -> bool
|
|
60
|
+
def tasklists: () -> bool
|
|
61
|
+
def tasklists=: (bool) -> bool
|
|
62
|
+
def footnotes: () -> bool
|
|
63
|
+
def footnotes=: (bool) -> bool
|
|
64
|
+
def raw_html: () -> bool
|
|
65
|
+
def raw_html=: (bool) -> bool
|
|
66
|
+
def smart_punctuation: () -> bool
|
|
67
|
+
def smart_punctuation=: (bool) -> bool
|
|
68
|
+
# Readers return the full merged nested hash; writers accept and
|
|
69
|
+
# return the caller's *partial* hash (deep-merge semantics apply
|
|
70
|
+
# inside, so a partial input is legal and the Ruby +x = v+ form
|
|
71
|
+
# evaluates to +v+ as passed).
|
|
72
|
+
def headings: () -> headings_options
|
|
73
|
+
def headings=: (Hash[Symbol, untyped] value) -> Hash[Symbol, untyped]
|
|
74
|
+
def images: () -> images_options
|
|
75
|
+
def images=: (Hash[Symbol, untyped] value) -> Hash[Symbol, untyped]
|
|
76
|
+
def links: () -> links_options
|
|
77
|
+
def links=: (Hash[Symbol, untyped] value) -> Hash[Symbol, untyped]
|
|
78
|
+
def emoji_shortcodes: () -> bool
|
|
79
|
+
def emoji_shortcodes=: (bool) -> bool
|
|
80
|
+
def syntax_highlight: () -> bool
|
|
81
|
+
def syntax_highlight=: (bool) -> bool
|
|
82
|
+
def hard_wrap: () -> bool
|
|
83
|
+
def hard_wrap=: (bool) -> bool
|
|
84
|
+
def toc: () -> bool
|
|
85
|
+
def toc=: (bool | Hash[Symbol, untyped]) -> untyped
|
|
86
|
+
def statistics: () -> bool
|
|
87
|
+
def statistics=: (bool) -> bool
|
|
88
|
+
def extract: () -> Hash[Symbol, bool]?
|
|
89
|
+
def extract=: (Hash[Symbol, bool]?) -> Hash[Symbol, bool]?
|
|
90
|
+
def math: () -> bool
|
|
91
|
+
def math=: (bool) -> bool
|
|
92
|
+
def definition_list: () -> bool
|
|
93
|
+
def definition_list=: (bool) -> bool
|
|
94
|
+
def superscript: () -> bool
|
|
95
|
+
def superscript=: (bool) -> bool
|
|
96
|
+
def subscript: () -> bool
|
|
97
|
+
def subscript=: (bool) -> bool
|
|
98
|
+
def wikilinks: () -> bool
|
|
99
|
+
def wikilinks=: (bool) -> bool
|
|
100
|
+
def frontmatter: () -> bool
|
|
101
|
+
def frontmatter=: (bool) -> bool
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Rendered table of contents returned by {Inkmark#toc}. Immutable
|
|
105
|
+
# value object with value-equality over +markdown+ and +html+.
|
|
106
|
+
class Toc
|
|
107
|
+
attr_reader markdown: String
|
|
108
|
+
attr_reader html: String
|
|
109
|
+
|
|
110
|
+
def initialize: (markdown: String, html: String) -> void
|
|
111
|
+
def to_markdown: () -> String
|
|
112
|
+
def to_html: () -> String
|
|
113
|
+
def to_s: () -> String
|
|
114
|
+
def ==: (untyped other) -> bool
|
|
115
|
+
alias eql? ==
|
|
116
|
+
def hash: () -> Integer
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Events yielded to handlers registered via {Inkmark#on}.
|
|
120
|
+
class Event
|
|
121
|
+
attr_reader kind: Symbol
|
|
122
|
+
attr_reader text: String
|
|
123
|
+
attr_reader source: String?
|
|
124
|
+
attr_reader lang: String?
|
|
125
|
+
attr_reader byte_range: Range[Integer]?
|
|
126
|
+
attr_reader depth: Integer
|
|
127
|
+
attr_reader parent_kind: Symbol?
|
|
128
|
+
attr_reader ancestor_kinds: Array[Symbol]
|
|
129
|
+
|
|
130
|
+
attr_accessor dest: String?
|
|
131
|
+
attr_accessor title: String?
|
|
132
|
+
attr_accessor level: Integer?
|
|
133
|
+
attr_accessor id: String?
|
|
134
|
+
attr_accessor html: String?
|
|
135
|
+
attr_accessor markdown: String?
|
|
136
|
+
|
|
137
|
+
def initialize: (Hash[Symbol, untyped] data) -> void
|
|
138
|
+
def children: () -> Array[Event]
|
|
139
|
+
def children_of: (Symbol kind) -> Array[Event]
|
|
140
|
+
def delete: () -> void
|
|
141
|
+
def deleted?: () -> bool
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
type markdown_input = String | _ToS | nil
|
|
145
|
+
type options_input = Inkmark::Options | Hash[Symbol, untyped] | nil
|
|
146
|
+
|
|
147
|
+
# A chunk record returned by {chunks_by_heading}. Keys:
|
|
148
|
+
# heading (String?), level (Integer), id (String?),
|
|
149
|
+
# breadcrumb (Array[String]), content (String), and
|
|
150
|
+
# character_count / word_count (Integer) when statistics: true.
|
|
151
|
+
type chunk = Hash[Symbol, untyped]
|
|
152
|
+
|
|
153
|
+
# A window record returned by {chunks_by_size}. Keys:
|
|
154
|
+
# index (Integer), content (String), plus character_count /
|
|
155
|
+
# word_count (Integer) when statistics: true.
|
|
156
|
+
type window = Hash[Symbol, untyped]
|
|
157
|
+
|
|
158
|
+
# Truncation params accepted by {truncate_markdown} and by the
|
|
159
|
+
# {chunks_by_heading} +truncate:+ kwarg. At least one of
|
|
160
|
+
# +:chars+ / +:words+ must be set.
|
|
161
|
+
type truncate_params = {
|
|
162
|
+
chars: Integer?,
|
|
163
|
+
words: Integer?,
|
|
164
|
+
at: (:block | :word)?,
|
|
165
|
+
marker: String?
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
# Handler registry used by {#on} / {#walk} / {#to_html}.
|
|
169
|
+
type handlers = Hash[Symbol, Array[^(Inkmark::Event) -> void]]
|
|
170
|
+
|
|
171
|
+
# ── Class-method shortcuts ────────────────────────────────────────────
|
|
172
|
+
def self.to_html: (markdown_input source, ?options: options_input) -> String
|
|
173
|
+
def self.to_markdown: (markdown_input source, ?options: options_input) -> String
|
|
174
|
+
def self.to_plain_text: (markdown_input source, ?options: options_input) -> String
|
|
175
|
+
def self.chunks_by_heading: (markdown_input source, ?options: options_input, ?truncate: truncate_params?) -> Array[chunk]
|
|
176
|
+
def self.chunks_by_size: (markdown_input source, ?chars: Integer?, ?words: Integer?, ?overlap: Integer, ?at: (:block | :word), ?options: options_input) -> Array[window]
|
|
177
|
+
def self.truncate_markdown: (markdown_input source, ?chars: Integer?, ?words: Integer?, ?at: (:block | :word), ?marker: String?, ?options: options_input) -> String
|
|
178
|
+
def self.highlight_css: (?theme: String?) -> String
|
|
179
|
+
def self.highlight_themes: () -> Array[String]
|
|
180
|
+
def self.default_options: () -> Inkmark::Options
|
|
181
|
+
def self.default_options=: (options_input value) -> Inkmark::Options
|
|
182
|
+
|
|
183
|
+
# ── Native bindings (private in spirit; registered on the class) ──────
|
|
184
|
+
def self._native_to_html: (String source, Hash[Symbol, untyped]? opts_hash) -> String
|
|
185
|
+
def self._native_to_markdown: (String source, Hash[Symbol, untyped]? opts_hash) -> String
|
|
186
|
+
def self._native_to_plain_text: (String source, Hash[Symbol, untyped]? opts_hash) -> String
|
|
187
|
+
def self._native_chunks_by_heading: (String source, Hash[Symbol, untyped] opts_hash) -> Array[chunk]
|
|
188
|
+
def self._native_chunks_by_size: (String source, Hash[Symbol, untyped] opts_hash) -> Array[window]
|
|
189
|
+
def self._native_truncate_markdown: (String source, Hash[Symbol, untyped] params_hash, Hash[Symbol, untyped] opts_hash) -> String
|
|
190
|
+
def self._native_render_full: (String source, Hash[Symbol, untyped] opts_hash) -> Hash[Symbol, untyped]
|
|
191
|
+
def self._native_walk: (String source, Hash[Symbol, untyped] opts_hash, handlers handlers) -> void
|
|
192
|
+
def self._native_render_with_handlers: (String source, Hash[Symbol, untyped] opts_hash, handlers handlers) -> String
|
|
193
|
+
def self._syntax_css: (String? theme) -> String
|
|
194
|
+
def self._syntax_themes: () -> Array[String]
|
|
195
|
+
|
|
196
|
+
# ── Instance API ──────────────────────────────────────────────────────
|
|
197
|
+
attr_reader source: String
|
|
198
|
+
attr_reader options: Inkmark::Options
|
|
199
|
+
|
|
200
|
+
def initialize: (?markdown_input source, ?options: options_input) -> void
|
|
201
|
+
def source=: (markdown_input value) -> String
|
|
202
|
+
def options=: (options_input value) -> Inkmark::Options
|
|
203
|
+
def to_s: () -> String
|
|
204
|
+
|
|
205
|
+
def on: (Symbol kind) { (Inkmark::Event) -> void } -> self
|
|
206
|
+
def walk: () -> self
|
|
207
|
+
|
|
208
|
+
def to_html: () -> String
|
|
209
|
+
def to_markdown: () -> String
|
|
210
|
+
def to_plain_text: () -> String
|
|
211
|
+
def chunks_by_heading: (?truncate: truncate_params?) -> Array[chunk]
|
|
212
|
+
def chunks_by_size: (?chars: Integer?, ?words: Integer?, ?overlap: Integer, ?at: (:block | :word)) -> Array[window]
|
|
213
|
+
def truncate_markdown: (?chars: Integer?, ?words: Integer?, ?at: (:block | :word), ?marker: String?) -> String
|
|
214
|
+
|
|
215
|
+
def toc: () -> Inkmark::Toc?
|
|
216
|
+
def statistics: () -> Hash[Symbol, untyped]?
|
|
217
|
+
def extracts: () -> Hash[Symbol, Array[Hash[Symbol, untyped]]]?
|
|
218
|
+
def frontmatter: () -> Hash[String, untyped]?
|
|
219
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: inkmark
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: arm64-darwin
|
|
6
|
+
authors:
|
|
7
|
+
- Yaroslav Markin
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-04-22 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rake
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '13.0'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '13.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: irb
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rbs
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.9'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.9'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: yard
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0.9'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0.9'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: standard
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '1.3'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '1.3'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rspec
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '3.0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '3.0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: lefthook
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: 2.1.5
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: 2.1.5
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: rake-compiler
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
125
|
+
description: A very fast, feature-packed, AI-first markdown (CommonMark/GFM) gem for
|
|
126
|
+
Ruby, based on pulldown-cmark (Rust).
|
|
127
|
+
email:
|
|
128
|
+
- yaroslav@markin.net
|
|
129
|
+
executables: []
|
|
130
|
+
extensions: []
|
|
131
|
+
extra_rdoc_files: []
|
|
132
|
+
files:
|
|
133
|
+
- CHANGELOG.md
|
|
134
|
+
- LICENSE.txt
|
|
135
|
+
- NOTICE
|
|
136
|
+
- README.md
|
|
137
|
+
- lib/inkmark.rb
|
|
138
|
+
- lib/inkmark/3.3/inkmark.bundle
|
|
139
|
+
- lib/inkmark/3.4/inkmark.bundle
|
|
140
|
+
- lib/inkmark/4.0/inkmark.bundle
|
|
141
|
+
- lib/inkmark/event.rb
|
|
142
|
+
- lib/inkmark/native.rb
|
|
143
|
+
- lib/inkmark/options.rb
|
|
144
|
+
- lib/inkmark/toc.rb
|
|
145
|
+
- lib/inkmark/version.rb
|
|
146
|
+
- sig/inkmark.rbs
|
|
147
|
+
homepage: https://github.com/yaroslav/inkmark
|
|
148
|
+
licenses:
|
|
149
|
+
- MIT
|
|
150
|
+
metadata:
|
|
151
|
+
homepage_uri: https://github.com/yaroslav/inkmark
|
|
152
|
+
source_code_uri: https://github.com/yaroslav/inkmark
|
|
153
|
+
changelog_uri: https://github.com/yaroslav/inkmark/blob/main/CHANGELOG.md
|
|
154
|
+
bug_tracker_uri: https://github.com/yaroslav/inkmark/issues
|
|
155
|
+
documentation_uri: https://rubydoc.info/gems/inkmark
|
|
156
|
+
post_install_message:
|
|
157
|
+
rdoc_options: []
|
|
158
|
+
require_paths:
|
|
159
|
+
- lib
|
|
160
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
161
|
+
requirements:
|
|
162
|
+
- - ">="
|
|
163
|
+
- !ruby/object:Gem::Version
|
|
164
|
+
version: '3.3'
|
|
165
|
+
- - "<"
|
|
166
|
+
- !ruby/object:Gem::Version
|
|
167
|
+
version: 4.1.dev
|
|
168
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
|
+
requirements:
|
|
170
|
+
- - ">="
|
|
171
|
+
- !ruby/object:Gem::Version
|
|
172
|
+
version: '0'
|
|
173
|
+
requirements: []
|
|
174
|
+
rubygems_version: 3.5.23
|
|
175
|
+
signing_key:
|
|
176
|
+
specification_version: 4
|
|
177
|
+
summary: Very fast, feature-packed, AI-first markdown gem for Ruby.
|
|
178
|
+
test_files: []
|