Skip to content

Commit

Permalink
fix highlight block
Browse files Browse the repository at this point in the history
  • Loading branch information
DeppWang committed Jun 12, 2024
1 parent a735ab9 commit b645501
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions core/covert.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,6 @@ def convert_text_func(self, content) -> str:
one_five_contents = content.get("5")
if one_five_contents:
for one_five_content in one_five_contents:
# 3 高亮块
three_content = one_five_content.get("3")
# 包含 6 和 7
two_five_contents = one_five_content.get("5")
# 文本类型
Expand All @@ -238,10 +236,6 @@ def convert_text_func(self, content) -> str:
text = f"[{source_text}]({hf})"
else:
text = ""
# 如果是高亮块
elif three_content and two_five_contents:
source_text = self._get_common_text(one_five_content)
text = "```\r\n{text}\r\n```".format(text=source_text)
else:
text = ""
if text:
Expand Down Expand Up @@ -276,13 +270,22 @@ def convert_cd_func(self, content):
code_block = ""
for code in codes:
text = self._get_common_text(code)
if text:
code_block += text + "\n"
code_block += text + "\n"

return "```{language}\r\n{code_block}```".format(
language=language, code_block=code_block
)

def convert_la_func(self, content):
"""高亮块"""
codes: list = content.get("5")
code_block = ""
for code in codes:
text = self._get_common_text(code)
code_block += text + "\n"

return "```\r\n{code_block}```".format(code_block=code_block)

def convert_q_func(self, content):
"""引用"""
q_text_list = content["5"]
Expand Down

0 comments on commit b645501

Please sign in to comment.