Skip to content

Instantly share code, notes, and snippets.

@maximeaubaret
Created February 10, 2017 17:11
Show Gist options
  • Select an option

  • Save maximeaubaret/0e1a506faa9f3bd1a099c832e83e69de to your computer and use it in GitHub Desktop.

Select an option

Save maximeaubaret/0e1a506faa9f3bd1a099c832e83e69de to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Trello card title
// @version 0.4.0
// @description Add support for bold and emphasized Markdown in card titles
// @match https://trello.com/b/*
// @match http://trello.com/b/*
// ==/UserScript==
function markdownAll() {
var cards = document.getElementsByClassName('list-card-title');
for (var i = 0; i < cards.length; i++) {
cards[i].innerHTML = cards[i].innerHTML
.replace(/^(.*) ?:/, '<span style="display: block; color: black; font-weight: 500;">$1</span>') // Subject
.replace(/- ([0-9\/]*J)$/, '<span style="font-size: 12px; font-weight: 400; color: #8C8888;">- $1</span>') // Time estimate
.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
.replace(/\*(.+?)\*/g, '<em>$1</em>')
.replace(/~~(.+?)~~/g, '<strike>$1</strike>')
.replace(/\`(.+?)\`/g, '<code>$1</code>');
}
}
// Delay execution
setTimeout(markdownAll, 500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment