notion_to_md 0.0.2 → 0.0.3
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 +4 -4
- data/README.md +6 -1
- data/lib/notion_to_md/converter.rb +2 -3
- data/lib/notion_to_md/logger.rb +2 -4
- data/lib/notion_to_md/text_annotation.rb +2 -0
- data/lib/notion_to_md/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e11590c90c4539c151d8c290f1175a76c331bcd4027832c055158ae11b3e396
|
4
|
+
data.tar.gz: 410e1b78ddb8f287b9b4a92b7e583910cccf6474d612b42c4a4933dad0d154b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: deeb77d21a3be57cb713b1c765b008b502d8c100bb103be99a88b50311c3895d3557f8c2909db1d8334616e223862fd6bf6e0b21c233237ab99698f7d008c466
|
7
|
+
data.tar.gz: 594bc21094683131274a3eb254ea9efad95a6d98839d219862bfd38b867aba43fb833ef3c9adb47dce55aa9a089ee16d806e049a356fedb1b5aee177746be8a1
|
data/README.md
CHANGED
@@ -38,4 +38,9 @@ notion_converter = NotionToMd::Converter.new(page_id: 'b91d5...')
|
|
38
38
|
md = notion_converter.convert
|
39
39
|
```
|
40
40
|
|
41
|
-
And that's all. The `md` is a string variable containing the notion page formatted in markdown.
|
41
|
+
And that's all. The `md` is a string variable containing the notion page formatted in markdown.
|
42
|
+
|
43
|
+
## Test
|
44
|
+
```bash
|
45
|
+
$ ruby -Ilib:test test/notion_to_md/converter_spec.rb
|
46
|
+
```
|
@@ -21,7 +21,7 @@ module NotionToMd
|
|
21
21
|
|
22
22
|
begin
|
23
23
|
send(block_type, block[block_type])
|
24
|
-
rescue
|
24
|
+
rescue StandardError
|
25
25
|
Logger.info("Unsupported block type: #{block_type}")
|
26
26
|
next nil
|
27
27
|
end
|
@@ -36,7 +36,6 @@ module NotionToMd
|
|
36
36
|
@page_blocks ||= @notion.block_children(id: page_id)
|
37
37
|
end
|
38
38
|
|
39
|
-
|
40
39
|
def paragraph(block)
|
41
40
|
convert_text(block)
|
42
41
|
end
|
@@ -148,7 +147,7 @@ module NotionToMd
|
|
148
147
|
end
|
149
148
|
|
150
149
|
def add_annotations(text, content)
|
151
|
-
annotations = text[:annotations].select { |
|
150
|
+
annotations = text[:annotations].select { |_key, value| !!value }
|
152
151
|
annotations.keys.inject(content) do |enriched_content, annotation|
|
153
152
|
TextAnnotation.send(annotation.to_sym, enriched_content)
|
154
153
|
end
|
data/lib/notion_to_md/logger.rb
CHANGED
@@ -4,13 +4,11 @@ require 'logger'
|
|
4
4
|
|
5
5
|
module NotionToMd
|
6
6
|
class Logger
|
7
|
-
@logger = ::Logger.new(
|
7
|
+
@logger = ::Logger.new($stdout)
|
8
8
|
|
9
9
|
class << self
|
10
10
|
extend Forwardable
|
11
|
-
def_delegators :@logger, :debug, :info, :warn, :error, :fatal
|
11
|
+
def_delegators :@logger, :debug, :info, :warn, :error, :fatal, :level, :level=
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
15
|
-
|
16
|
-
|
data/lib/notion_to_md/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notion_to_md
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Enrique Arias
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: notion-ruby-client
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: Notion Markdown Exporter in Ruby
|
42
56
|
email: emoriarty81@gmail.com
|
43
57
|
executables: []
|