Skip to content

Instantly share code, notes, and snippets.

@hyuki
Last active June 27, 2021 11:34
Show Gist options
  • Save hyuki/e2464682e7c0aed237823bfdcf9d96fd to your computer and use it in GitHub Desktop.
Save hyuki/e2464682e7c0aed237823bfdcf9d96fd to your computer and use it in GitHub Desktop.
BookMarkDown.js - ブラウザで見ているページのタイトルとURLを、-[タイトル](URL)というMarkdown形式にするBookmarklet

BookMarkDown.js

What is this?

A bookmarklet that pops up the current title of the page and url as a markdown text.

  • LinkMD.js - - [Title of the page](URL of the page)
  • LinkTXT.js - Title of the page\nURL of the page

Web page to create bookmarklet

/*
* BookMarkDown.js
* ブラウザで見ているページのタイトルとURLを、
* - [タイトル](URL) という形式と、
* タイトル+改行+URL+改行 という形式と、
* [タイトル URL] という形式にする
* Bookmarklet
*/
function start() {
let url = location.href;
let title = document.title;
prompt('BookMarkDown.js for Markdown', '- [' + title + '](' + url + ')');
prompt('BookMarkDown.js for Plaintext', title + "\n" + url + "\n");
prompt('BookMarkDown.js for Scrapbox', '[' + title + ' ' + url + ']');
}
start();
/*
* LinkMD.js
* ブラウザで見ているページのタイトルとURLを、
* - [タイトル](URL) という形式にする
* Bookmarklet
*/
function start() {
let url = location.href;
let title = document.title;
prompt('LinkMD.js', '- [' + title + '](' + url + ')');
}
start();
/*
* LinkTXT.js
* ブラウザで見ているページのタイトルとURLを、
* タイトル+改行+URL+改行 という形式にする
* Bookmarklet
*/
function start() {
let url = location.href;
let title = document.title;
prompt('LinkTXT.js', title + "\n" + url + "\n");
}
start();
@hyuki
Copy link
Author

hyuki commented Mar 30, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment