ldown 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.
- checksums.yaml +7 -0
- data/.clang-format +1 -0
- data/.dir-locals.el +8 -0
- data/.document +6 -0
- data/.envrc +9 -0
- data/.rdoc_options +29 -0
- data/CHANGELOG.md +7 -0
- data/COPYING +674 -0
- data/README.md +78 -0
- data/Rakefile +22 -0
- data/ext/ldown/extconf.rb +32 -0
- data/ext/ldown/ldown.c +820 -0
- data/ext/ldown/ldown.h +6 -0
- data/lib/ldown/version.rb +5 -0
- data/lib/ldown.rb +139 -0
- data/sig/ldown.rbs +128 -0
- metadata +63 -0
data/ext/ldown/ldown.h
ADDED
data/lib/ldown.rb
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
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 "ldown/version"
|
|
21
|
+
require "ldown/ldown"
|
|
22
|
+
|
|
23
|
+
# The all +into_+ class methods take a lot of keyword arguments as
|
|
24
|
+
# shown in the type signatures. Please also refer to the lowdown
|
|
25
|
+
# manpages for the detailed explanations for them.
|
|
26
|
+
module Ldown
|
|
27
|
+
class << self
|
|
28
|
+
##
|
|
29
|
+
# :method: into_fodt
|
|
30
|
+
#
|
|
31
|
+
# Parse into the flat OpenDocument.
|
|
32
|
+
|
|
33
|
+
##
|
|
34
|
+
# :method: into_gemini
|
|
35
|
+
#
|
|
36
|
+
# Parse into Gemtext (for Gemini protocol).
|
|
37
|
+
|
|
38
|
+
##
|
|
39
|
+
# :method: into_man
|
|
40
|
+
#
|
|
41
|
+
# Parse into roff man.
|
|
42
|
+
|
|
43
|
+
##
|
|
44
|
+
# :method: into_mdoc
|
|
45
|
+
#
|
|
46
|
+
# Parse into roff mdoc.
|
|
47
|
+
|
|
48
|
+
##
|
|
49
|
+
# :method: into_ms
|
|
50
|
+
#
|
|
51
|
+
# Parse into roff ms.
|
|
52
|
+
|
|
53
|
+
##
|
|
54
|
+
# :method: into_term
|
|
55
|
+
#
|
|
56
|
+
# Parse into the ANSI UTF-8 terminal output.
|
|
57
|
+
|
|
58
|
+
##
|
|
59
|
+
# :method: into_tree
|
|
60
|
+
#
|
|
61
|
+
# Parse into the debug tree serialization.
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
class Document
|
|
65
|
+
class << self
|
|
66
|
+
##
|
|
67
|
+
# :method: new
|
|
68
|
+
# :call-seq: new (**kwargs)
|
|
69
|
+
#
|
|
70
|
+
# It takes sum of options for the ones that
|
|
71
|
+
# <tt>Lowdown.into_*</tt> class methods take.
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
##
|
|
75
|
+
# :method: parse
|
|
76
|
+
# :call-seq: parse (input) -> node
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
class Gemini
|
|
80
|
+
class << self
|
|
81
|
+
##
|
|
82
|
+
# :method: new
|
|
83
|
+
# :call-seq: new (**kwargs)
|
|
84
|
+
#
|
|
85
|
+
# It takes the same options as +Ldown.into_gemini+.
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
class HTML
|
|
90
|
+
class << self
|
|
91
|
+
##
|
|
92
|
+
# :method: new
|
|
93
|
+
# :call-seq: new (**kwargs)
|
|
94
|
+
#
|
|
95
|
+
# It takes the same options as +Ldown.into_html+.
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
class LaTeX
|
|
100
|
+
class << self
|
|
101
|
+
##
|
|
102
|
+
# :method: new
|
|
103
|
+
# :call-seq: new (**kwargs)
|
|
104
|
+
#
|
|
105
|
+
# It takes the same options as +Ldown.into_latex+.
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
class OpenDocument
|
|
110
|
+
class << self
|
|
111
|
+
##
|
|
112
|
+
# :method: new
|
|
113
|
+
# :call-seq: new (**kwargs)
|
|
114
|
+
#
|
|
115
|
+
# It takes the same options as +Ldown.into_fodt+.
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
class Roff
|
|
120
|
+
class << self
|
|
121
|
+
##
|
|
122
|
+
# :method: new
|
|
123
|
+
# :call-seq: new (**kwargs)
|
|
124
|
+
#
|
|
125
|
+
# It takes the same options as +Ldown.into_man+,
|
|
126
|
+
# +Ldown.into_mdoc+, or +Ldown.into_ms+.
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
class Term
|
|
131
|
+
class << self
|
|
132
|
+
##
|
|
133
|
+
# :method: new
|
|
134
|
+
# :call-seq: new (**kwargs)
|
|
135
|
+
#
|
|
136
|
+
# It takes the same options as +Ldown.into_term+.
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
data/sig/ldown.rbs
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
module Ldown
|
|
2
|
+
VERSION: String
|
|
3
|
+
|
|
4
|
+
def self.into_fodt: (
|
|
5
|
+
# feat:
|
|
6
|
+
attrs: bool, autolink: bool, callouts: bool, commonmark: bool, deflist: bool, fenced: bool, footnotes: bool, hilite: bool, mantitle: bool, math: bool, metadata: bool, no_code_indented: bool, no_intra_emph: bool, strike: bool, super: bool, super_short: bool, tables: bool, tasklist: bool,
|
|
7
|
+
# oflags/general:
|
|
8
|
+
no_link: bool, no_rellink: bool, shortlink: bool, skip_html: bool, smarty: bool, standalone: bool,
|
|
9
|
+
# others:
|
|
10
|
+
maxdepth: Integer) -> String
|
|
11
|
+
|
|
12
|
+
def self.into_gemini: (
|
|
13
|
+
# feat:
|
|
14
|
+
attrs: bool, autolink: bool, callouts: bool, commonmark: bool, deflist: bool, fenced: bool, footnotes: bool, hilite: bool, mantitle: bool, math: bool, metadata: bool, no_code_indented: bool, no_intra_emph: bool, strike: bool, super: bool, super_short: bool, tables: bool, tasklist: bool,
|
|
15
|
+
# oflags/general:
|
|
16
|
+
no_link: bool, no_rellink: bool, shortlink: bool, skip_html: bool, smarty: bool, standalone: bool,
|
|
17
|
+
# oflags/gemini:
|
|
18
|
+
gemini_link_end: bool, gemini_link_in: bool, gemini_link_no_ref: bool, gemini_link_roman: bool, gemini_metadata: bool,
|
|
19
|
+
# others:
|
|
20
|
+
maxdepth: Integer) -> String
|
|
21
|
+
|
|
22
|
+
def self.into_html: (
|
|
23
|
+
# feat:
|
|
24
|
+
attrs: bool, autolink: bool, callouts: bool, commonmark: bool, deflist: bool, fenced: bool, footnotes: bool, hilite: bool, mantitle: bool, math: bool, metadata: bool, no_code_indented: bool, no_intra_emph: bool, strike: bool, super: bool, super_short: bool, tables: bool, tasklist: bool,
|
|
25
|
+
# oflags/general:
|
|
26
|
+
no_link: bool, no_rellink: bool, shortlink: bool, skip_html: bool, smarty: bool, standalone: bool,
|
|
27
|
+
# oflags/html
|
|
28
|
+
html_callout_mdn: bool, html_callout_gfm: bool, html_custom_attrs: bool, html_escape: bool, html_hard_wrap: bool, html_head_ids: bool, html_num_entity: bool, html_owasp: bool, html_titleblock: bool,
|
|
29
|
+
# others:
|
|
30
|
+
maxdepth: Integer) -> String
|
|
31
|
+
|
|
32
|
+
def self.into_latex: (
|
|
33
|
+
# feat:
|
|
34
|
+
attrs: bool, autolink: bool, callouts: bool, commonmark: bool, deflist: bool, fenced: bool, footnotes: bool, hilite: bool, mantitle: bool, math: bool, metadata: bool, no_code_indented: bool, no_intra_emph: bool, strike: bool, super: bool, super_short: bool, tables: bool, tasklist: bool,
|
|
35
|
+
# oflags/general:
|
|
36
|
+
no_link: bool, no_rellink: bool, shortlink: bool, skip_html: bool, smarty: bool, standalone: bool,
|
|
37
|
+
# oflags/latex:
|
|
38
|
+
latex_numbered: bool,
|
|
39
|
+
# others:
|
|
40
|
+
maxdepth: Integer) -> String
|
|
41
|
+
|
|
42
|
+
def self.into_man: (
|
|
43
|
+
# feat:
|
|
44
|
+
attrs: bool, autolink: bool, callouts: bool, commonmark: bool, deflist: bool, fenced: bool, footnotes: bool, hilite: bool, mantitle: bool, math: bool, metadata: bool, no_code_indented: bool, no_intra_emph: bool, strike: bool, super: bool, super_short: bool, tables: bool, tasklist: bool,
|
|
45
|
+
# oflags/general:
|
|
46
|
+
no_link: bool, no_rellink: bool, shortlink: bool, skip_html: bool, smarty: bool, standalone: bool,
|
|
47
|
+
# oflags/roff:
|
|
48
|
+
roff_groff: bool, roff_numbered: bool, roff_manpage: bool, roff_endnotes: bool,
|
|
49
|
+
# others:
|
|
50
|
+
maxdepth: Integer) -> String
|
|
51
|
+
|
|
52
|
+
def self.into_mdoc: (
|
|
53
|
+
# feat:
|
|
54
|
+
attrs: bool, autolink: bool, callouts: bool, commonmark: bool, deflist: bool, fenced: bool, footnotes: bool, hilite: bool, mantitle: bool, math: bool, metadata: bool, no_code_indented: bool, no_intra_emph: bool, strike: bool, super: bool, super_short: bool, tables: bool, tasklist: bool,
|
|
55
|
+
# oflags/general:
|
|
56
|
+
no_link: bool, no_rellink: bool, shortlink: bool, skip_html: bool, smarty: bool, standalone: bool,
|
|
57
|
+
# oflags/roff:
|
|
58
|
+
roff_groff: bool, roff_numbered: bool, roff_manpage: bool, roff_endnotes: bool,
|
|
59
|
+
# others:
|
|
60
|
+
maxdepth: Integer) -> String
|
|
61
|
+
|
|
62
|
+
def self.into_ms: (
|
|
63
|
+
# feat:
|
|
64
|
+
attrs: bool, autolink: bool, callouts: bool, commonmark: bool, deflist: bool, fenced: bool, footnotes: bool, hilite: bool, mantitle: bool, math: bool, metadata: bool, no_code_indented: bool, no_intra_emph: bool, strike: bool, super: bool, super_short: bool, tables: bool, tasklist: bool,
|
|
65
|
+
# oflags/general:
|
|
66
|
+
no_link: bool, no_rellink: bool, shortlink: bool, skip_html: bool, smarty: bool, standalone: bool,
|
|
67
|
+
# oflags/roff:
|
|
68
|
+
roff_groff: bool, roff_numbered: bool, roff_manpage: bool, roff_endnotes: bool,
|
|
69
|
+
# others:
|
|
70
|
+
maxdepth: Integer) -> String
|
|
71
|
+
|
|
72
|
+
def self.into_term: (
|
|
73
|
+
# feat:
|
|
74
|
+
attrs: bool, autolink: bool, callouts: bool, commonmark: bool, deflist: bool, fenced: bool, footnotes: bool, hilite: bool, mantitle: bool, math: bool, metadata: bool, no_code_indented: bool, no_intra_emph: bool, strike: bool, super: bool, super_short: bool, tables: bool, tasklist: bool,
|
|
75
|
+
# oflags/general:
|
|
76
|
+
no_link: bool, no_rellink: bool, shortlink: bool, skip_html: bool, smarty: bool, standalone: bool,
|
|
77
|
+
# oflags/term:
|
|
78
|
+
term_all_meta: bool, term_no_ansi: bool, term_no_colour: bool,
|
|
79
|
+
# others:
|
|
80
|
+
maxdepth: Integer) -> String
|
|
81
|
+
|
|
82
|
+
def self.into_tree: (
|
|
83
|
+
# feat:
|
|
84
|
+
attrs: bool, autolink: bool, callouts: bool, commonmark: bool, deflist: bool, fenced: bool, footnotes: bool, hilite: bool, mantitle: bool, math: bool, metadata: bool, no_code_indented: bool, no_intra_emph: bool, strike: bool, super: bool, super_short: bool, tables: bool, tasklist: bool,
|
|
85
|
+
# oflags/general:
|
|
86
|
+
no_link: bool, no_rellink: bool, shortlink: bool, skip_html: bool, smarty: bool, standalone: bool,
|
|
87
|
+
# others:
|
|
88
|
+
maxdepth: Integer) -> String
|
|
89
|
+
|
|
90
|
+
class Document
|
|
91
|
+
def parse: (String) -> Ldown::Node
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
class Gemini
|
|
95
|
+
def render: (Ldown::Node) -> String
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
class HTML
|
|
99
|
+
def render: (Ldown::Node) -> String
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
class LaTeX
|
|
103
|
+
def render: (Ldown::Node) -> String
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
class OpenDocument
|
|
107
|
+
def render: (Ldown::Node) -> String
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
class Roff
|
|
111
|
+
def render: (Ldown::Node) -> String
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
class Term
|
|
115
|
+
def render: (Ldown::Node) -> String
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
class Node
|
|
119
|
+
def diff_from: (Ldown::Node) -> Ldown::Node
|
|
120
|
+
def tree: (
|
|
121
|
+
# feat:
|
|
122
|
+
attrs: bool, autolink: bool, callouts: bool, commonmark: bool, deflist: bool, fenced: bool, footnotes: bool, hilite: bool, mantitle: bool, math: bool, metadata: bool, no_code_indented: bool, no_intra_emph: bool, strike: bool, super: bool, super_short: bool, tables: bool, tasklist: bool,
|
|
123
|
+
# oflags/general:
|
|
124
|
+
no_link: bool, no_rellink: bool, shortlink: bool, skip_html: bool, smarty: bool, standalone: bool,
|
|
125
|
+
# others:
|
|
126
|
+
maxdepth: Integer) -> String
|
|
127
|
+
end
|
|
128
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ldown
|
|
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: This is a Markdown parser and converter library using the lowdown C library. It
|
|
13
|
+
can convert into several markup languages, for example, HTML (HTML5), LaTeX, roff
|
|
14
|
+
(man, mdoc, and ms), the flat OpenDocument (FODT), ANSI compatible UTF-8 terminal
|
|
15
|
+
(term), Gemtext (for Gemini protocol), and 'tree' for debug purpose. The input
|
|
16
|
+
options for Markdown documents include various flavors support, such as GitHub flavored
|
|
17
|
+
Markdown, experimental CommonMark, and multiple unique features, and so the output
|
|
18
|
+
options do.
|
|
19
|
+
email:
|
|
20
|
+
- gemmaro.dev@gmail.com
|
|
21
|
+
executables: []
|
|
22
|
+
extensions:
|
|
23
|
+
- ext/ldown/extconf.rb
|
|
24
|
+
extra_rdoc_files: []
|
|
25
|
+
files:
|
|
26
|
+
- ".clang-format"
|
|
27
|
+
- ".dir-locals.el"
|
|
28
|
+
- ".document"
|
|
29
|
+
- ".envrc"
|
|
30
|
+
- ".rdoc_options"
|
|
31
|
+
- CHANGELOG.md
|
|
32
|
+
- COPYING
|
|
33
|
+
- README.md
|
|
34
|
+
- Rakefile
|
|
35
|
+
- ext/ldown/extconf.rb
|
|
36
|
+
- ext/ldown/ldown.c
|
|
37
|
+
- ext/ldown/ldown.h
|
|
38
|
+
- lib/ldown.rb
|
|
39
|
+
- lib/ldown/version.rb
|
|
40
|
+
- sig/ldown.rbs
|
|
41
|
+
homepage: https://codeberg.org/gemmaro/ldown
|
|
42
|
+
licenses: []
|
|
43
|
+
metadata:
|
|
44
|
+
homepage_uri: https://codeberg.org/gemmaro/ldown
|
|
45
|
+
source_code_uri: https://codeberg.org/gemmaro/ldown.git
|
|
46
|
+
rdoc_options: []
|
|
47
|
+
require_paths:
|
|
48
|
+
- lib
|
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 3.2.0
|
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
|
+
requirements:
|
|
56
|
+
- - ">="
|
|
57
|
+
- !ruby/object:Gem::Version
|
|
58
|
+
version: '0'
|
|
59
|
+
requirements: []
|
|
60
|
+
rubygems_version: 4.0.20
|
|
61
|
+
specification_version: 4
|
|
62
|
+
summary: Markdown parser library with lowdown
|
|
63
|
+
test_files: []
|