jekyll-notion 2.0.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -33
- data/lib/jekyll-notion/abstract_notion_resource.rb +6 -0
- data/lib/jekyll-notion/document_without_a_file.rb +1 -1
- data/lib/jekyll-notion/generator.rb +12 -3
- data/lib/jekyll-notion/notion_database.rb +7 -4
- data/lib/jekyll-notion/notion_page.rb +2 -8
- data/lib/jekyll-notion/version.rb +1 -1
- metadata +21 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddda8e393e7ade4bf8e4ae38fd751750596bd988846071eac9626be7ac5f7e6c
|
4
|
+
data.tar.gz: a98cfe15172a91f360d846a6cb1f2f6761046f9abe883a2a3a2cba96f261c3ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a184bcf01c6e03f71d237c9bb055330344ecfba45d288228bfb29f2960860fc22228aafecc9d3d234d2b9bbebacc54ab89fc7f9ba8c187978d65bf44044243c8
|
7
|
+
data.tar.gz: d4df4563e41dca9765cf681c10d095792b33d95afdb95b5dbfc35f569c3ff78a15a22620db60cce3e0485e7f4d115952d57db921d960fed5365d2c74f289025f
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# jekyll-notion
|
2
2
|
|
3
|
-
Import notion pages to
|
3
|
+
Import notion pages to jekyll.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -34,17 +34,17 @@ $ export NOTION_TOKEN=<secret_...>
|
|
34
34
|
|
35
35
|
### Databases
|
36
36
|
|
37
|
-
Once
|
37
|
+
Once the [notion database](https://www.notion.so/help/intro-to-databases) has been shared, specify the database `id` in the `_config.yml` file as follows.
|
38
38
|
|
39
39
|
```yml
|
40
40
|
notion:
|
41
|
-
|
42
|
-
id: 5cfed4de3bdc4f43ae8ba653a7a2219b
|
41
|
+
databases:
|
42
|
+
- id: 5cfed4de3bdc4f43ae8ba653a7a2219b
|
43
43
|
```
|
44
44
|
|
45
45
|
By default, the notion pages contained in the database will be loaded into the `posts` collection.
|
46
46
|
|
47
|
-
|
47
|
+
We can also define __multiple databases__ as follows.
|
48
48
|
|
49
49
|
```yml
|
50
50
|
collections:
|
@@ -68,16 +68,16 @@ Each dabatase support the following options.
|
|
68
68
|
|
69
69
|
* `id`: the notion database unique identifier,
|
70
70
|
* `collection`: the collection each page belongs to (posts by default),
|
71
|
-
* `filter`: the database query
|
72
|
-
* `
|
71
|
+
* `filter`: the database [filter property](https://developers.notion.com/reference/post-database-query-filter),
|
72
|
+
* `sorts`: the database [sorts criteria](https://developers.notion.com/reference/post-database-query-sort),
|
73
73
|
|
74
74
|
```yml
|
75
75
|
notion:
|
76
|
-
|
77
|
-
id: e42383cd49754897b967ce453760499f
|
78
|
-
|
79
|
-
|
80
|
-
|
76
|
+
databases:
|
77
|
+
- id: e42383cd49754897b967ce453760499f
|
78
|
+
collection: posts
|
79
|
+
filter: { "property": "Published", "checkbox": { "equals": true } }
|
80
|
+
sorts: [{ "timestamp": "created_time", "direction": "ascending" }]
|
81
81
|
```
|
82
82
|
|
83
83
|
### Pages
|
@@ -86,8 +86,8 @@ Individual Notion pages can also be loaded into Jekyll. Just define the `page` p
|
|
86
86
|
|
87
87
|
```yml
|
88
88
|
notion:
|
89
|
-
|
90
|
-
id: 5cfed4de3bdc4f43ae8ba653a7a2219b
|
89
|
+
pages:
|
90
|
+
- id: 5cfed4de3bdc4f43ae8ba653a7a2219b
|
91
91
|
```
|
92
92
|
|
93
93
|
As databases, we can set up multiple pages.
|
@@ -122,7 +122,7 @@ notion:
|
|
122
122
|
|
123
123
|
Page properties and body of the notion page are stored as a hash object.
|
124
124
|
|
125
|
-
|
125
|
+
Data objects can be accessed as follows.
|
126
126
|
|
127
127
|
```html
|
128
128
|
<ul>
|
@@ -149,30 +149,15 @@ Set `fetch_on_watch` to true to allow request on each rebuild.
|
|
149
149
|
```yml
|
150
150
|
notion:
|
151
151
|
fetch_on_watch: true
|
152
|
-
|
153
|
-
id: e42383cd49754897b967ce453760499f
|
152
|
+
databases:
|
153
|
+
- id: e42383cd49754897b967ce453760499f
|
154
154
|
```
|
155
155
|
|
156
156
|
And that's all. Each page in the notion database will be included in the selected collection.
|
157
157
|
|
158
158
|
## Notion properties
|
159
159
|
|
160
|
-
|
161
|
-
|
162
|
-
Notion page properties are `id`, `title`, `created_time`, `last_edited_time`, `icon`, `cover` and `archived`.
|
163
|
-
|
164
|
-
```
|
165
|
-
---
|
166
|
-
id: e42383cd-4975-4897-b967-ce453760499f
|
167
|
-
title: An amazing post
|
168
|
-
cover: https://img.bank.sh/an_image.jpg
|
169
|
-
date: 2022-01-23T12:31:00.000Z
|
170
|
-
icon: 💥
|
171
|
-
archived: false
|
172
|
-
---
|
173
|
-
```
|
174
|
-
|
175
|
-
In addition to default properties, custom properties are also appended to front matter.
|
160
|
+
Notion page properties are set for each document in the front matter.
|
176
161
|
|
177
162
|
Please, refer to the [notion_to_md](https://github.com/emoriarty/notion_to_md/) gem to learn more.
|
178
163
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module JekyllNotion
|
4
4
|
class DocumentWithoutAFile < Jekyll::Document
|
5
|
-
def read_content(
|
5
|
+
def read_content(**_opts)
|
6
6
|
if content =~ YAML_FRONT_MATTER_REGEXP
|
7
7
|
self.content = Regexp.last_match.post_match
|
8
8
|
data_file = SafeYAML.load(Regexp.last_match(1))
|
@@ -20,11 +20,20 @@ module JekyllNotion
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def config_databases
|
23
|
-
|
23
|
+
if config["database"]
|
24
|
+
Jekyll.logger.warn("Jekyll Notion:",
|
25
|
+
"database property is deprecated, use databases instead.")
|
26
|
+
end
|
27
|
+
|
28
|
+
config["databases"] || []
|
24
29
|
end
|
25
30
|
|
26
31
|
def config_pages
|
27
|
-
|
32
|
+
if config["page"]
|
33
|
+
Jekyll.logger.warn("Jekyll Notion:",
|
34
|
+
"page property is deprecated, use pages instead.")
|
35
|
+
end
|
36
|
+
config["pages"] || []
|
28
37
|
end
|
29
38
|
|
30
39
|
def collections
|
@@ -42,7 +51,7 @@ module JekyllNotion
|
|
42
51
|
protected
|
43
52
|
|
44
53
|
def cache_empty?
|
45
|
-
collections.empty? && pages.empty? && data.empty?
|
54
|
+
collections.empty? && pages.empty? && data.empty?
|
46
55
|
end
|
47
56
|
|
48
57
|
def read_notion_databases
|
@@ -7,7 +7,7 @@ module JekyllNotion
|
|
7
7
|
return [] unless id?
|
8
8
|
|
9
9
|
@fetch ||= @notion.database_query(query)[:results].map do |page|
|
10
|
-
NotionToMd::Page.new(:page => page, :blocks =>
|
10
|
+
NotionToMd::Page.new(:page => page, :blocks => build_blocks)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -15,8 +15,11 @@ module JekyllNotion
|
|
15
15
|
config["filter"]
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
config["sort"]
|
18
|
+
def sorts
|
19
|
+
if config["sort"]
|
20
|
+
Jekyll.logger.warn("Jekyll Notion:", "sort property is deprecated, use sorts instead")
|
21
|
+
end
|
22
|
+
config["sorts"]
|
20
23
|
end
|
21
24
|
|
22
25
|
def collection_name
|
@@ -30,7 +33,7 @@ module JekyllNotion
|
|
30
33
|
private
|
31
34
|
|
32
35
|
def query
|
33
|
-
{ :
|
36
|
+
{ :database_id => id, :filter => filter, :sorts => sorts }.compact
|
34
37
|
end
|
35
38
|
end
|
36
39
|
end
|
@@ -6,8 +6,8 @@ module JekyllNotion
|
|
6
6
|
def fetch
|
7
7
|
return nil unless id?
|
8
8
|
|
9
|
-
@fetch ||= NotionToMd::Page.new(:page => @notion.page(
|
10
|
-
:blocks =>
|
9
|
+
@fetch ||= NotionToMd::Page.new(:page => @notion.page({ :page_id => id }),
|
10
|
+
:blocks => build_blocks)
|
11
11
|
end
|
12
12
|
|
13
13
|
def data_name
|
@@ -17,11 +17,5 @@ module JekyllNotion
|
|
17
17
|
def collection_name
|
18
18
|
nil
|
19
19
|
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def query
|
24
|
-
{ :id => id }
|
25
|
-
end
|
26
20
|
end
|
27
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-notion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
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-
|
11
|
+
date: 2022-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -36,28 +36,28 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: 1.0.0
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 1.0.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: notion_to_md
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 2.0.0
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
60
|
+
version: 2.0.0
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: bundler
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,6 +100,20 @@ dependencies:
|
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: 0.12.0
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: simplecov
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.21.0
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 0.21.0
|
103
117
|
description:
|
104
118
|
email:
|
105
119
|
- emoriarty81@gmail.com
|
@@ -142,8 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
156
|
- !ruby/object:Gem::Version
|
143
157
|
version: '0'
|
144
158
|
requirements: []
|
145
|
-
|
146
|
-
rubygems_version: 2.7.3
|
159
|
+
rubygems_version: 3.1.6
|
147
160
|
signing_key:
|
148
161
|
specification_version: 4
|
149
162
|
summary: A Jekyll plugin to generate pages from Notion
|