Skip to content

Instantly share code, notes, and snippets.

@bachya
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save bachya/9b48ce3151ebf06e7955 to your computer and use it in GitHub Desktop.

Select an option

Save bachya/9b48ce3151ebf06e7955 to your computer and use it in GitHub Desktop.
aText snippet that takes a gist ID or URL from the clipboard and creates a Wordpress shortcode/link pair
GIST_ID=$(echo "【clipboard】" | sed -Ee 's/https?:\/\/gist\.github\.com\/[^\/]+\///')
echo "[gist ${GIST_ID} /]" \
"<div class=\"no_js\">" \
"<a name=\"${GIST_ID}\"></a>" \
"<a href=\"#${GIST_ID}\">Click here to see the Gist.</a>" \
"</div>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment