bugdown: Add 'none' as alias for no syntax highlighting in codeblocks.

This is a precursor to #14404.
This commit is contained in:
Rohitt Vashishtha
2020-03-31 05:42:15 +05:30
committed by Tim Abbott
parent 326b0e0378
commit 3f6541b306
3 changed files with 18 additions and 0 deletions

View File

@@ -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: