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/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Ldown
|
|
2
|
+
|
|
3
|
+
This is a Markdown parser and converter library for Ruby with lowdown.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bundle add ldown
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
gem install ldown
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
require "ldown"
|
|
23
|
+
|
|
24
|
+
Ldown.into_html("Hello, *lowdown*!")
|
|
25
|
+
#=> "<p>Hello, <em>lowdown</em>!</p>\n"
|
|
26
|
+
|
|
27
|
+
# Or more involved way:
|
|
28
|
+
doc = Ldown::Document.new
|
|
29
|
+
node = doc.parse("Hello, *lowdown*!")
|
|
30
|
+
html = Ldown::HTML.new
|
|
31
|
+
html.render(node)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
See also the API documentation.
|
|
35
|
+
|
|
36
|
+
Caution: the manpage says that the CommonMark support is experimental
|
|
37
|
+
and imcomplete at the time of writing.
|
|
38
|
+
|
|
39
|
+
Caution: Some options are only effective when other options are
|
|
40
|
+
enabled. For example, if you enable `mantitle`, you must enable
|
|
41
|
+
`metadata` too to apply the option; if you enable `super_short`, you
|
|
42
|
+
must enable `super` too.
|
|
43
|
+
|
|
44
|
+
Currently, it lacks the abstruct syntax tree support.
|
|
45
|
+
|
|
46
|
+
## Development
|
|
47
|
+
|
|
48
|
+
After checking out the repo, run `bin/setup` to install
|
|
49
|
+
dependencies. Then, run `rake test` to run the tests. You can also run
|
|
50
|
+
`bin/console` for an interactive prompt that will allow you to
|
|
51
|
+
experiment.
|
|
52
|
+
|
|
53
|
+
To install this gem onto your local machine, run `bundle exec rake
|
|
54
|
+
install`. To release a new version, update the version number in
|
|
55
|
+
`version.rb`, and then run `bundle exec rake release`, which will
|
|
56
|
+
create a git tag for the version, push git commits and the created
|
|
57
|
+
tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
58
|
+
|
|
59
|
+
## Contributing
|
|
60
|
+
|
|
61
|
+
Bug reports and pull requests are welcome.
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
Copyright (C) 2026 gemmaro
|
|
66
|
+
|
|
67
|
+
This program is free software: you can redistribute it and/or modify
|
|
68
|
+
it under the terms of the GNU General Public License as published by
|
|
69
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
70
|
+
(at your option) any later version.
|
|
71
|
+
|
|
72
|
+
This program is distributed in the hope that it will be useful,
|
|
73
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
74
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
75
|
+
GNU General Public License for more details.
|
|
76
|
+
|
|
77
|
+
You should have received a copy of the GNU General Public License
|
|
78
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bundler/gem_tasks"
|
|
4
|
+
require "rake/testtask"
|
|
5
|
+
|
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
|
7
|
+
t.libs << "test"
|
|
8
|
+
t.libs << "lib"
|
|
9
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
require "rake/extensiontask"
|
|
13
|
+
|
|
14
|
+
task build: :compile
|
|
15
|
+
|
|
16
|
+
GEMSPEC = Gem::Specification.load("ldown.gemspec")
|
|
17
|
+
|
|
18
|
+
Rake::ExtensionTask.new("ldown", GEMSPEC) do |ext|
|
|
19
|
+
ext.lib_dir = "lib/ldown"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
task default: %i[clobber compile test]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright (C) 2026 gemmaro
|
|
4
|
+
#
|
|
5
|
+
# This program is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
# (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU General Public License
|
|
16
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
require "mkmf"
|
|
19
|
+
|
|
20
|
+
have_header("sys/queue.h") or raise "no sys/queue header"
|
|
21
|
+
have_library("lowdown") or raise "no lowdown library found"
|
|
22
|
+
|
|
23
|
+
# HEADER = "lowdown.h"
|
|
24
|
+
# have_header(HEADER) or raise "no lowdown header"
|
|
25
|
+
# have_func("lowdown_doc_new", HEADER) or raise "no lowdown_doc_new function found"
|
|
26
|
+
|
|
27
|
+
# Makes all symbols private by default to avoid unintended conflict
|
|
28
|
+
# with other gems. To explicitly export symbols you can use RUBY_FUNC_EXPORTED
|
|
29
|
+
# selectively, or entirely remove this flag.
|
|
30
|
+
append_cflags("-fvisibility=hidden")
|
|
31
|
+
|
|
32
|
+
create_makefile("ldown/ldown")
|