github.com/Finschia/finschia-sdk@v0.48.1/scripts/linkify_changelog.py (about) 1 import fileinput 2 import re 3 4 # This script goes through the provided file, and replaces any " \#<number>", 5 # with the valid mark down formatted link to it. e.g. 6 # " [\#number](https://github.com/cosmos/cosmos-sdk/issues/<number>) 7 # Note that if the number is for a PR, github will auto-redirect you when you click the link. 8 # It is safe to run the script multiple times in succession. 9 # 10 # Example: 11 # 12 # $ python ./scripts/linkify_changelog.py CHANGELOG.md 13 for line in fileinput.input(inplace=1): 14 line = re.sub(r"\s\\#([0-9]+)", r" [\\#\1](https://github.com/cosmos/cosmos-sdk/issues/\1)", line.rstrip()) 15 print(line)