Skip to content

aubirdgine/clip2tana-jb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clip2tana-jb

Forked from Brett Adams' awesome initial version so I could add a few customizations 😁

Clips current webpage and selection to tana-paste format

How It Works

The utility grabs the following information for the current tab:

  • Page Title
  • URL
  • Meta tags
    • og:description
    • og:title
    • og:url
    • og:type
    • og:image
    • og:site_name
  • <any selected text>

The utility then checks the URL (<href.origin>) to see if the current tab is the root of the site or not. This allows multiple 'web pages' to be tied to a single root 'website' using a Part Of relationship in Tana.

It also determines the 'type' of page by checking the og:type tag and parsing the URL for a filename or extension, then sets one of the following supertags for the node:

  • #article
  • #book
  • #video
  • #document (anything with an extension, other than .html)
  • #web-page (default)
  • #website (only for the origin site)

Then the information is formatted as a Tana Paste entry and copied to the clipboard.

Formatting

The basic Tana Paste data copied to the clipboard is the following:

%%tana%%
- Origin site title #website
  - Title:: <og:site_name or 'Website at href.origin.hostname'>
  - URL:: <href.origin>
  - Hostname:: <href.origin.hostname>


- Title of current tab #<supertag>
  - Title:: <of current tab>
  - URL:: <of current tab>
  - Description:: <from site metadata>
  - Part Of Website:: [[<Tana reference to origin node above>]]
  - Highlights
    - <any selected text>
    - <line breaks are preserved for multiple lines>

For posterity's sake, if the original meta tag differs from the cleaned up version, both will be included on their own lines. (i.e. - Description:: <cleaned up description> and - og:Description:: <original unchanged meta tag> may both be included fields so you can compare them.)

Installing without building

If you just want to use this extension without bothering with the source code and all that jazz, you can download the latest release.zip file from the Releases area (right hand side of the github project page). Then, go to the Chrome extension manager (chrome://extensions) and turn on Developer mode. This will give you access to the Load unpacked button and you can pick the downloaded zip file.

Building from source

To bootstrap this git repo into Chrome locally, first clone the repo. Then run npm install and npm run build. Go to Chrome extension manager, turn on Developer mode and load unpacked the dist directory.

The format used on the clipboard is very simple:

%%tana%%
- Title of site #website
  - Description:: <from site metadata>
  - Url:: <of open tab>
  - <any selected text>

Note that selections in Google Docs and Office365 docs do NOT work. (See issues)

Development

This extension was created with Extension CLI!

If you find this software helpful star or sponsor this project.

Available Commands

Commands Description
npm run start build extension, watch file changes
npm run build generate release version
npm run docs generate source code docs
npm run clean remove temporary files
npm run test run unit tests
npm run sync update config files

For CLI instructions see User Guide →

Learn More

Extension Developer guides

Extension Publishing Guides

JB Notes To Self:

  • Build using npm run build for Chrome
  • Go to Chrome extension manager and load unpacked the dist directory to update extension
  • Run xcrun safari-web-extension-converter <path to extension> in terminal to convert for Safari (or manually copy changes to previously converted XCode project)
  • Build XCode project

About

A Tana web clipper extension

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%