0.2.2 • Published 8 months ago

get-notion-object-title v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Get Notion Object Title

The Notion API does not provide a simple way to retrieve the title of an object. This module provides you with a simple API where you can pass in a Notion Object and receive a human readable string.

Install

npm i get-notion-object-title

Usage

import getNotionObjectTitle from 'get-notion-object-title';

getNotionObjectTitle(yourBlock); // returns "Human readable block title"

Disable emoji

If you already have a way to handle icons and would like to only get the text, you can disable the emojis by passing in an option.

getNotionObjectTitle(yourBlock, { emoji: false }); // returns "Human readable block title"

How does it work?

The getNotionObjectTitle takes a Notion object as input and returns a string. Depending on the type of the object there are some rules that are applied.

Page

If the page has any of the following properties they will be used and they do exclude each other:

  • Title
  • Page
  • Name

Database

The database uses the top level title attribute.

Other

The remaining blocks are converted to plain text using the rich text items.

License

Unless otherwise specified in the source:

The code is licensed under the MIT Copyright (c) 2023, Alexander Alemayhu.

0.2.2

8 months ago

0.2.1

9 months ago

0.2.0

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.2

10 months ago

0.0.0

10 months ago