markdown-fix-freeplane/markdown-fix-freeplane.py
François Pelletier 75f7a2d742 Initial commit
2024-01-08 10:18:32 -05:00

19 lines
359 B
Python

#!/usr/bin/env python
import re
import sys
# %%
def replace_title_with_list(text):
text = re.sub(r'#(#+)\s*(.*)', r'\1- \2', text)
text = re.sub(r'#', ' ', text)
return text
def __main__():
# read file passed as argument
with open(sys.argv[1], 'r') as my_file:
text = my_file.read()
print(replace_title_with_list(text))