notion_to_md 1.1.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/notion_to_md/block.rb +4 -2
- data/lib/notion_to_md/converter.rb +2 -2
- data/lib/notion_to_md/page.rb +2 -2
- data/lib/notion_to_md/version.rb +1 -1
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4876bb92641f8a6199b932404c609cf99a69bafd2f39eaded145f638edd98c39
|
4
|
+
data.tar.gz: f57fa933a7bfa0fc4e1b916cf022b64255da39142a2c546720e08d72b6915b44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86b7daa8a26780c4d6a091048144e05f9a5b48f28993d5a1fed8b53f10e844d3cb54d9b39bb4ffacb35945a1ef9e0128398dac36e68246476f8e3d3919189b87
|
7
|
+
data.tar.gz: 3689b48b6fd3a550be20091601a0b888d5656f51d03e0141b37c391934184a5b3e48456996d5bd42b0ed3188204a3be15292a354eaa28f6c4a61fac2de277a32
|
data/README.md
CHANGED
@@ -67,7 +67,7 @@ By default, the front matter section is not included to the document. To do so,
|
|
67
67
|
NotionToMd::Converter.new(page_id: 'b91d5...').convert(frontmatter: tue)
|
68
68
|
```
|
69
69
|
|
70
|
-
Default notion [properties](https://developers.notion.com/reference/
|
70
|
+
Default notion [properties](https://developers.notion.com/reference/page#all-pages) are page `id`, `title`, `created_time`, `last_edited_time`, `icon`, `archived` and `cover`.
|
71
71
|
|
72
72
|
```yml
|
73
73
|
---
|
data/lib/notion_to_md/block.rb
CHANGED
@@ -49,6 +49,8 @@ module NotionToMd
|
|
49
49
|
language = block[:language]
|
50
50
|
text = convert_text(block)
|
51
51
|
|
52
|
+
language = 'text' if language == 'plain text'
|
53
|
+
|
52
54
|
"```#{language}\n#{text}\n```"
|
53
55
|
end
|
54
56
|
|
@@ -80,14 +82,14 @@ module NotionToMd
|
|
80
82
|
end
|
81
83
|
|
82
84
|
def convert_text(block)
|
83
|
-
block[:
|
85
|
+
block[:rich_text].map do |text|
|
84
86
|
content = Text.send(text[:type], text)
|
85
87
|
enrich_text_content(text, content)
|
86
88
|
end.join
|
87
89
|
end
|
88
90
|
|
89
91
|
def convert_caption(block)
|
90
|
-
convert_text(
|
92
|
+
convert_text(rich_text: block[:caption])
|
91
93
|
end
|
92
94
|
|
93
95
|
def get_icon(block)
|
@@ -20,11 +20,11 @@ module NotionToMd
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def page
|
23
|
-
@page ||= @notion.page(
|
23
|
+
@page ||= @notion.page(page_id: page_id)
|
24
24
|
end
|
25
25
|
|
26
26
|
def page_blocks
|
27
|
-
@page_blocks ||= @notion.block_children(
|
27
|
+
@page_blocks ||= @notion.block_children(block_id: page_id)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
data/lib/notion_to_md/page.rb
CHANGED
@@ -20,7 +20,7 @@ module NotionToMd
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def icon
|
23
|
-
page.dig(:icon, :emoji)
|
23
|
+
page.dig(:icon, :file, :url) || page.dig(:icon, :emoji)
|
24
24
|
end
|
25
25
|
|
26
26
|
def id
|
@@ -45,7 +45,7 @@ module NotionToMd
|
|
45
45
|
|
46
46
|
def body
|
47
47
|
@body ||= blocks[:results].map do |block|
|
48
|
-
next Block.blank if block[:type] == 'paragraph' && block.dig(:paragraph, :
|
48
|
+
next Block.blank if block[:type] == 'paragraph' && block.dig(:paragraph, :rich_text).empty?
|
49
49
|
|
50
50
|
block_type = block[:type].to_sym
|
51
51
|
|
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: 1.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Enrique Arias
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03
|
11
|
+
date: 2022-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '7'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: notion-ruby-client
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hashie
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description: Notion Markdown Exporter in Ruby
|
84
98
|
email: emoriarty81@gmail.com
|
85
99
|
executables: []
|