Giter Site home page Giter Site logo

notion-code-block-quick-action's Introduction

notion-code-block-quick-action

a macOS service to append a new code block to the most recent updated page

日本語版 README はこちら

How to install

Install

  • Enable NotionQuickAction and set a shortcut key. In this figure, I set option + command + N.

Install

  • Open Terminal software.
  • Open NotionQuickAction.workflow by the following terminal command.
open $HOME/Library/Services/NotionQuickAction.workflow
  • We can see a JXA code in a Run JavaScript action.

Install

  • Rewrite some values

The following 4 values must be adjust to your environment. In you don't know about NOTION_API_TOKEN and DATABASE_ID, please read the below Notion API setup.

// ########## Personal settings ##########
// Set your Notion API Token (strings that starts with `secret_`)
const NOTION_API_TOKEN = "secret_XXXXXXXXXXXXXXXXXXXXXXXX"
// Set your database ID (32-digits hex number)
const DATABASE_ID = "YYYYYYYYYYYYYYYYYYYYYYYYYYY"
// Set default language
const DEFAULT_LANGUAGE = "shell"
// If you want to open a new task by Notion.app, set true.  If you want to open it by your default browser, set false.
const OPEN_BY_APP = true

Notion API setup

Next, set API setting. Please see Getting Started in the Notion Developer page. Please remind NOTION_API_TOKEN and database_id for the above database (DATABASE_ID), and invite your integration to the databases.

Share for integration

How to use

Any application that allows text selection can be used. After you selected some text, press the shortcut key for NotionCodeBlockQuickAction. Then, type the language for the selected text. If you don't input any text or input an illegal language, DEFAULT_LANGUAGE is used for the language for the selected text.

After you press the return key or press the CONTINUE button, a code block is appended to the most recent page in the database in a few seconds and is displayed in Notion.app or your default browser.

movie

Change Log

  • Ver. 1.0
    • First release

notion-code-block-quick-action's People

Contributors

hkob avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.