Skip to main content
https://api.travis-ci.com/PixelHegel/NotionDict.svg?branch=main

NotionDict

NotionDict is a terminal dictionary application, you can use it to query the words from your own .mdx files,and the result will be shown by system notification. And it also supports uploading the result to Notion. You also can use it to upload highlight text to Notion. The best practice is to bind a shortcut to the app, then you can easily query the dict and highlight text anywhere.

What NotionDict can do?

  1. Query the selected word and show the result by system notification, at the same time, the word will be saved to your Notion database.

doc/notification.png
  1. Highlight the selected text, and sync the selected text to your Notion database, the title of the acitve window will be sent to Notion as well. So you can get the highlight text of one pdf in one Notion page.

doc/highlight.png

The two functions are sepreate functions, you can use only one of them or both.

Preparation

  1. Create two databases, one for saving queried words, the other one for saving highlight texts.

The sturcture of vocabulary database:

doc/vocabulary_notion_database.png

Name: Save the words

Source: Save the source of the word (the active window title when you query the word)

Date: Query date

The sturcture of highlights database:

doc/highlight_notion_database.png

Name: The page name(the active window title when you save the highlight), highlights from same webpage/app will be saved in same notion page.

Date: Save date

  1. You need a .MDX dictionary file to query the word, find the .MDX dictionary you perfer then put it path into config file or env variables.

Installation

pip install notiondict

Usage

Usage:
notiondict dict <word> [--config <file-path>]
notiondict highlight <text> [--config <file-path>]
notiondict -h | --help

Options:
--config <file-path>  your own config file
--help -h  show help

Examples

notiondict dict book --config /home/username/config.yml
notiondict highlight "This is a highlight"

Contents of requirements.txt

docopt==0.6.2
pyclip==0.6.0
PyYAML==6.0
readmdict==0.1.1
requests==2.28.1
setuptools==63.0.0
urllib3==1.26.12

Config file

Your need to save your Notion database id and Notion API Key in env variables or config file:

For env variables:

NOTION_HIGHLIGHT_DATABASE: Your_Notion_Database_Page_ID
NOTION_VOCABULARY_DATABASE: Your_Notion_Database_Page_ID
DICT_PATH: Your_Dict_Path
NOTION_API_KEY: Your_Notion_API_KEY

For config file:

There is a config file example in the repo, attach the config file by this way when you run NotionDict:

notiondict dict book --config /home/username/config.yml

Best practice

For Linux:

Use xsel to pass the selected text to NotionDict

notiondict dict "`xsel`"

For MacOS:

You can create a Shortcut to pass the acitve action to terminal.

Release files for notiondict 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for notiondict 0.1.1
File Size Uploaded
notiondict-0.1.1.tar.gz 10.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for notiondict 0.1.1
File Interpreter ABI Platform
notiondict-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 21.4 kB

Release files / notiondict-0.1.1.tar.gz

Download URL notiondict-0.1.1.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
50f49902d906cc56e9beac4d9fd7aead340d766a9cc367cee377730a00b8d930
BLAKE2b-256 checksum
How to use checksums
679eca133641d162a25ccc0e2fce51d8bb357536ae912f888948f3962abc9629
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.7

Release files / notiondict-0.1.1-py3-none-any.whl

Download URL notiondict-0.1.1-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7e29dc308964097cac6b0d9bd5d332ecae241a840e93cffc8f6590221cf744c
BLAKE2b-256 checksum
How to use checksums
e245d7960d9e7084b501f4358147d5056734f013a5e4a63655850b01f969e607
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.7

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page