Skip to content

Commit

Permalink
Merge pull request #6 from denkiwakame/integrates-arxiv2notionplus
Browse files Browse the repository at this point in the history
#4 Integrates arxiv2notionplus
  • Loading branch information
denkiwakame authored Jan 8, 2024
2 parents 6549ed0 + 7c9c434 commit 6259710
Show file tree
Hide file tree
Showing 28 changed files with 7,308 additions and 3,265 deletions.
10 changes: 10 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
env:
browser: true
webextensions: true
extends: eslint:recommended
globals:
chrome: true
parserOptions:
ecmaVersion: latest
sourceType: module
rules: {}
26 changes: 26 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: eslint

on:
pull_request:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14.17.0"
- uses: actions/cache@v3
id: npm_cache_id
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: install
if: steps.cache.outputs.cache-hit != 'true'
run: npm install
- name: eslint
run: npm run lint
- name: prettier
run: npm run format:check
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
node_modules/
dist/
5 changes: 5 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
trailingComma: 'es5'
tabWidth: 2
semi: true
singleQuote: true

24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# CHANGELOG
All notable changes to this repository will be documented in this file.

## [1.0.0] - 2024-01-08
### Added
- integrates [arxiv2notionplus](https://github.com/wangjksjtu/arxiv2notionplus/issues)(#4)
- add publication date for easier tracking @wangjksjtu
- add comment parser for quick access to the potential project homepage or code link (if available) @wangjksjtu
- Refactor the above codes & fix bugs by @denkiwakame
- CONTRIBUTING.md @denkiwakame
- CHANGELOG.md @denkiwakame
- Linter / Formatter @denkiwakame

### Changed
- Replace the author field from `text` to `multi-select` to fully leverage the search/filter in notion @wangjksjtu
- Release a public notion database/table [here](https://denkiwakame.notion.site/597cdd58bded4375b1cbe073b2ed6f5d?v=63fcbfda57824b239b66e52dde841cdf) @denkiwakame
- Update UI to improve the navigation to the button @denkiwakame

### Fixed
- #7 Migration to Manifest V3 @denkiwakame

## [0.0.1] - 2021-06-07
### Added
- initial release from @denkiwakame
97 changes: 97 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<!-- omit in toc -->
# Contributing to arxiv2notion

First off, thanks for taking the time to contribute! :rainbow:

All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉

> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about:
> - Star the project
> - <s>Tweet</s>X about it
> - Refer this project in your project's readme
<!-- omit in toc -->
## Table of Contents

- [I Have a Question](#i-have-a-question)
- [I Want To Contribute](#i-want-to-contribute)
- [How to Develop arxiv2notion](#how-to-develop-arxiv2notion)
- [Suggesting Enhancements](#suggesting-enhancements)

## I Have a Question

Before you ask a question, it is best to search for existing [Issues](https://github.com/denkiwakame/arxiv2notion/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first.

If you then still feel the need to ask a question and need clarification, we recommend the following:

- Open an [Issue](https://github.com/denkiwakame/arxiv2notion/issues/new).
- Provide as much context as you can about what you're running into.
- Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant.

We will then take care of the issue as soon as possible.

## I Want To Contribute
### How to Develop arxiv2notion

#### How to build your extension locally

```bash
$ git clone https://github.com/denkiwakame/arxiv2notion.md
$ npm install
$ npm run build
$ npm run watch # debug locally
$ npm run pack # pack to .zip extension
```

#### How to debug your extension
- `$ npm run build` build the extension locally
- navigate to `chrome://extension`
- turn on `developer mode`
- select `load unpacked` and open `arxiv2notion/dist`
- you can see the extension ID like `aedplelmaaaldilfkeobdapccljxxxxx` in the loaded extension description
- open `chrome-extension://aedplelmaaaldilfkeobdapccljxxxxx/popup.html`
- open chrome developer tools in your browser (`Ctrl + Shift + i` w/Linux)
- you can see debugging outputs (\eg `console.log()`) in the devtools.
- once you `load unpacked` , the extension is automatically synced whenever you run `npm run build` and reload `chrome-extension://${your-extension-id}/popup.html`
- you will be able to know more about how everything is working.

![image](https://user-images.githubusercontent.com/1871262/141605730-98917f70-f3cc-4d60-9068-29416474a086.png)

#### Change Notion database scheme
- If you attempt to add a new column like `published date` , you need to add it in your notion.so manually https://github.com/denkiwakame/arxiv2notion#getting-started or via Notion API https://developers.notion.com/reference/update-a-database

#### Get arXiv published date
- To retrieve arXiv paper information, this extension utilizes arXiv public API.
- You can see properties available in the current API https://arxiv.org/help/api/basics
- For example, if you need `published` , you can add some code to obtain the target property.
- https://github.com/denkiwakame/arxiv2notion/blob/main/src/js/popup.js#L112-L124
- `const published = entry.querySelector("published").textContent;`
- The retrieved contents will be posted by this line https://github.com/denkiwakame/arxiv2notion/blob/main/src/js/popup.js#L49
- Thus you need to add properties to https://github.com/denkiwakame/arxiv2notion/blob/main/src/js/popup.js#L127

#### Post to notion.so
- Add property to https://github.com/denkiwakame/arxiv2notion/blob/main/src/js/notion.js#L62-L118
- You may need to follow the Notion API date format. https://developers.notion.com/reference/page#date-property-values

### Suggesting Enhancements

This section guides you through submitting an enhancement suggestion for arxiv2notion, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions.

<!-- omit in toc -->
#### Before Submitting an Enhancement

- Make sure that you are using the latest version.
- Read the [documentation]() carefully and find out if the functionality is already covered, maybe by an individual configuration.
- Perform a [search](https://github.com/denkiwakame/arxiv2notion/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library.

<!-- omit in toc -->
#### How Do I Submit a Good Enhancement Suggestion?

Enhancement suggestions are tracked as [GitHub issues](https://github.com/denkiwakame/arxiv2notion/issues).

- Use a **clear and descriptive title** for the issue to identify the suggestion.
- Provide a **step-by-step description of the suggested enhancement** in as many details as possible.
- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you.
- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux.
- **Explain why this enhancement would be useful** to most arxiv2notion users. You may also want to point out the other projects that solved it better and which could serve as inspiration.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 denkiwakame
Copyright (c) 2022 denkiwakame

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
86 changes: 54 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,10 @@
# arxiv2notion
[![build](https://github.com/denkiwakame/arxiv2notion/actions/workflows/build.yaml/badge.svg)](https://github.com/denkiwakame/arxiv2notion/actions/workflows/build.yaml)
[![build](https://github.com/denkiwakame/arxiv2notion/actions/workflows/build.yaml/badge.svg)](https://github.com/denkiwakame/arxiv2notion/actions/workflows/build.yaml) [![lint](https://github.com/denkiwakame/arxiv2notion/actions/workflows/lint.yaml/badge.svg)](https://github.com/denkiwakame/arxiv2notion/actions/workflows/lint.yaml)

Easy-to-use arXiv clipper for [Notion](https://www.notion.so) based on [Notion API](https://developers.notion.com/)

![demo](doc/arxiv2notion.gif)

## ✨ Getting Started
- login to [notion.so](https://www.notion.so) by admin user
- create databases where you save arXiv articles
- **follow this instruction** https://www.notion.so/guides/creating-a-database , do **NOT** create a new database by `/database` !
- **add properties listed below.** `Title` `URL` `Publisher` `Authors` `Abstract`
- note that you should create *extactly the same properties with listed names.*

|property|type|
|-----|-----|
|Title|Title|
|URL|URL|
|Publisher|Select|
|Authors|Text|
|Abstract|Text|

- follow the instruction of [Notion API](https://developers.notion.com/docs/getting-started)
- navigate to [My Integrations](https://www.notion.so/my-integrations)
- `+ New integration`
- associated workspace: select your workspace where you save arXiv articles
- add connection to target databases via `...` > `Add connections` > `arxiv2notion`

![ref1](doc/notion.png)
![notion](doc/nerf_example2.png)

## ⬇️ Installation
- download extension package from https://github.com/denkiwakame/arxiv2notion/releases
Expand All @@ -35,6 +13,16 @@ Easy-to-use arXiv clipper for [Notion](https://www.notion.so) based on [Notion A
- or unzip the extension and `load unpacked` in developer mode

## ⚙️ Setup

### :one: Add arxiv2notion integration
- follow the instruction of [Notion API](https://developers.notion.com/docs/getting-started)
- navigate to [My Integrations](https://www.notion.so/my-integrations)
- `+ New integration`
- **associated workspace:** select your workspace where you save arXiv articles

<img src="doc/my_integration.png" height="200">

### :two: Configure the extension
- right-click on the extension icon > `Options`
- copy **integration id (not the secret token!)** (see figures below) from `https://hwww.notion.so/my-integrations/internal/${integration-id}`
- paste the `integration id` and click on `+` button.
Expand All @@ -46,20 +34,48 @@ arxiv2notion requests API token on-demand via integration ID when you are logged
Note that you must be logged in to notion.so when you use this extension.
```

<img src="doc/integrataion.png" width="450">
<img src="doc/option.png" width="450">
<img src="doc/integration_id.png" height="300"><img src="doc/option.png" height="300">

### :three: Create databases in Notion
#### from template (recommended)
- clone the public template [here](https://denkiwakame.notion.site/597cdd58bded4375b1cbe073b2ed6f5d?v=63fcbfda57824b239b66e52dde841cdf) to your own notion workspace
- add connection to target databases via `...` > `+ Add connections` > `arxiv2notion`

![invite_integration](doc/connection.png)

- you can switch multiple DBs by adding the connection to these pages, respectively.

![multiple_db](doc/multiple_db.png)


#### or manually
- alternatively, you can follow the following steps to create database from scratch in notion
- login to [notion.so](https://www.notion.so) by admin user
- create databases where you save arXiv articles
- **follow this instruction** https://www.notion.so/guides/creating-a-database , do **NOT** create a new database by `/database` !
- **add properties listed below.**
- note that you should create **extactly the same properties with listed names.**

|property|type|
|-----|-----|
|Title|Title|
|URL|URL|
|Authors|Multi-Select|
|Abstract|Text|
|Published|Date|
|Comments|URL|
|Publisher|Select|

### 💡 Working with Notion AI Property
### :bulb: Working with Notion AI Property (optional)
- [Notion AI Property](https://www.notion.so/ja-jp/help/guides/5-ai-prompts-to-surface-fresh-insights-from-your-databases) allows you to add **custom autofill property** to each DB record.
- Add column to your Notion DB and select `AI custom autofill`
![image](https://github.com/denkiwakame/arxiv2notion/assets/1871262/b1a6149a-cf55-41f8-9e83-4578a64530e6)
- Set any prompt you like (e.g. summarization, extracting key ideas ...)
<img src="https://github.com/denkiwakame/arxiv2notion/assets/1871262/8b30bd04-ffc3-4525-b684-90f8b62dda92" width="300">
- Set any prompt you like (e.g. summarization, extracting key ideas ...)
<img src="https://github.com/denkiwakame/arxiv2notion/assets/1871262/b1a6149a-cf55-41f8-9e83-4578a64530e6" height="200"><img src="https://github.com/denkiwakame/arxiv2notion/assets/1871262/8b30bd04-ffc3-4525-b684-90f8b62dda92" height="200">
- Save an article via `arxiv2notion` ,and then the preset `AI property` will be automatically generated.
![image](https://github.com/denkiwakame/arxiv2notion/assets/1871262/ad698cf0-dce0-4b29-8511-47f4c796a694)


## 👨‍💻 Build locally (for Developers)
## :technologist: Build locally (for Developers)
- See also [CONTRIBUTING.md](CONTRIBUTING.md)

```bash
$ git clone https://github.com/denkiwakame/arxiv2notion.git
Expand All @@ -68,3 +84,9 @@ $ npm run build
$ npm run watch # debug locally
$ npm run pack # packaging to zip
```

## Contributors
- Maintainers: @denkiwakame, @wangjksjtu
<a href="https://github.com/denkiwakame/arxiv2notion/graphs/contributors">
<img src="https://contrib.rocks/image?repo=denkiwakame/arxiv2notion" />
</a>
Binary file modified doc/arxiv2notion.gif
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/arxiv2notionplus_db.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/connection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed doc/integrataion.png
Binary file not shown.
Binary file added doc/integration_id.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/multiple_db.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/my_integration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/nerf_example1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/nerf_example2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed doc/notion.png
Binary file not shown.
Binary file modified doc/option.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "arxiv2notion",
"description": "easy-to-use arXiv clipper for notion.so",
"version": "0.0.2",
"version": "0.1.0",
"icons": {
"128": "icon128.png"
},
Expand Down
Loading

0 comments on commit 6259710

Please sign in to comment.