Skip to content

Commit

Permalink
fix: release note using escape \ (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
Snoopy1866 authored Dec 24, 2024
1 parent 86a2573 commit 98c29bb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
33 changes: 18 additions & 15 deletions scripts/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,30 @@ def main() -> None:
added_rules, removed_rules, updated_rules = get_diff_rules(OLD_JSON, NEW_JSON)

with open(DIFF_MARKDOWN, "w", encoding="utf-8") as f:
f.write("## 新增规则\n")
f.write("|规则|示例|\n")
f.write("|----|----|\n")
for rule in added_rules:
f.write(rule.to_markdown_tr(verbose=False))
if added_rules:
f.write("## 新增规则\n")
f.write("|规则|示例|\n")
f.write("|----|----|\n")
for rule in added_rules:
f.write(rule.to_markdown_tr(verbose=False) + "\n")

f.write("\n")

f.write("## 更新规则\n")
f.write("|规则|示例|\n")
f.write("|----|----|\n")
for rule in updated_rules:
f.write(rule.to_markdown_tr(verbose=False))
if updated_rules:
f.write("## 更新规则\n")
f.write("|规则|示例|\n")
f.write("|----|----|\n")
for rule in updated_rules:
f.write(rule.to_markdown_tr(verbose=False) + "\n")

f.write("\n")

f.write("## 移除规则\n")
f.write("|规则|示例|\n")
f.write("|----|----|\n")
for rule in removed_rules:
f.write(rule.to_markdown_tr(verbose=False))
if removed_rules:
f.write("## 移除规则\n")
f.write("|规则|示例|\n")
f.write("|----|----|\n")
for rule in removed_rules:
f.write(rule.to_markdown_tr(verbose=False) + "\n")
except Exception as e:
print(e)
exit(1)
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def to_markdown_tr(self, verbose: bool = False) -> str:
Returns:
str: Markdown 表格行
"""
filter_markdown = f"`{self.filter}`"
filter_markdown = f"`{self.filter.replace("|", "\|")}`"

if self.examples:
examples_markdown = "、".join([f"`{example}`" for example in self.examples])
Expand Down

0 comments on commit 98c29bb

Please sign in to comment.