mirror of https://github.com/zulip/zulip.git
fenced_code.py: Implement error logging for hiliter.
Instead of returning error 400 when pygment library fails to parse we log the error and keep going Fixes #22287
This commit is contained in:
parent
1e4427caf5
commit
f8ff1ba31e
|
@ -76,6 +76,7 @@ Dependencies:
|
|||
|
||||
"""
|
||||
|
||||
import logging
|
||||
import re
|
||||
from typing import Any, Callable, Dict, Iterable, List, Mapping, MutableSequence, Optional, Sequence
|
||||
|
||||
|
@ -491,7 +492,11 @@ class FencedBlockPreprocessor(Preprocessor):
|
|||
startinline=True,
|
||||
)
|
||||
|
||||
try:
|
||||
code = highliter.hilite().rstrip("\n")
|
||||
except Exception as e:
|
||||
logging.error("Processing fenced code block with lang %s", e)
|
||||
code = CODE_WRAP.format(langclass, self._escape(text))
|
||||
else:
|
||||
code = CODE_WRAP.format(langclass, self._escape(text))
|
||||
|
||||
|
|
Loading…
Reference in New Issue