Skip to content

Commit

Permalink
Fixed heading tag error
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Yuen authored and Peter Yuen committed Mar 26, 2022
1 parent 5592deb commit e4c4472
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,12 @@ def filter_lines(file: Path, content: List[str]) -> List[str]:
# Markdown links: [xxx](yyy)
# (\[.+?\]): Capture [xxx] part
# \((?!http)(.+?)(?:.md)?\): Capture (yyy) part, ensuring that link is not http and remove .md from markdown files
# (#.+)?: Capture any heading tags after ".md"
replaced_links = [
re.sub(
r"(\[.+?\])\((?!http)(.+?)(?:.md)?\)", r"\1(" + parent_dir + r"/\2)", line
r"(\[.+?\])\((?!http)(.+?)(?:.md)?(#.+)?\)",
r"\1(" + parent_dir + r"/\2\3)",
line,
)
for line in content
]
Expand Down

0 comments on commit e4c4472

Please sign in to comment.