mirror of https://github.com/zulip/zulip.git
bugdown: Add 'none' as alias for no syntax highlighting in codeblocks.
This is a precursor to #14404.
This commit is contained in:
parent
326b0e0378
commit
3f6541b306
|
@ -31,6 +31,7 @@
|
|||
"matlab": 33,
|
||||
"mql": 9,
|
||||
"mql4": 9,
|
||||
"none": 1,
|
||||
"objective-c": 35,
|
||||
"objectivec": 35,
|
||||
"objectpascal": 42,
|
||||
|
@ -38,6 +39,7 @@
|
|||
"perl": 40,
|
||||
"php": 44,
|
||||
"pl": 40,
|
||||
"plain": 1,
|
||||
"prolog": 16,
|
||||
"python": 46,
|
||||
"quote": 50,
|
||||
|
@ -45,6 +47,7 @@
|
|||
"rb": 39,
|
||||
"ruby": 39,
|
||||
"rust": 8,
|
||||
"text": 1,
|
||||
"sas": 30,
|
||||
"scala": 21,
|
||||
"scheme": 14,
|
||||
|
|
|
@ -165,6 +165,11 @@ def generic_handler(processor: Any, output: MutableSequence[str],
|
|||
else:
|
||||
return CodeHandler(processor, output, fence, lang, run_content_validators)
|
||||
|
||||
def remap_language(lang: str) -> str:
|
||||
if lang in ['none', 'noop', 'text', 'plain']:
|
||||
return ''
|
||||
return lang
|
||||
|
||||
def check_for_new_fence(processor: Any, output: MutableSequence[str], line: str,
|
||||
run_content_validators: Optional[bool]=False) -> None:
|
||||
m = FENCE_RE.match(line)
|
||||
|
@ -172,6 +177,8 @@ def check_for_new_fence(processor: Any, output: MutableSequence[str], line: str,
|
|||
fence = m.group('fence')
|
||||
lang = m.group('lang')
|
||||
|
||||
lang = remap_language(lang)
|
||||
|
||||
handler = generic_handler(processor, output, fence, lang, run_content_validators)
|
||||
processor.push(handler)
|
||||
else:
|
||||
|
|
|
@ -119,6 +119,10 @@ class FencedBlockPreprocessorTest(TestCase):
|
|||
'```c#',
|
||||
'weirdchar()',
|
||||
'```',
|
||||
'',
|
||||
'``` none',
|
||||
'no-highlight()',
|
||||
'```',
|
||||
''
|
||||
]
|
||||
expected = [
|
||||
|
@ -133,6 +137,10 @@ class FencedBlockPreprocessorTest(TestCase):
|
|||
'',
|
||||
'**c#:weirdchar()**',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'**:no-highlight()**',
|
||||
'',
|
||||
''
|
||||
]
|
||||
lines = processor.run(markdown)
|
||||
|
|
Loading…
Reference in New Issue