mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
fenced_code: Optimize FENCE_RE to fix cubic worst-case complexity.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Alex Vandiver
parent
ad858d2c79
commit
2df2f7eec6
@@ -69,8 +69,8 @@ from zerver.models import (
|
||||
class SimulatedFencedBlockPreprocessor(FencedBlockPreprocessor):
|
||||
# Simulate code formatting.
|
||||
|
||||
def format_code(self, lang: str, code: str) -> str:
|
||||
return lang + ":" + code
|
||||
def format_code(self, lang: Optional[str], code: str) -> str:
|
||||
return (lang or "") + ":" + code
|
||||
|
||||
def placeholder(self, s: str) -> str:
|
||||
return "**" + s.strip("\n") + "**"
|
||||
|
||||
Reference in New Issue
Block a user