Skip to content

An Obsidian.md plugin to save tweets as Markdown files.

License

Notifications You must be signed in to change notification settings

kbravh/obsidian-tweet-to-markdown

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c114940 · Nov 14, 2021

History

53 Commits
Nov 3, 2021
Nov 4, 2021
Nov 14, 2021
Oct 19, 2021
Oct 19, 2021
Jul 21, 2021
Oct 19, 2021
Nov 7, 2021
Nov 7, 2021
Nov 10, 2021
Nov 7, 2021
Nov 14, 2021
Nov 14, 2021
Nov 14, 2021
Jul 21, 2021
Nov 10, 2021
Nov 14, 2021
Nov 14, 2021

Repository files navigation


Logo

Tweet to Markdown

An Obsidian plugin to quickly save tweets as Markdown.

Report a Bug · Request a Feature

About The Project

This plugin allows you to quickly save a tweet in Markdown format. It is built on the new Twitter v2 API.

Installing

Find this plugin in the listing of community plugins in Obsidian and add it to your application.

Or, if you'd like to install it manually, clone this repository to the .obsidian/plugins/ directory in your vault, navigate to your newly cloned folder, run npm i or yarn to install dependencies, and run npm run build or yarn build to compile the plugin.

Usage

Bearer token

To use this tool, you'll need to set up an application and get a bearer token on the Twitter developer dashboard. For a guide on doing so, see Getting a bearer token. Once you have the bearer token, you can paste it into the bearer token field on the Tweet to Markdown settings page. If you'd rather protect the token a bit more, you can store it in the environment variable TWITTER_BEARER_TOKEN.

Nota bene: On Unix machines, make sure to set this in your profile file (such as ~/.bash_profile) so that it will be available to Obsidian.

Downloading a tweet

Either click the Twitter logo in your sidebar or run the command Download Tweet from URL from the command palette. Then, just paste in the link to a tweet and click download.

To download a tweet thread, paste the link to the LAST tweet in the thread, and toggle the Thread switch.

The modal to download a new tweet.

Once the tweet is downloaded, you'll be presented a window to set the name of the file that will be created. You can use the variables [[handle]], [[name]], [[text]], and [[id]] when naming your file, which will be automatically replaced according to the following chart. The file extension .md will be added automatically.

Variable Replacement
[[handle]] The user's handle (the part that follows the @ symbol)
[[name]] The user's name
[[id]] The unique ID assigned to the tweet
[[text]] The entire text of the tweet

The modal to name a downloaded tweet.

The tweet will be saved to a Markdown file in the root of your vault, or in the directory specified in your settings. Here's how the tweet will look:

The rendered Markdown file

Any attached images, polls, and links will also be linked and displayed in the file.

Options

On the Tweet to Markdown settings page in Obsidian, you can customize the way the plugin works to better match your vault structure and workflow.

Custom File Name

Tweets are, by default, saved with the filename [[handle]] - [[id]].md. You can instead enter your own format in the Filename field using the variables [[name]], [[handle]], [[text]], and [[id]] in your filename, which will be automatically replaced according to the following chart. The file extension .md will be added automatically.

Variable Replacement
[[handle]] The user's handle (the part that follows the @ symbol)
[[name]] The user's name
[[id]] The unique ID assigned to the tweet
[[text]] The entire text of the tweet

Custom File Path

To save the tweet to a place other than the root of your vault, type a new path in the Note Location field. If this path doesn't exist, it will be recursively created.

Save Images Locally

Want to really capture the entire tweet locally? You can flip the Download images switch to download all the tweet images as well, instead of just linking to the images on the web. If the tweet is ever deleted or Twitter is unavailable, you'll still have your note.

Tweet images will be automatically saved to the directory tweet-assets/. If you'd like to save the assets to a custom directory, type that directory in the Image location field.

Nota bene: Unfortunately, there is currently not a way to retrieve gifs or videos from tweets using the v2 API.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

License

This project is licensed under the MIT License - see the LICENSE file for details

Contact

Karey Higuera - @kbravh - karey.higuera@gmail.com

Project Link: https://github.com/kbravh/obsidian-tweet-to-markdown