Even better code block detection

This commit is contained in:
jeffser 2024-10-06 22:23:37 -06:00
parent 06769aba90
commit 67d572bd64

View File

@ -484,7 +484,7 @@ class message(Gtk.Overlay):
self.content_children = []
if text:
self.content_children = []
code_block_pattern = re.compile(r'```(\w*)\n(.*?)\n\s*```', re.DOTALL)
code_block_pattern = re.compile(r'[```|`](\w*)\n(.*?)\n\s*[```|`]', re.DOTALL)
table_pattern = re.compile(r'((\r?\n){2}|^)([^\r\n]*\|[^\r\n]*(\r?\n)?)+(?=(\r?\n){2}|$)', re.MULTILINE)
bold_pattern = re.compile(r'\*\*(.*?)\*\*') #"**text**"
code_pattern = re.compile(r'`([^`\n]*?)`') #"`text`"