diff --git a/src/sonatoki/Preprocessors.py b/src/sonatoki/Preprocessors.py index 4dc4ab2..4b14dc9 100644 --- a/src/sonatoki/Preprocessors.py +++ b/src/sonatoki/Preprocessors.py @@ -150,8 +150,8 @@ class Codeblock(RegexPreprocessor): """ pattern = re.compile( - r"^```(?:[\w\-]+)?$(?:(?!```).*?)^```$", - flags=re.MULTILINE | re.DOTALL, + r"```.+?```", + flags=re.DOTALL, ) diff --git a/tests/test_preprocessors.py b/tests/test_preprocessors.py index 63a7702..cb577de 100644 --- a/tests/test_preprocessors.py +++ b/tests/test_preprocessors.py @@ -63,6 +63,12 @@ def test_Backticks(s: str): second blocky message ```""" ) +@example( + """```oisandm123-_mu +arbitrary content +```""" +) +@example("""```mu```""") def test_Codeblock(s: str): res = Codeblock.process(s).strip() assert res == "", (repr(s), repr(res))