You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
635 B

  1. import fileinput
  2. import re
  3. # This script goes through the provided file, and replaces any " \#<number>",
  4. # with the valid mark down formatted link to it. e.g.
  5. # " [\#number](https://github.com/tendermint/tendermint/pull/<number>)
  6. # Note that if the number is for a an issue, github will auto-redirect you when you click the link.
  7. # It is safe to run the script multiple times in succession.
  8. #
  9. # Example usage $ python3 linkify_changelog.py ../CHANGELOG_PENDING.md
  10. for line in fileinput.input(inplace=1):
  11. line = re.sub(r"\s\\#([0-9]*)", r" [\\#\1](https://github.com/tendermint/tendermint/pull/\1)", line.rstrip())
  12. print(line)