Skip to content

Instantly share code, notes, and snippets.

@knubie
Created February 18, 2014 02:11
Show Gist options
  • Save knubie/9063331 to your computer and use it in GitHub Desktop.
Save knubie/9063331 to your computer and use it in GitHub Desktop.
ptext = ptext.replace(/`([^`]*)`/g, "<code>$1</code>")
.replace(/\*\*([^\*]*)\*\*/g, "<strong>$1</strong>")
.replace(/\*([^\*]*)\*/g, "<em>$1</em>")
.replace(/_([^_]*)_/g, '<span class="underline">$1</span>')
.replace(/#(\d*[a-zA-Z_]+)/g, '<a href="/channels/$1">#$1</a>')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment