mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-30 10:56:53 -05:00
Fix #3427: allow language-specific images in Markdown articles
This commit is contained in:
parent
fd8f65cadc
commit
5ff1c4b700
1 changed files with 5 additions and 2 deletions
|
@ -259,8 +259,11 @@ module.exports.filterMarkdownCodeLanguages = (text, language) ->
|
|||
return '' unless text
|
||||
currentLanguage = language or me.get('aceConfig')?.language or 'python'
|
||||
excludedLanguages = _.without ['javascript', 'python', 'coffeescript', 'clojure', 'lua', 'java', 'io'], currentLanguage
|
||||
exclusionRegex = new RegExp "```(#{excludedLanguages.join('|')})\n[^`]+```\n?", 'gm'
|
||||
text.replace exclusionRegex, ''
|
||||
# Exclude language-specific code blocks like ```python (... code ...)``` for each non-target language.
|
||||
codeBlockExclusionRegex = new RegExp "```(#{excludedLanguages.join('|')})\n[^`]+```\n?", 'gm'
|
||||
# Exclude language-specific images like ![python - image description](image url) for each non-target language.
|
||||
imageExclusionRegex = new RegExp "!\\[(#{excludedLanguages.join('|')}) - .+?\\]\\(.+?\\)\n?", 'gm'
|
||||
return text.replace(codeBlockExclusionRegex, '').replace(imageExclusionRegex, '')
|
||||
|
||||
module.exports.aceEditModes = aceEditModes =
|
||||
'javascript': 'ace/mode/javascript'
|
||||
|
|
Loading…
Reference in a new issue