Read more

Bookmarklet: cards Markup Link Bookmarklet

Daniel Straßner
December 05, 2022Software engineer at makandra GmbH

The cards editor has a feature "Cite other card" to create links to other cards in the same deck as mardown links.
If you want to reference a card from a different deck, this bookmarklet might be useful:

javascript:(function () {
  const doAlert = () => { alert("Maybe not a makandra card?") };
  let cardsPathPattern = /(\/[\w-]+\/\d+)-.+/;
  if (window.location.pathname.match(cardsPathPattern)) {
    let currentPath = window.location.pathname.match(cardsPathPattern)[1];
    let title = document.querySelector('h1.note--title')?.textContent;
    if (title) {
      prompt("Your markdown link:", `[${title}](${currentPath})`);
    } else {
      doAlert();
    }
  } else {
    doAlert();
  }
})();
Illustration book lover

Growing Rails Applications in Practice

Check out our e-book. Learn to structure large Ruby on Rails codebases with the tools you already know and love.

  • Introduce design conventions for controllers and user-facing models
  • Create a system for growth
  • Build applications to last
Read more Show archive.org snapshot

In Firefox you can save this as a bookmarklet:

  1. right-click the die Bookmarks-Toolbar
  2. Add bookmark...
  3. Fill in Name: Card Markup Link Bookmarklet
  4. Fill URL with the Codeblock above
  5. save

When you're on a card and press the bookmark, an alert will give you the link to it in markdown format.

Posted by Daniel Straßner to makandra dev (2022-12-05 09:51)