github.com/vipernet-xyz/tm@v0.34.24/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/vipernet-xyz/tm/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 usage $ python3 linkify_changelog.py ../CHANGELOG_PENDING.md
    11  for line in fileinput.input(inplace=1):
    12      line = re.sub(r"\s\\#([0-9]*)", r" [\\#\1](https://github.com/vipernet-xyz/tm/issues/\1)", line.rstrip())
    13      print(line)