a2b


Namea2b JSON
Version 1.0.7 PyPI version JSON
download
home_pagehttps://github.com/kevinkevin556/a2b
SummaryReplace arxiv links in markdowns by their corresponding bibliography.
upload_time2023-07-17 07:10:39
maintainer
docs_urlNone
authorZhen-Lun Hong
requires_python
licenseMIT
keywords arxiv bibliography markdown notion
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # A2B (Arxiv to Bibliography)

![pypi](https://img.shields.io/pypi/v/a2b?color=green)  ![license](https://img.shields.io/pypi/l/a2b?color=orange)

> Replace arXiv links (or doi links) by their corresponding bibliography in markdowns / Notion databases. Inspired by [Mu Li](https://www.youtube.com/watch?v=q1G0xZCqYxY&ab_channel=MuLi).


This repo provides a tool to replace arXiv/DOI links saved in

* [Markdown files](#markdown) or
* [Notion database](#notion-database)

with their corresponding bibliographic information, which intends to create a more convenient experience for users in needs of searching, collecting, and taking notes of literatures. The script uses the Semantic Scholar API to retrieve information such as authors, title, journal, year, and citation count for a given arXiv paper.

| [Markdown](#markdown)| [Notion Database](#notion-database) |
|:---:|:---:|
![demo](https://github.com/kevinkevin556/arxiv2bib/raw/main/demo.gif) |![demo](https://github.com/kevinkevin556/arxiv2bib/raw/main/notion-demo.gif)|


## Installation

To install `a2b`, make sure you have [pip installed](https://pip.pypa.io/en/stable/installation/) and run:

```Bash
>> pip install a2b
```

## Usage

The tool can be run from the command line, e.g. to check the installed version of `a2b`,

```Bash
>> a2b --version
```

![markdown-logo](https://img.icons8.com/ios/2x/markdown.png)

### Markdown

#### 1. Generate markdown from a single arXiv link or DOI

For example:

```Bash
>> a2b --arxiv https://arXiv.org/abs/1912.08957

## __Optimization for deep learning: theory and algorithms.__ *Ruoyu Sun.* __ArXiv, 2019__ [(Arxiv)](ht
## tps://arXiv.org/abs/1912.08957) [(S2)](https://www.semanticscholar.org/paper/c23173e93f1db79a422e2af
## 881a40afb96b8cb92) (Citations __114__)
```

Here you can use the link of pdf `https://arXiv.org/pdf/1912.08957.pdf`, instead of the link of arXiv page.

```Bash
>> a2b --doi https://doi.org/10.1007/BF00133570

## __Snakes: Active contour models.__ *M. Kass et al.* __International Journal of Computer Vision, 2004__ 
## [(Link)](https://doi.org/10.1007/BF00133570) [(S2)](https://www.semanticscholar.org/paper/9394a5d5adcb6
## 26128b6a42c8810b9505a3c6487) (Citations __15860__)
```

One can simply provide the DOI `10.1007/BF00133570` without adding the hyperlink prefix to generate bibilography from DOI.

#### 2. Replace arXiv links in a single markdown file

```Bash
>> a2b path/to/markdown.md
```

#### 3. Replace arXiv links in all markdown files within a directory

Run the following command to replace all arXiv links found in the given directory and its subdirectories.

```Bash
>> a2b path/to/directory
```

To replace arXiv links in the markdown files **ONLY** within the directory (subdirectories excluded), use arguments `--no-recursive` or `-nr`:

```Bash
>> a2b -nr path/to/directory
```

---

![notion-logo](https://img.icons8.com/color/2x/notion--v1.png)

### Notion Database

To generate bibliography from links saved in a Notion database, follow the instructions below

1. Create a new [Notion integration](https://www.notion.so/my-integrations) and keep the Notion API key obtained from the integration
2. Go to the Notion database and 
    * [Connect the Notion database to the integration](https://developers.notion.com/docs/create-a-notion-integration#step-2-share-a-database-with-your-integration) you just created
    * Create these columns (with data type matched) in the Notion database
      * Title (title)
      * Author (rich_text)
      * Year (number)
      * Journal (rich_text)
      * Arxiv (url)
      * Link (url)
      * S2 (url)
      * Citations (number)
3. Paste Arxiv links or doi links in the column `Title` and run the following command to activate the conversion

```Bash
>> a2b --notion notion_database_id --key notion_api_key
# or
>> a2b --notion notion_database_url --key notion api_key
```

You can choose to save your Notion API key as a environment variable `NOTION_API_KEY`, and then you can simply run without manually providing the key in command:

```Bash
>> a2b --notion notion_database_id
# or
>> a2b --notion notion_database_url
```

## Changelog

* **Version 1.0.7**
  * Fix the problem of arxiv and doi format confliction in Notion
* **Version 1.0.6**
  * Fix version command
* **Version 1.0.5**
  * Support Notion database
* **Version 1.0.4**
  * Support creating bibliography from DOI links
  * Support querying a single arXiv link from terminal


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kevinkevin556/a2b",
    "name": "a2b",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "arxiv,bibliography,markdown,Notion",
    "author": "Zhen-Lun Hong",
    "author_email": "kevink556@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b2/d3/2f37c2d13e9896f92cc0a0c851cb98f2b0fb73d726219a2d8a961fef7b57/a2b-1.0.7.tar.gz",
    "platform": null,
    "description": "# A2B (Arxiv to Bibliography)\n\n![pypi](https://img.shields.io/pypi/v/a2b?color=green)  ![license](https://img.shields.io/pypi/l/a2b?color=orange)\n\n> Replace arXiv links (or doi links) by their corresponding bibliography in markdowns / Notion databases. Inspired by [Mu Li](https://www.youtube.com/watch?v=q1G0xZCqYxY&ab_channel=MuLi).\n\n\nThis repo provides a tool to replace arXiv/DOI links saved in\n\n* [Markdown files](#markdown) or\n* [Notion database](#notion-database)\n\nwith their corresponding bibliographic information, which intends to create a more convenient experience for users in needs of searching, collecting, and taking notes of literatures. The script uses the Semantic Scholar API to retrieve information such as authors, title, journal, year, and citation count for a given arXiv paper.\n\n| [Markdown](#markdown)| [Notion Database](#notion-database) |\n|:---:|:---:|\n![demo](https://github.com/kevinkevin556/arxiv2bib/raw/main/demo.gif) |![demo](https://github.com/kevinkevin556/arxiv2bib/raw/main/notion-demo.gif)|\n\n\n## Installation\n\nTo install `a2b`, make sure you have [pip installed](https://pip.pypa.io/en/stable/installation/) and run:\n\n```Bash\n>> pip install a2b\n```\n\n## Usage\n\nThe tool can be run from the command line, e.g. to check the installed version of `a2b`,\n\n```Bash\n>> a2b --version\n```\n\n![markdown-logo](https://img.icons8.com/ios/2x/markdown.png)\n\n### Markdown\n\n#### 1. Generate markdown from a single arXiv link or DOI\n\nFor example:\n\n```Bash\n>> a2b --arxiv https://arXiv.org/abs/1912.08957\n\n## __Optimization for deep learning: theory and algorithms.__ *Ruoyu Sun.* __ArXiv, 2019__ [(Arxiv)](ht\n## tps://arXiv.org/abs/1912.08957) [(S2)](https://www.semanticscholar.org/paper/c23173e93f1db79a422e2af\n## 881a40afb96b8cb92) (Citations __114__)\n```\n\nHere you can use the link of pdf `https://arXiv.org/pdf/1912.08957.pdf`, instead of the link of arXiv page.\n\n```Bash\n>> a2b --doi https://doi.org/10.1007/BF00133570\n\n## __Snakes: Active contour models.__ *M. Kass et al.* __International Journal of Computer Vision, 2004__ \n## [(Link)](https://doi.org/10.1007/BF00133570) [(S2)](https://www.semanticscholar.org/paper/9394a5d5adcb6\n## 26128b6a42c8810b9505a3c6487) (Citations __15860__)\n```\n\nOne can simply provide the DOI `10.1007/BF00133570` without adding the hyperlink prefix to generate bibilography from DOI.\n\n#### 2. Replace arXiv links in a single markdown file\n\n```Bash\n>> a2b path/to/markdown.md\n```\n\n#### 3. Replace arXiv links in all markdown files within a directory\n\nRun the following command to replace all arXiv links found in the given directory and its subdirectories.\n\n```Bash\n>> a2b path/to/directory\n```\n\nTo replace arXiv links in the markdown files **ONLY** within the directory (subdirectories excluded), use arguments `--no-recursive` or `-nr`:\n\n```Bash\n>> a2b -nr path/to/directory\n```\n\n---\n\n![notion-logo](https://img.icons8.com/color/2x/notion--v1.png)\n\n### Notion Database\n\nTo generate bibliography from links saved in a Notion database, follow the instructions below\n\n1. Create a new [Notion integration](https://www.notion.so/my-integrations) and keep the Notion API key obtained from the integration\n2. Go to the Notion database and \n    * [Connect the Notion database to the integration](https://developers.notion.com/docs/create-a-notion-integration#step-2-share-a-database-with-your-integration) you just created\n    * Create these columns (with data type matched) in the Notion database\n      * Title (title)\n      * Author (rich_text)\n      * Year (number)\n      * Journal (rich_text)\n      * Arxiv (url)\n      * Link (url)\n      * S2 (url)\n      * Citations (number)\n3. Paste Arxiv links or doi links in the column `Title` and run the following command to activate the conversion\n\n```Bash\n>> a2b --notion notion_database_id --key notion_api_key\n# or\n>> a2b --notion notion_database_url --key notion api_key\n```\n\nYou can choose to save your Notion API key as a environment variable `NOTION_API_KEY`, and then you can simply run without manually providing the key in command:\n\n```Bash\n>> a2b --notion notion_database_id\n# or\n>> a2b --notion notion_database_url\n```\n\n## Changelog\n\n* **Version 1.0.7**\n  * Fix the problem of arxiv and doi format confliction in Notion\n* **Version 1.0.6**\n  * Fix version command\n* **Version 1.0.5**\n  * Support Notion database\n* **Version 1.0.4**\n  * Support creating bibliography from DOI links\n  * Support querying a single arXiv link from terminal\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Replace arxiv links in markdowns by their corresponding bibliography.",
    "version": "1.0.7",
    "project_urls": {
        "Homepage": "https://github.com/kevinkevin556/a2b"
    },
    "split_keywords": [
        "arxiv",
        "bibliography",
        "markdown",
        "notion"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a0035d21a6b197966300ff8efbf933a9aba0e7ac228b3ce4d89013e2eb7b4131",
                "md5": "0466d9f1ba6e0e0b6b0590ac80fe4393",
                "sha256": "9a5e46a26d0c48f66b930fce045a465b260ba5d87a2a2431a51c1742d83841b6"
            },
            "downloads": -1,
            "filename": "a2b-1.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0466d9f1ba6e0e0b6b0590ac80fe4393",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9250,
            "upload_time": "2023-07-17T07:10:36",
            "upload_time_iso_8601": "2023-07-17T07:10:36.780126Z",
            "url": "https://files.pythonhosted.org/packages/a0/03/5d21a6b197966300ff8efbf933a9aba0e7ac228b3ce4d89013e2eb7b4131/a2b-1.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b2d32f37c2d13e9896f92cc0a0c851cb98f2b0fb73d726219a2d8a961fef7b57",
                "md5": "bf4a0c0370d481a8148310aac419a991",
                "sha256": "4d6bf97239b353148eb8634e68c56a0fd9b024f0009705d9ff8da68f373c9e4d"
            },
            "downloads": -1,
            "filename": "a2b-1.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "bf4a0c0370d481a8148310aac419a991",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9274,
            "upload_time": "2023-07-17T07:10:39",
            "upload_time_iso_8601": "2023-07-17T07:10:39.365294Z",
            "url": "https://files.pythonhosted.org/packages/b2/d3/2f37c2d13e9896f92cc0a0c851cb98f2b0fb73d726219a2d8a961fef7b57/a2b-1.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-17 07:10:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kevinkevin556",
    "github_project": "a2b",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "a2b"
}
        
Elapsed time: 0.09198s