https://github.com/azzenabidi/notionscribe
A Ruby DSL to create Notion pages effortlessly.
https://github.com/azzenabidi/notionscribe
dsl notion-api ruby ruby-gem
Last synced: 6 months ago
JSON representation
A Ruby DSL to create Notion pages effortlessly.
- Host: GitHub
- URL: https://github.com/azzenabidi/notionscribe
- Owner: azzenabidi
- License: mit
- Created: 2024-09-23T10:26:16.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-24T15:51:45.000Z (almost 2 years ago)
- Last Synced: 2025-03-26T12:51:10.495Z (over 1 year ago)
- Topics: dsl, notion-api, ruby, ruby-gem
- Language: Ruby
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Notion Scribe
=======
This Ruby gem allows you to create Notion pages easily using a DSL.
## Installation
Install the gem
```bash
gem install notion_scribe
```
### Initialize the Client
You need to initialize the Notion client with your API token:
```
require 'notion_client'
require 'notion_template'
client = NotionClient.new("NOTION_API_KEY")
```
### Create a Notion Page
You can create a Notion page by instantiating the `NotionTemplate` class and passing a block that defines the page content:
```
NotionTemplate.new(client, "Your Page Title", parent_id: "PAGE_ID") do
header "Main Header"
paragraph "This is a paragraph explaining something important."
bulleted_list "First bullet point", "Second bullet point"
callout "This is a purple callout block."
end
```
### Available Block Types
**Header 1**:
header "Your header"
**Header 2**
subheader "Your Subheader"
**Header 3**
subsubheader "Your Sub-subheader"
**Paragraph**
paragraph "Your paragraph text."
**Bulleted List**
bulleted_list "Item 1", "Item 2"
**Numbered List**
numbered_list "First item", "Second item"
**Todo**
to_do "Task description", checked: false
**Quote**
quote "This is a quote."
**Image**
image "https://example.com/image.png"
**Callout**
callout "This is a callout message.", color: "purple"
**Divider**
divider
**Table of content**
table_of_contents
### Customization
You can customize the color of the callout block by passing a `color` parameter:
callout "Custom color callout.", color: "yellow" # Change to desired color
## Error Handling
If an error occurs while creating a page, it will be logged to the console with the error message and the attempted page content for easier debugging.
## Contribution
Feel free to fork this repository and submit pull requests for enhancements or bug fixes.
## License
This project is licensed under the MIT License.