Last active
November 1, 2020 20:23
-
-
Save srid/fb202ad906b32cf00803f4332d4c3d59 to your computer and use it in GitHub Desktop.
neuron-migrate-wikilinks.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env nix-shell | |
#! nix-shell -p sd | |
#! nix-shell -i bash | |
# Migration script for https://github.com/srid/neuron/pull/450 | |
# Limitations | |
# - Only works if ?cf (or &cf) is at the end (usually the case) | |
# - Will replace even in code blocks (!). | |
# - Will also replace in raw HTML tags (if you use them). | |
# **WARNING**: | |
# Backup, or use Git to sanity check what this script modifies. | |
sd "<(z:[^>\s]+)(\&|\?)cf>" "[[\$1]]" *.md | |
sd "<(z:[^>\s]+)>" "[[[\$1]]]" *.md | |
sd "<([^:$>\s]+)(\&|\?)cf>" "[[\$1]]" *.md | |
sd "<([^:$>\s]+)>" "[[[\$1]]]" *.md |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment