DEV Community

Hiroyuki Kuromiya
Hiroyuki Kuromiya

Posted on

Extract metadata of paper and export it to Notion DB

I recently developed a chrome extension named "Paper to Notion."

Paper to Notion - Chrome Web Store

A Chrome extension that imports paper metadata from Crossref to Notion using a DOI.

favicon chromewebstore.google.com

Once you input the DOI of the paper, it automatically export it to your Notion DB.

https://youtu.be/Pg0eNnxyVTI?si=WsfSqV-gT2FhWHFg

Structure is very simple: it calls Crossref API to retrieve metadata and uses Notion API to conntect the database.

I used the chrome extension development framework, WXT, which made the development much more easier.

With tagpr, it generates the release zip file automatically, once I pushed any changes to the main branch.

My GitHub Actions workflow file is here:

name: Release

on:
  push:
    tags:
      - 'v*'

jobs:
  build-and-release:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '22'

      - name: Install dependencies
        run: npm install

      - name: Build and zip
        run: npm run zip

      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          draft: false
          prerelease: false

      - name: Strip 'v' prefix from version
        id: strip_v
        run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

      - name: Upload Release Asset
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: .output/paper2notion-${{ env.version }}-chrome.zip
          asset_name: paper2notion-${{ env.version }}-chrome.zip
          asset_content_type: application/zip
Enter fullscreen mode Exit fullscreen mode

Feel free to post any issues and pull requests. I published the extension as OSS!

https://github.com/kromiii/paper-to-notion

Top comments (1)

Collapse
 
mark_leo profile image
Mark Leo

Hi,
I want to use Slate.js to display/edit the Notion Page content(notion blocks),
but the notion-api returns many kinds block content so, such as existing editor(like slate.js) can not editor all the contents of notion block?
Could you tell me how do they connect?

11 Tips That Make You a Better Typescript Programmer

typescript

1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields

...

Read the whole post now!