mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-11-27 17:00:37 +00:00
fix(feishu): preserve markdown examples in multi-backtick code spans (#8460)
This commit is contained in:
parent
9ba9bfad41
commit
f95d77f961
@ -161,7 +161,8 @@ _LONE_SURROGATE = re.compile("[\ud800-\udfff]")
|
||||
# A markdown image marker, rewritten for the card so Feishu never sees one.
|
||||
_MARKDOWN_IMAGE = re.compile(r"!\[(?P<alt>[^\]]*)\]\((?P<target>[^)\s]*)[^)]*\)")
|
||||
_FENCED_CODE = re.compile(r"(?ms)^[ \t]*(?P<fence>`{3,}|~{3,})[^\n]*\n.*?^[ \t]*(?P=fence)[ \t]*$")
|
||||
_INLINE_CODE_SPAN = re.compile(r"`[^`\n]*`")
|
||||
# Both delimiters are complete backtick runs of the same length.
|
||||
_INLINE_CODE_SPAN = re.compile(r"(?<!`)(?P<ticks>`+)(?!`)[^\n]*?(?<!`)(?P=ticks)(?!`)")
|
||||
# A fence a streamed snapshot cut open: what follows its opener is still code.
|
||||
_UNCLOSED_FENCE = re.compile(r"(?m)^[ \t]*(?P<fence>`{3,}|~{3,})[^\n]*$")
|
||||
|
||||
|
||||
@ -240,6 +240,9 @@ async def test_reply_without_running_card_and_push_without_source_split_too(feis
|
||||
("plain answer", "plain answer", False),
|
||||
# Code renders literally in a card, so the shown source must not change.
|
||||
("inline `` keeps its marker", "inline `` keeps its marker", True),
|
||||
("example ```` and ", "example ```` and [c](d)", True),
|
||||
("example ``use ` before `` and ", "example ``use ` before `` and [c](d)", True),
|
||||
("unclosed `` before ", "unclosed `` before [c](d)", False),
|
||||
("```\n\n```", "```\n\n```", True),
|
||||
# A snapshot streamed before the closing fence arrives keeps its open block literal.
|
||||
("```\n", "```\n", True),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user