mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-30 19:36:24 +02:00
Fix: Correct regex pattern to accurately match code blocks in Markdown
This commit is contained in:
parent
93e4c12610
commit
991bfd6f68
1 changed files with 1 additions and 1 deletions
|
|
@ -275,7 +275,7 @@ class CodeParser:
|
|||
def parse_code(cls, text: str, lang: str = "", block: Optional[str] = None) -> str:
|
||||
if block:
|
||||
text = cls.parse_block(block, text)
|
||||
pattern = rf"```{lang}.*?\s+(.*?)```"
|
||||
pattern = rf"```{lang}.*?\s+(.*?)\n```"
|
||||
match = re.search(pattern, text, re.DOTALL)
|
||||
if match:
|
||||
code = match.group(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue